org.libvirt

Class StoragePool

public class StoragePool extends Object

A collection of storage
Field Summary
protected Libvirtlibvirt
the libvirt instance
protected ConnectvirConnect
The VirConnect Object that represents the Hypervisor of this Domain
protected StoragePoolPointerVSPP
the native virStoragePoolPtr.
Method Summary
voidbuild(int flags)
Build the underlying storage pool
voidcreate(int flags)
Starts this inactive storage pool
voiddelete(int flags)
Delete the underlying pool resources.
voiddestroy()
Destroy an active storage pool.
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 time
ConnectgetConnect()
Provides the connection pointer associated with a storage pool.
StoragePoolInfogetInfo()
Get volatile information about the storage pool such as free space / usage summary
StringgetName()
Fetch the locally unique name of the storage pool
int[]getUUID()
Fetch the globally unique ID of this storage pool
StringgetUUIDString()
Fetch the globally unique ID of the storage pool as a string
StringgetXMLDesc(int flags)
Fetch an XML document describing all aspects of the storage pool.
intisActive()
Determine if the storage pool is currently running
intisPersistent()
Determine if the storage pool has a persistent configuration which means it will still exist after shutting down
String[]listVolumes()
Fetch list of storage volume names
intnumOfVolumes()
Fetch the number of storage volumes within a pool
protected voidprocessError()
voidrefresh(int flags)
Request that the pool refresh its list of volumes.
voidsetAutostart(int autostart)
Sets the autostart flag
StorageVolstorageVolCreateXML(String xmlDesc, int flags)
Create a storage volume within a pool based on an XML description.
StorageVolstorageVolCreateXMLFrom(String xmlDesc, StorageVol cloneVolume, int flags)
Create a storage volume in the parent pool, using the 'clonevol' volume as input.
StorageVolstorageVolLookupByName(String name)
Fetch an object representing to a storage volume based on its name within a pool
voidundefine()
Undefine an inactive storage pool

Field Detail

libvirt

protected Libvirt libvirt
the libvirt instance

virConnect

protected Connect virConnect
The VirConnect Object that represents the Hypervisor of this Domain

VSPP

protected StoragePoolPointer VSPP
the native virStoragePoolPtr.

Method Detail

build

public void build(int flags)
Build the underlying storage pool

Parameters: flags future flags, use 0 for now

create

public void create(int flags)
Starts this inactive storage pool

Parameters: flags future flags, use 0 for now

delete

public void delete(int flags)
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

destroy

public void destroy()
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.

free

public int free()
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) for success, -1 for failure.

Throws: LibvirtException

getAutostart

public boolean getAutostart()
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()
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 String getName()
Fetch the locally unique name of the storage pool

Returns: the name

Throws: LibvirtException

getUUID

public int[] getUUID()
Fetch the globally unique ID of this storage pool

Returns: the UUID as an unpacked int array

Throws: LibvirtException

getUUIDString

public String getUUIDString()
Fetch the globally unique ID of the storage pool as a string

Returns: the UUID in canonical String format

Throws: LibvirtException

getXMLDesc

public String getXMLDesc(int flags)
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

isActive

public int isActive()
Determine if the storage pool is currently running

Returns: 1 if running, 0 if inactive, -1 on error

Throws: LibvirtException

See Also: Libvirt Documentation

isPersistent

public int isPersistent()
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, -1 on error

Throws: LibvirtException

See Also: Libvirt Documentation

listVolumes

public String[] listVolumes()
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()
Fetch the number of storage volumes within a pool

Returns: the number of storage pools

Throws: LibvirtException

processError

protected void processError()

refresh

public void refresh(int flags)
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)
Sets the autostart flag

Parameters: autostart new flag setting

Throws: LibvirtException

storageVolCreateXML

public StorageVol storageVolCreateXML(String xmlDesc, int flags)
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 create flags flags for creation (unused, pass 0)

Returns: the storage volume

Throws: LibvirtException

storageVolCreateXMLFrom

public StorageVol storageVolCreateXMLFrom(String xmlDesc, StorageVol cloneVolume, int flags)
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.

Returns:

Throws: LibvirtException

storageVolLookupByName

public StorageVol storageVolLookupByName(String name)
Fetch an object representing to a storage volume based on its name within a pool

Parameters: name name of storage volume

Returns: The StorageVol object found

Throws: LibvirtException

undefine

public void undefine()
Undefine an inactive storage pool

Throws: LibvirtException