Package org.libvirt
Class StorageVol
- java.lang.Object
-
- org.libvirt.StorageVol
-
public class StorageVol extends java.lang.ObjectAn acutal storage bucket.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStorageVol.DownloadFlagsstatic classStorageVol.ResizeFlagsstatic classStorageVol.Typestatic classStorageVol.UploadFlags
-
Field Summary
Fields Modifier and Type Field Description protected ConnectvirConnectThe VirConnect Object that represents the Hypervisor of this Domain
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(int flags)Delete the storage volume from the poolvoiddownload(Stream stream, long offset, long length, int flags)Download the content of the volume as a streamprotected voidfinalize()intfree()Release the storage volume handle.ConnectgetConnect()Provides the connection object associated with a storage volume.StorageVolInfogetInfo()Fetches volatile information about the storage volume such as its current allocationjava.lang.StringgetKey()Fetch the storage volume key.java.lang.StringgetName()Fetch the storage volume name.java.lang.StringgetPath()Fetch the storage volume path.java.lang.StringgetXMLDesc(int flags)Fetch an XML document describing all aspects of this storage volumeintresize(long capacity, int flags)Resize a volumeStoragePoolstoragePoolLookupByVolume()Fetch a storage pool which contains this volumevoidupload(Stream stream, long offset, long length, int flags)Upload new content to the volume from a streamintwipe()Ensure data previously on a volume is not accessible to future reads
-
-
-
Field Detail
-
virConnect
protected Connect virConnect
The VirConnect Object that represents the Hypervisor of this Domain
-
-
Method Detail
-
delete
public void delete(int flags) throws LibvirtExceptionDelete the storage volume from the pool- Parameters:
flags- future flags, use 0 for now- Throws:
LibvirtException
-
finalize
protected void finalize() throws LibvirtException- Overrides:
finalizein classjava.lang.Object- Throws:
LibvirtException
-
free
public int free() throws LibvirtExceptionRelease the storage volume handle. The underlying storage volume contains to exist- Returns:
- number of references left (>= 0)
- Throws:
LibvirtException
-
getConnect
public Connect getConnect()
Provides the connection object associated with a storage volume. The reference counter on the connection is not increased by this call.- Returns:
- the Connect object
-
getInfo
public StorageVolInfo getInfo() throws LibvirtException
Fetches volatile information about the storage volume such as its current allocation- Returns:
- StorageVolInfo object
- Throws:
LibvirtException
-
getKey
public java.lang.String getKey() throws LibvirtExceptionFetch the storage volume key. This is globally unique, so the same volume will have the same key no matter what host it is accessed from- Returns:
- the key
- Throws:
LibvirtException
-
getName
public java.lang.String getName() throws LibvirtExceptionFetch the storage volume name. This is unique within the scope of a pool- Returns:
- the name
- Throws:
LibvirtException
-
getPath
public java.lang.String getPath() throws LibvirtExceptionFetch the storage volume path. Depending on the pool configuration this is either persistent across hosts, or dynamically assigned at pool startup. Consult pool documentation for information on getting the persistent naming- Returns:
- the storage volume path
- Throws:
LibvirtException
-
getXMLDesc
public java.lang.String getXMLDesc(int flags) throws LibvirtExceptionFetch an XML document describing all aspects of this storage volume- Parameters:
flags- flags for XML generation (unused, pass 0)- Returns:
- the XML document
- Throws:
LibvirtException
-
storagePoolLookupByVolume
public StoragePool storagePoolLookupByVolume() throws LibvirtException
Fetch a storage pool which contains this volume- Returns:
- StoragePool object, or
nullif not found. - Throws:
LibvirtException
-
wipe
public int wipe() throws LibvirtExceptionEnsure data previously on a volume is not accessible to future reads- Returns:
- ignore (always 0)
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
resize
public int resize(long capacity, int flags) throws LibvirtExceptionResize a volume- Parameters:
capacity- new capacity for volumeflags- flags for resizing, see libvirt API for exact flags- Returns:
- ignore (always 0)
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
upload
public void upload(Stream stream, long offset, long length, int flags) throws LibvirtException
Upload new content to the volume from a stream- Parameters:
stream- stream to use as inputoffset- position to start writing tolength- limit on amount of data to uploadflags- seeStorageVol.UploadFlags- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
download
public void download(Stream stream, long offset, long length, int flags) throws LibvirtException
Download the content of the volume as a stream- Parameters:
stream- stream to use as outputoffset- position to start reading fromlength- limit on amount of data to downloadflags- seeStorageVol.DownloadFlags- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
-