Package org.libvirt
Class StoragePool
- java.lang.Object
-
- org.libvirt.StoragePool
-
public class StoragePool extends java.lang.Object
A collection of storage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StoragePool.VolumeCreateFlags
-
Field Summary
Fields Modifier and Type Field Description protected Connect
virConnect
The VirConnect Object that represents the Hypervisor of this Domainprotected StoragePoolPointer
vspp
the native virStoragePoolPtr.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
build(int flags)
Build the underlying storage poolvoid
create(int flags)
Starts this inactive storage poolvoid
delete(int flags)
Delete the underlying pool resources.void
destroy()
Destroy an active storage pool.protected void
finalize()
int
free()
Free a storage pool object, releasing all memory associated with it.boolean
getAutostart()
Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot timeConnect
getConnect()
Provides the connection pointer associated with a storage pool.StoragePoolInfo
getInfo()
Get volatile information about the storage pool such as free space / usage summaryjava.lang.String
getName()
Fetch the locally unique name of the storage poolint[]
getUUID()
Fetch the globally unique ID of this storage pooljava.lang.String
getUUIDString()
Fetch the globally unique ID of the storage pool as a stringjava.lang.String
getXMLDesc(int flags)
Fetch an XML document describing all aspects of the storage pool.int
isActive()
Determine if the storage pool is currently runningint
isPersistent()
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 namesint
numOfVolumes()
Fetch the number of storage volumes within a poolvoid
refresh(int flags)
Request that the pool refresh its list of volumes.void
setAutostart(int autostart)
Sets the autostart flagStorageVol
storageVolCreateXML(java.lang.String xmlDesc, int flags)
Create a storage volume within a pool based on an XML description.StorageVol
storageVolCreateXMLFrom(java.lang.String xmlDesc, StorageVol cloneVolume, int flags)
Create a storage volume in the parent pool, using the 'clonevol' volume as input.StorageVol
storageVolLookupByName(java.lang.String name)
Fetch an object representing to a storage volume based on its name within a poolvoid
undefine()
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 LibvirtException
Build the underlying storage pool- Parameters:
flags
- future flags, use 0 for now- Throws:
LibvirtException
-
create
public void create(int flags) throws LibvirtException
Starts this inactive storage pool- Parameters:
flags
- future flags, use 0 for now- Throws:
LibvirtException
-
delete
public void delete(int flags) throws LibvirtException
Delete 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 LibvirtException
Destroy 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:
finalize
in classjava.lang.Object
- Throws:
LibvirtException
-
free
public int free() throws LibvirtException
Free 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 LibvirtException
Fetches 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 LibvirtException
Fetch the locally unique name of the storage pool- Returns:
- the name
- Throws:
LibvirtException
-
getUUID
public int[] getUUID() throws LibvirtException
Fetch 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 LibvirtException
Fetch 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 LibvirtException
Fetch 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 LibvirtException
Determine 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 LibvirtException
Determine 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 LibvirtException
Fetch 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 LibvirtException
Fetch the number of storage volumes within a pool- Returns:
- the number of storage pools
- Throws:
LibvirtException
-
refresh
public void refresh(int flags) throws LibvirtException
Request 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 LibvirtException
Sets 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
null
if not found. - Throws:
LibvirtException
-
undefine
public void undefine() throws LibvirtException
Undefine an inactive storage pool- Throws:
LibvirtException
-
-