Package org.libvirt
Class StoragePool
- java.lang.Object
-
- org.libvirt.StoragePool
-
public class StoragePool extends java.lang.ObjectA collection of storage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStoragePool.VolumeCreateFlags
-
Field Summary
Fields Modifier and Type Field Description protected ConnectvirConnectThe VirConnect Object that represents the Hypervisor of this Domainprotected StoragePoolPointervsppthe native virStoragePoolPtr.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(int flags)Build the underlying storage poolvoidcreate(int flags)Starts this inactive storage poolvoiddelete(int flags)Delete the underlying pool resources.voiddestroy()Destroy an active storage pool.protected voidfinalize()intfree()Free a storage pool object, releasing all memory associated with it.booleangetAutostart()Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot timeConnectgetConnect()Provides the connection pointer associated with a storage pool.StoragePoolInfogetInfo()Get volatile information about the storage pool such as free space / usage summaryjava.lang.StringgetName()Fetch the locally unique name of the storage poolint[]getUUID()Fetch the globally unique ID of this storage pooljava.lang.StringgetUUIDString()Fetch the globally unique ID of the storage pool as a stringjava.lang.StringgetXMLDesc(int flags)Fetch an XML document describing all aspects of the storage pool.intisActive()Determine if the storage pool is currently runningintisPersistent()Determine if the storage pool has a persistent configuration which means it will still exist after shutting downjava.lang.String[]listVolumes()Fetch list of storage volume namesintnumOfVolumes()Fetch the number of storage volumes within a poolvoidrefresh(int flags)Request that the pool refresh its list of volumes.voidsetAutostart(int autostart)Sets the autostart flagStorageVolstorageVolCreateXML(java.lang.String xmlDesc, int flags)Create a storage volume within a pool based on an XML description.StorageVolstorageVolCreateXMLFrom(java.lang.String xmlDesc, StorageVol cloneVolume, int flags)Create a storage volume in the parent pool, using the 'clonevol' volume as input.StorageVolstorageVolLookupByName(java.lang.String name)Fetch an object representing to a storage volume based on its name within a poolvoidundefine()Undefine an inactive storage pool
-
-
-
Field Detail
-
vspp
protected StoragePoolPointer vspp
the native virStoragePoolPtr.
-
virConnect
protected Connect virConnect
The VirConnect Object that represents the Hypervisor of this Domain
-
-
Method Detail
-
build
public void build(int flags) throws LibvirtExceptionBuild the underlying storage pool- Parameters:
flags- future flags, use 0 for now- Throws:
LibvirtException
-
create
public void create(int flags) throws LibvirtExceptionStarts this inactive storage pool- Parameters:
flags- future flags, use 0 for now- Throws:
LibvirtException
-
delete
public void delete(int flags) throws LibvirtExceptionDelete the underlying pool resources. This is a non-recoverable operation. The virStoragePool object itself is not free'd.- Parameters:
flags- flags for obliteration process- Throws:
LibvirtException
-
destroy
public void destroy() throws LibvirtExceptionDestroy an active storage pool. This will deactivate the pool on the host, but keep any persistent config associated with it. If it has a persistent config it can later be restarted with virStoragePoolCreate(). This does not free the associated virStoragePoolPtr object.- Throws:
LibvirtException
-
finalize
protected void finalize() throws LibvirtException- Overrides:
finalizein classjava.lang.Object- Throws:
LibvirtException
-
free
public int free() throws LibvirtExceptionFree a storage pool object, releasing all memory associated with it. Does not change the state of the pool on the host.- Returns:
- number of references left (>= 0)
- Throws:
LibvirtException
-
getAutostart
public boolean getAutostart() throws LibvirtExceptionFetches the value of the autostart flag, which determines whether the pool is automatically started at boot time- Returns:
- the result
- Throws:
LibvirtException
-
getConnect
public Connect getConnect()
Provides the connection pointer associated with a storage pool.- Returns:
- the Connect object
-
getInfo
public StoragePoolInfo getInfo() throws LibvirtException
Get volatile information about the storage pool such as free space / usage summary- Returns:
- a StoragePoolInfo object describing this storage pool
- Throws:
LibvirtException
-
getName
public java.lang.String getName() throws LibvirtExceptionFetch the locally unique name of the storage pool- Returns:
- the name
- Throws:
LibvirtException
-
getUUID
public int[] getUUID() throws LibvirtExceptionFetch the globally unique ID of this storage pool- Returns:
- the UUID as an unpacked int array
- Throws:
LibvirtException
-
getUUIDString
public java.lang.String getUUIDString() throws LibvirtExceptionFetch the globally unique ID of the storage pool as a string- Returns:
- the UUID in canonical String format
- Throws:
LibvirtException
-
getXMLDesc
public java.lang.String getXMLDesc(int flags) throws LibvirtExceptionFetch an XML document describing all aspects of the storage pool. This is suitable for later feeding back into the virStoragePoolCreateXML method.- Parameters:
flags- flags for XML format options (set of virDomainXMLFlags)- Returns:
- a XML document -java @throws LibvirtException
- Throws:
LibvirtException
-
isActive
public int isActive() throws LibvirtExceptionDetermine if the storage pool is currently running- Returns:
- 1 if running, 0 if inactive
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
isPersistent
public int isPersistent() throws LibvirtExceptionDetermine if the storage pool has a persistent configuration which means it will still exist after shutting down- Returns:
- 1 if persistent, 0 if transient
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
listVolumes
public java.lang.String[] listVolumes() throws LibvirtExceptionFetch list of storage volume names- Returns:
- an Array of Strings that contains the names of the storage volumes
- Throws:
LibvirtException
-
numOfVolumes
public int numOfVolumes() throws LibvirtExceptionFetch the number of storage volumes within a pool- Returns:
- the number of storage pools
- Throws:
LibvirtException
-
refresh
public void refresh(int flags) throws LibvirtExceptionRequest that the pool refresh its list of volumes. This may involve communicating with a remote server, and/or initializing new devices at the OS layer- Parameters:
flags- flags to control refresh behaviour (currently unused, use 0)- Throws:
LibvirtException
-
setAutostart
public void setAutostart(int autostart) throws LibvirtExceptionSets the autostart flag- Parameters:
autostart- new flag setting- Throws:
LibvirtException
-
storageVolCreateXML
public StorageVol storageVolCreateXML(java.lang.String xmlDesc, int flags) throws LibvirtException
Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes- Parameters:
xmlDesc- description of volume to createflags- flags for creation, seeStoragePool.VolumeCreateFlags- Returns:
- the storage volume
- Throws:
LibvirtException
-
storageVolCreateXMLFrom
public StorageVol storageVolCreateXMLFrom(java.lang.String xmlDesc, StorageVol cloneVolume, int flags) throws LibvirtException
Create a storage volume in the parent pool, using the 'clonevol' volume as input. Information for the new volume (name, perms) are passed via a typical volume XML description.- Parameters:
xmlDesc- description of volume to createcloneVolume- storage volume to use as inputflags- flags for creation, seeStoragePool.VolumeCreateFlags- Returns:
- The storage volume
- Throws:
LibvirtException
-
storageVolLookupByName
public StorageVol storageVolLookupByName(java.lang.String name) throws LibvirtException
Fetch an object representing to a storage volume based on its name within a pool- Parameters:
name- name of storage volume- Returns:
- a StorageVol object, or
nullif not found. - Throws:
LibvirtException
-
undefine
public void undefine() throws LibvirtExceptionUndefine an inactive storage pool- Throws:
LibvirtException
-
-