Package org.libvirt

Class StoragePool

java.lang.Object
org.libvirt.StoragePool

public class StoragePool extends Object
A collection of storage
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Connect
    The VirConnect Object that represents the Hypervisor of this Domain
    the native virStoragePoolPtr.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    build(int flags)
    Build the underlying storage pool
    void
    create(int flags)
    Starts this inactive storage pool
    void
    delete(int flags)
    Delete the underlying pool resources.
    void
    Destroy an active storage pool.
    protected void
     
    int
    Free a storage pool object, releasing all memory associated with it.
    boolean
    Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot time
    Provides the connection pointer associated with a storage pool.
    Get volatile information about the storage pool such as free space / usage summary
    Fetch the locally unique name of the storage pool
    int[]
    Fetch the globally unique ID of this storage pool
    Fetch the globally unique ID of the storage pool as a string
    getXMLDesc(int flags)
    Fetch an XML document describing all aspects of the storage pool.
    int
    Determine if the storage pool is currently running
    int
    Determine if the storage pool has a persistent configuration which means it will still exist after shutting down
    Fetch list of storage volume names
    int
    Fetch the number of storage volumes within a pool
    void
    refresh(int flags)
    Request that the pool refresh its list of volumes.
    void
    setAutostart(int autostart)
    Sets the autostart flag
    storageVolCreateXML(String xmlDesc, int flags)
    Create a storage volume within a pool based on an XML description.
    storageVolCreateXMLFrom(String xmlDesc, StorageVol cloneVolume, int flags)
    Create a storage volume in the parent pool, using the 'clonevol' volume as input.
    Fetch an object representing to a storage volume based on its name within a pool
    void
    Undefine an inactive storage pool

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • vspp

      protected StoragePoolPointer vspp
      the native virStoragePoolPtr.
    • virConnect

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

    • 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 class 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 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 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 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:
    • 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:
    • listVolumes

      public 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(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 create
      flags - flags for creation, see StoragePool.VolumeCreateFlags
      Returns:
      the storage volume
      Throws:
      LibvirtException
    • storageVolCreateXMLFrom

      public StorageVol storageVolCreateXMLFrom(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 create
      cloneVolume - storage volume to use as input
      flags - flags for creation, see StoragePool.VolumeCreateFlags
      Returns:
      The storage volume
      Throws:
      LibvirtException
    • storageVolLookupByName

      public StorageVol storageVolLookupByName(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