org.libvirt

Class Connect

public class Connect extends Object

The Connect object represents a connection to a local or remote hypervisor/driver.

Author: stoty

Field Summary
protected ConnectionPointerVCP
The native virConnectPtr.
Constructor Summary
Connect(String uri)
Constructs a read-write Connect object from the supplied URI.
Connect(String uri, boolean readOnly)
Constructs a Connect object from the supplied URI.
Connect(String uri, ConnectAuth auth, int flags)
Constructs a Connect object from the supplied URI, using the supplied authentication callback
Method Summary
StringbaselineCPU(String[] xmlCPUs)
Computes the most feature-rich CPU which is compatible with all given host CPUs.
intclose()
Closes the connection to the hypervisor/driver.
CPUCompareResultcompareCPU(String xmlDesc)
Compares the given CPU description with the host CPU
static ConnectconnectionForDomain(Domain domain)
Creates a new connection object from the domain.
static ConnectconnectionForNetwork(Network network)
Creates a new connection object from the network.
static ConnectconnectionForSecret(Secret secret)
Creates a new connection object from the network.
static longconnectionVersion(Connect conn)
Get the version of a connection.
static int[]convertUUIDBytes(byte[] bytes)
Helper function to convert bytes into ints for the UUID calls
static byte[]createUUIDBytes(int[] UUID)
Helper function to convert UUIDs into a stirng for the UUID calls
DevicedeviceCreateXML(String xmlDesc)
Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.
DevicedeviceLookupByName(String name)
Fetch a device based on its unique name
DomaindomainCreateLinux(String xmlDesc, int flags)
Launches a new Linux guest domain.
DomaindomainCreateXML(String xmlDesc, int flags)
Launch a new guest domain, based on an XML description
DomaindomainDefineXML(String xmlDesc)
Defines a domain, but does not start it
intdomainEventDeregisterAny(int callbackID)
Removes an event callback.
intdomainEventRegisterAny(Domain domain, int eventId, Libvirt.VirConnectDomainEventGenericCallback cb)
Adds a callback to receive notifications of arbitrary domain events occurring on a domain.
DomaindomainLookupByID(int id)
Finds a domain based on the hypervisor ID number.
DomaindomainLookupByName(String name)
Looks up a domain based on its name.
DomaindomainLookupByUUID(int[] UUID)
Looks up a domain based on its UUID in array form.
DomaindomainLookupByUUID(UUID uuid)
Fetch a domain based on its globally unique id
DomaindomainLookupByUUIDString(String UUID)
Looks up a domain based on its UUID in String form.
StringdomainXMLFromNative(String nativeFormat, String nativeConfig, int flags)
Reads a native XML configuration document, and generates generates a domain configuration file describing the domain.
StringdomainXMLToNative(String nativeFormat, String domainXML, int flags)
Reads a domain XML configuration document, and generates generates a native configuration file describing the domain.
StringfindStoragePoolSources(String type, String srcSpecs, int flags)
Talks to a storage backend and attempts to auto-discover the set of available storage pool sources. e.g.
StringgetCapabilities()
Provides capabilities of the hypervisor / driver.
longgetCellsFreeMemory(int startCells, int maxCells)
NUMA Support
longgetFreeMemory()
Returns the free memory for the connection
StringgetHostName()
Returns the system hostname on which the hypervisor is running. (the result of the gethostname(2) system call) If we are connected to a remote system, then this returns the hostname of the remote system.
longgetHypervisorVersion(String type)
Returns the version of the hypervisor against which the library was compiled.
longgetLibVirVersion()
Gets the version of the native libvirt library that the JNI part is linked to.
intgetMaxVcpus(String type)
Provides the maximum number of virtual CPUs supported for a guest VM of a specific type.
StringgetType()
Gets the name of the Hypervisor software used.
StringgetURI()
Returns the URI (name) of the hypervisor connection.
longgetVersion()
Gets the version level of the Hypervisor running.
InterfaceinterfaceDefineXML(String xmlDesc)
Define an interface (or modify existing interface configuration)
InterfaceinterfaceLookupByMACString(String mac)
Try to lookup an interface on the given hypervisor based on its MAC.
InterfaceinterfaceLookupByName(String name)
Try to lookup an interface on the given hypervisor based on its name.
booleanisConnected()
Verify the connect is active.
intisEncrypted()
Determine if the connection is encrypted
intisSecure()
Determine if the connection is secure
String[]listDefinedDomains()
Lists the names of the defined but inactive domains
String[]listDefinedInterfaces()
Provides the list of names of defined interfaces on this host
String[]listDefinedNetworks()
Lists the inactive networks
String[]listDefinedStoragePools()
Provides the list of names of inactive storage pools.
String[]listDevices(String capabilityName)
List the names of the devices on this node
int[]listDomains()
Lists the active domains.
String[]listInterfaces()
Provides the list of names of interfaces on this host
String[]listNetworkFilters()
Lists the names of the network filters
String[]listNetworks()
Lists the active networks.
String[]listSecrets()
Retrieve the List UUIDs of defined secrets
String[]listStoragePools()
Provides the list of names of active storage pools.
NetworknetworkCreateXML(String xmlDesc)
Creates and starts a new virtual network.
NetworknetworkDefineXML(String xmlDesc)
Defines a network, but does not create it.
NetworkFilternetworkFilterDefineXML(String xmlDesc)
Defines a networkFilter
NetworkFilternetworkFilterLookupByName(String name)
Fetch a network filter based on its unique name
NetworkFilternetworkFilterLookupByUUID(int[] UUID)
Looks up a network filter based on its UUID in array form.
NetworkFilternetworkFilterLookupByUUID(UUID uuid)
Fetch a network filter based on its globally unique id
NetworkFilternetworkFilterLookupByUUIDString(String UUID)
Looks up a network filter based on its UUID in String form.
NetworknetworkLookupByName(String name)
Looks up a network on the based on its name.
NetworknetworkLookupByUUID(UUID uuid)
Fetch a network based on its globally unique id
NetworknetworkLookupByUUIDString(String UUID)
Looks up a network based on its UUID represented as a String.
NodeInfonodeInfo()
Returns a NodeInfo object describing the hardware configuration of the node.
intnumOfDefinedDomains()
Provides the number of inactive domains.
intnumOfDefinedInterfaces()
Provides the number of defined interfaces.
intnumOfDefinedNetworks()
Provides the number of inactive networks.
intnumOfDefinedStoragePools()
Provides the number of inactive storage pools
intnumOfDevices(String capabilityName)
Provides the number of node devices.
intnumOfDomains()
Provides the number of active domains.
intnumOfInterfaces()
Provides the number of interfaces.
intnumOfNetworkFilters()
Provides the number of network filters
intnumOfNetworks()
Provides the number of active networks.
intnumOfSecrets()
Fetch number of currently defined secrets.
intnumOfStoragePools()
Provides the number of active storage pools
protected voidprocessError()
call the error handling logic.
voidrestore(String from)
Restores a domain saved to disk by Domain.save().
SecretsecretDefineXML(String xmlDesc)
If XML specifies a UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded).
SecretsecretLookupByUUID(int[] UUID)
Looks up a secret based on its UUID in array form.
SecretsecretLookupByUUID(UUID uuid)
Fetch a secret based on its globally unique id
SecretsecretLookupByUUIDString(String UUID)
Looks up a secret based on its UUID in String form.
voidsetConnectionErrorCallback(Libvirt.VirErrorCallback callback)
voidsetDom0Memory(long memory)
change the amount of memory reserved to Domain0.
static voidsetErrorCallback(Libvirt.VirErrorCallback callback)
Sets the error function to a user defined callback
StoragePoolstoragePoolCreateXML(String xmlDesc, int flags)
Create a new storage based on its XML description.
StoragePoolstoragePoolDefineXML(String xml, int flags)
Define a new inactive storage pool based on its XML description.
StoragePoolstoragePoolLookupByName(String name)
Fetch a storage pool based on its unique name
StoragePoolstoragePoolLookupByUUID(UUID uuid)
Fetch a storage pool based on its globally unique id
StoragePoolstoragePoolLookupByUUIDString(String UUID)
Fetch a storage pool based on its globally unique id
StorageVolstorageVolLookupByKey(String key)
Fetch a a storage volume based on its globally unique key
StorageVolstorageVolLookupByPath(String path)
Fetch a storage volume based on its locally (host) unique path
StreamstreamNew(int flags)
Creates a new stream object which can be used to perform streamed I/O with other public API function.

Field Detail

VCP

protected ConnectionPointer VCP
The native virConnectPtr.

Constructor Detail

Connect

public Connect(String uri)
Constructs a read-write Connect object from the supplied URI.

Parameters: uri The connection URI

Throws: LibvirtException

See Also: The URI documentation

Connect

public Connect(String uri, boolean readOnly)
Constructs a Connect object from the supplied URI.

Parameters: uri The connection URI readOnly Whether the connection is read-only

Throws: LibvirtException

See Also: The URI documentation

Connect

public Connect(String uri, ConnectAuth auth, int flags)
Constructs a Connect object from the supplied URI, using the supplied authentication callback

Parameters: uri The connection URI auth a ConnectAuth object flags

Throws: LibvirtException

See Also: The URI documentation

Method Detail

baselineCPU

public String baselineCPU(String[] xmlCPUs)
Computes the most feature-rich CPU which is compatible with all given host CPUs.

Parameters: xmlCPUs array of XML descriptions of host CPUs

Returns: XML description of the computed CPU or NULL on error.

Throws: LibvirtException

close

public int close()
Closes the connection to the hypervisor/driver. Calling any methods on the object after close() will result in an exception.

Returns: number of references left (>= 0) for success, -1 for failure.

Throws: LibvirtException

compareCPU

public CPUCompareResult compareCPU(String xmlDesc)
Compares the given CPU description with the host CPU

Parameters: xmlDesc

Returns: comparison result according to enum CPUCompareResult

Throws: LibvirtException

See Also: Libvirt Documentation

connectionForDomain

public static Connect connectionForDomain(Domain domain)
Creates a new connection object from the domain. If all you want is the existing domain's connection, use the getConnection method directly. Thie method returns a new connection.

Parameters: domain

Returns: a new connection

connectionForNetwork

public static Connect connectionForNetwork(Network network)
Creates a new connection object from the network. If all you want is the existing network's connection, use the getConnection method directly. Thie method returns a new connection.

Parameters: network

Returns: a new connection

connectionForSecret

public static Connect connectionForSecret(Secret secret)
Creates a new connection object from the network. If all you want is the existing network's connection, use the getConnection method directly. Thie method returns a new connection.

Parameters: network

Returns: a new connection

connectionVersion

public static long connectionVersion(Connect conn)
Get the version of a connection.

Parameters: conn the connection to use.

Returns: -1 in case of failure, versions have the format major * 1,000,000 + minor * 1,000 + release.

See Also: Libvirt Documentation

convertUUIDBytes

public static int[] convertUUIDBytes(byte[] bytes)
Helper function to convert bytes into ints for the UUID calls

createUUIDBytes

public static byte[] createUUIDBytes(int[] UUID)
Helper function to convert UUIDs into a stirng for the UUID calls

deviceCreateXML

public Device deviceCreateXML(String xmlDesc)
Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.

Parameters: xmlDesc the device to create

Returns: the Device object

Throws: LibvirtException

deviceLookupByName

public Device deviceLookupByName(String name)
Fetch a device based on its unique name

Parameters: name name of device to fetch

Returns: Device object

Throws: LibvirtException

domainCreateLinux

public Domain domainCreateLinux(String xmlDesc, int flags)
Launches a new Linux guest domain. The domain is based on an XML description similar to the one returned by virDomainGetXMLDesc(). This function may require priviledged access to the hypervisor.

Parameters: xmlDesc the Domain description in XML flags an optional set of flags (unused)

Returns: the Domain object

Throws: LibvirtException

See Also: The XML format description

domainCreateXML

public Domain domainCreateXML(String xmlDesc, int flags)
Launch a new guest domain, based on an XML description

Parameters: xmlDesc

Returns: the Domain object

Throws: LibvirtException

See Also: The XML format description

domainDefineXML

public Domain domainDefineXML(String xmlDesc)
Defines a domain, but does not start it

Parameters: xmlDesc

Returns: the Domain object

Throws: LibvirtException

See Also: The XML format description

domainEventDeregisterAny

public int domainEventDeregisterAny(int callbackID)
Removes an event callback.

Parameters: callbackID the callback to deregister

Returns:

Throws: LibvirtException

See Also: Libvirt Documentation

domainEventRegisterAny

public int domainEventRegisterAny(Domain domain, int eventId, Libvirt.VirConnectDomainEventGenericCallback cb)
Adds a callback to receive notifications of arbitrary domain events occurring on a domain.

Parameters: domain option domain to limit the events monitored eventId the events to monitor cb the callback function to use.

Returns: . The return value from this method is a positive integer identifier for the callback. -1 if an error

Throws: LibvirtException

See Also: Libvirt Documentation

domainLookupByID

public Domain domainLookupByID(int id)
Finds a domain based on the hypervisor ID number.

Parameters: id the hypervisor id

Returns: the Domain object

Throws: LibvirtException

domainLookupByName

public Domain domainLookupByName(String name)
Looks up a domain based on its name.

Parameters: name the name of the domain

Returns: the Domain object

Throws: LibvirtException

domainLookupByUUID

public Domain domainLookupByUUID(int[] UUID)
Looks up a domain based on its UUID in array form. The UUID Array contains an unpacked representation of the UUID, each int contains only one byte.

Parameters: UUID the UUID as an unpacked int array

Returns: the Domain object

Throws: LibvirtException

domainLookupByUUID

public Domain domainLookupByUUID(UUID uuid)
Fetch a domain based on its globally unique id

Parameters: UUID a java UUID

Returns: a new domain object

Throws: LibvirtException

domainLookupByUUIDString

public Domain domainLookupByUUIDString(String UUID)
Looks up a domain based on its UUID in String form.

Parameters: UUID the UUID in canonical String representation

Returns: the Domain object

Throws: LibvirtException

domainXMLFromNative

public String domainXMLFromNative(String nativeFormat, String nativeConfig, int flags)
Reads a native XML configuration document, and generates generates a domain configuration file describing the domain. The format of the native data is hypervisor dependant.

Returns:

Throws: LibvirtException

domainXMLToNative

public String domainXMLToNative(String nativeFormat, String domainXML, int flags)
Reads a domain XML configuration document, and generates generates a native configuration file describing the domain. The format of the native data is hypervisor dependant.

Returns:

Throws: LibvirtException

findStoragePoolSources

public String findStoragePoolSources(String type, String srcSpecs, int flags)
Talks to a storage backend and attempts to auto-discover the set of available storage pool sources. e.g. For iSCSI this would be a set of iSCSI targets. For NFS this would be a list of exported paths. The srcSpec (optional for some storage pool types, e.g. local ones) is an instance of the storage pool's source element specifying where to look for the pools. srcSpec is not required for some types (e.g., those querying local storage resources only)

Parameters: type type of storage pool to discover srcSpecs XML document specifying discovery sourc flags unused

Returns: an xml document consisting of a SourceList element containing a source document appropriate to the given pool type for each discovered source.

Throws: LibvirtException

getCapabilities

public String getCapabilities()
Provides capabilities of the hypervisor / driver.

Returns: an XML String describing the capabilities.

Throws: LibvirtException

See Also: The XML format description

getCellsFreeMemory

public long getCellsFreeMemory(int startCells, int maxCells)
NUMA Support

getFreeMemory

public long getFreeMemory()
Returns the free memory for the connection

getHostName

public String getHostName()
Returns the system hostname on which the hypervisor is running. (the result of the gethostname(2) system call) If we are connected to a remote system, then this returns the hostname of the remote system.

Returns: the hostname

Throws: LibvirtException

getHypervisorVersion

public long getHypervisorVersion(String type)
Returns the version of the hypervisor against which the library was compiled. The type parameter specified which hypervisor's version is returned

Parameters: type

Returns: major * 1,000,000 + minor * 1,000 + release

Throws: LibvirtException

getLibVirVersion

public long getLibVirVersion()
Gets the version of the native libvirt library that the JNI part is linked to.

Returns: major * 1,000,000 + minor * 1,000 + release

Throws: LibvirtException

getMaxVcpus

public int getMaxVcpus(String type)
Provides the maximum number of virtual CPUs supported for a guest VM of a specific type. The 'type' parameter here corresponds to the 'type' attribute in the element of the XML.

Parameters: type

Returns: the number of CPUs

Throws: LibvirtException

getType

public String getType()
Gets the name of the Hypervisor software used.

Returns: the name

Throws: LibvirtException

getURI

public String getURI()
Returns the URI (name) of the hypervisor connection. Normally this is the same as or similar to the string passed to the virConnectOpen/virConnectOpenReadOnly call, but the driver may make the URI canonical.

Returns: the URI

Throws: LibvirtException

getVersion

public long getVersion()
Gets the version level of the Hypervisor running. This may work only with hypervisor call, i.e. with priviledged access to the hypervisor, not with a Read-Only connection. If the version can't be extracted by lack of capacities returns 0.

Returns: major * 1,000,000 + minor * 1,000 + release

Throws: LibvirtException

interfaceDefineXML

public Interface interfaceDefineXML(String xmlDesc)
Define an interface (or modify existing interface configuration)

Parameters: xmlDesc the interface to create

Returns: the Interface object

Throws: LibvirtException

interfaceLookupByMACString

public Interface interfaceLookupByMACString(String mac)
Try to lookup an interface on the given hypervisor based on its MAC.

Throws: LibvirtException

interfaceLookupByName

public Interface interfaceLookupByName(String name)
Try to lookup an interface on the given hypervisor based on its name.

Throws: LibvirtException

isConnected

public boolean isConnected()
Verify the connect is active.

Returns: boolean The true connected, or false not.

Throws: LibvirtException

isEncrypted

public int isEncrypted()
Determine if the connection is encrypted

Returns: 1 if encrypted, 0 if not encrypted, -1 on error

Throws: LibvirtException

See Also: Libvirt Documentation

isSecure

public int isSecure()
Determine if the connection is secure

Returns: 1 if secure, 0 if not secure, -1 on error

Throws: LibvirtException

See Also: Libvirt Documentation

listDefinedDomains

public String[] listDefinedDomains()
Lists the names of the defined but inactive domains

Returns: an Array of Strings that contains the names of the defined domains currently inactive

Throws: LibvirtException

listDefinedInterfaces

public String[] listDefinedInterfaces()
Provides the list of names of defined interfaces on this host

Returns: an Array of Strings that contains the names of the interfaces on this host

Throws: LibvirtException

listDefinedNetworks

public String[] listDefinedNetworks()
Lists the inactive networks

Returns: an Array of Strings that contains the names of the inactive networks

Throws: LibvirtException

listDefinedStoragePools

public String[] listDefinedStoragePools()
Provides the list of names of inactive storage pools.

Returns: an Array of Strings that contains the names of the defined storage pools

Throws: LibvirtException

listDevices

public String[] listDevices(String capabilityName)
List the names of the devices on this node

Parameters: capabilityName optional capability name

listDomains

public int[] listDomains()
Lists the active domains.

Returns: and array of the IDs of the active domains

Throws: LibvirtException

listInterfaces

public String[] listInterfaces()
Provides the list of names of interfaces on this host

Returns: an Array of Strings that contains the names of the interfaces on this host

Throws: LibvirtException

listNetworkFilters

public String[] listNetworkFilters()
Lists the names of the network filters

Returns: an Array of Strings that contains the names network filters

Throws: LibvirtException

listNetworks

public String[] listNetworks()
Lists the active networks.

Returns: an Array of Strings that contains the names of the active networks

Throws: LibvirtException

listSecrets

public String[] listSecrets()
Retrieve the List UUIDs of defined secrets

Returns: an Array of Strings that contains the uuids of the defined secrets

listStoragePools

public String[] listStoragePools()
Provides the list of names of active storage pools.

Returns: an Array of Strings that contains the names of the defined storage pools

Throws: LibvirtException

networkCreateXML

public Network networkCreateXML(String xmlDesc)
Creates and starts a new virtual network. The properties of the network are based on an XML description similar to the one returned by virNetworkGetXMLDesc()

Parameters: xmlDesc the Network Description

Returns: the Network object representing the created network

Throws: LibvirtException

See Also: The XML format description

networkDefineXML

public Network networkDefineXML(String xmlDesc)
Defines a network, but does not create it. The properties of the network are based on an XML description similar to the one returned by virNetworkGetXMLDesc()

Parameters: xmlDesc

Returns: the resulting Network object

Throws: LibvirtException

See Also: The XML format description

networkFilterDefineXML

public NetworkFilter networkFilterDefineXML(String xmlDesc)
Defines a networkFilter

Parameters: xmlDesc the descirption of the filter

Returns: the new filer

Throws: LibvirtException

See Also: Libvirt Documentation

networkFilterLookupByName

public NetworkFilter networkFilterLookupByName(String name)
Fetch a network filter based on its unique name

Parameters: name name of network filter to fetch

Returns: network filter object

Throws: LibvirtException

See Also: Libvirt Documentation

networkFilterLookupByUUID

public NetworkFilter networkFilterLookupByUUID(int[] UUID)
Looks up a network filter based on its UUID in array form. The UUID Array contains an unpacked representation of the UUID, each int contains only one byte.

Parameters: UUID the UUID as an unpacked int array

Returns: the network filter object

Throws: LibvirtException

networkFilterLookupByUUID

public NetworkFilter networkFilterLookupByUUID(UUID uuid)
Fetch a network filter based on its globally unique id

Parameters: UUID a java UUID

Returns: a new network filter object

Throws: LibvirtException

networkFilterLookupByUUIDString

public NetworkFilter networkFilterLookupByUUIDString(String UUID)
Looks up a network filter based on its UUID in String form.

Parameters: UUID the UUID in canonical String representation

Returns: the Network Filter object

Throws: LibvirtException

networkLookupByName

public Network networkLookupByName(String name)
Looks up a network on the based on its name.

Parameters: name name of the network

Returns: The Network object found

Throws: LibvirtException

networkLookupByUUID

public Network networkLookupByUUID(UUID uuid)
Fetch a network based on its globally unique id

Parameters: UUID a java UUID

Returns: a new network object

Throws: LibvirtException

networkLookupByUUIDString

public Network networkLookupByUUIDString(String UUID)
Looks up a network based on its UUID represented as a String.

Parameters: UUID the UUID in canonical String representation

Returns: The Network object found

Throws: LibvirtException

nodeInfo

public NodeInfo nodeInfo()
Returns a NodeInfo object describing the hardware configuration of the node.

Returns: a NodeInfo object

Throws: LibvirtException

numOfDefinedDomains

public int numOfDefinedDomains()
Provides the number of inactive domains.

Returns: the number of inactive domains

Throws: LibvirtException

numOfDefinedInterfaces

public int numOfDefinedInterfaces()
Provides the number of defined interfaces.

Returns: the number of interfaces

Throws: LibvirtException

numOfDefinedNetworks

public int numOfDefinedNetworks()
Provides the number of inactive networks.

Returns: the number of inactive networks

Throws: LibvirtException

numOfDefinedStoragePools

public int numOfDefinedStoragePools()
Provides the number of inactive storage pools

Returns: the number of pools found

Throws: LibvirtException

numOfDevices

public int numOfDevices(String capabilityName)
Provides the number of node devices.

Returns: the number of inactive domains

Throws: LibvirtException

numOfDomains

public int numOfDomains()
Provides the number of active domains.

Returns: the number of active domains

Throws: LibvirtException

numOfInterfaces

public int numOfInterfaces()
Provides the number of interfaces.

Returns: the number of interfaces

Throws: LibvirtException

numOfNetworkFilters

public int numOfNetworkFilters()
Provides the number of network filters

Returns: the number of network filters

Throws: LibvirtException

numOfNetworks

public int numOfNetworks()
Provides the number of active networks.

Returns: the number of active networks

Throws: LibvirtException

numOfSecrets

public int numOfSecrets()
Fetch number of currently defined secrets.

Returns: the number of secrets

numOfStoragePools

public int numOfStoragePools()
Provides the number of active storage pools

Returns: the number of pools found

Throws: LibvirtException

processError

protected void processError()
call the error handling logic. Should be called after every libvirt call

Throws: LibvirtException

restore

public void restore(String from)
Restores a domain saved to disk by Domain.save().

Parameters: from the path of the saved file on the remote host

Throws: LibvirtException

secretDefineXML

public Secret secretDefineXML(String xmlDesc)
If XML specifies a UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded). Otherwise, creates a new secret with an automatically chosen UUID, and initializes its attributes from xml.

Parameters: xmlDesc the secret to create

Returns: the Secret object

Throws: LibvirtException

secretLookupByUUID

public Secret secretLookupByUUID(int[] UUID)
Looks up a secret based on its UUID in array form. The UUID Array contains an unpacked representation of the UUID, each int contains only one byte.

Parameters: UUID the UUID as an unpacked int array

Returns: the Secret object

Throws: LibvirtException

secretLookupByUUID

public Secret secretLookupByUUID(UUID uuid)
Fetch a secret based on its globally unique id

Parameters: UUID a java UUID

Returns: a new domain object

Throws: LibvirtException

secretLookupByUUIDString

public Secret secretLookupByUUIDString(String UUID)
Looks up a secret based on its UUID in String form.

Parameters: UUID the UUID in canonical String representation

Returns: the Domain object

Throws: LibvirtException

setConnectionErrorCallback

public void setConnectionErrorCallback(Libvirt.VirErrorCallback callback)

setDom0Memory

public void setDom0Memory(long memory)
change the amount of memory reserved to Domain0. Domain0 is the domain where the application runs. This function may requires priviledged access to the hypervisor.

Parameters: memory in kilobytes

Throws: LibvirtException

setErrorCallback

public static void setErrorCallback(Libvirt.VirErrorCallback callback)
Sets the error function to a user defined callback

Parameters: callback a Class to perform the callback

storagePoolCreateXML

public StoragePool storagePoolCreateXML(String xmlDesc, int flags)
Create a new storage based on its XML description. The pool is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted

Parameters: xmlDesc XML description for new pool flags future flags, use 0 for now

Returns: StoragePool object

Throws: LibvirtException

storagePoolDefineXML

public StoragePool storagePoolDefineXML(String xml, int flags)
Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.

Parameters: xml XML description for new pool flags flags future flags, use 0 for now

Returns: StoragePool object

Throws: LibvirtException

storagePoolLookupByName

public StoragePool storagePoolLookupByName(String name)
Fetch a storage pool based on its unique name

Parameters: name name of pool to fetch

Returns: StoragePool object

Throws: LibvirtException

storagePoolLookupByUUID

public StoragePool storagePoolLookupByUUID(UUID uuid)
Fetch a storage pool based on its globally unique id

Parameters: UUID a java UUID

Returns: a new network object

Throws: LibvirtException

storagePoolLookupByUUIDString

public StoragePool storagePoolLookupByUUIDString(String UUID)
Fetch a storage pool based on its globally unique id

Parameters: UUID globally unique id of pool to fetch

Returns: VirStoragePool object

Throws: LibvirtException

storageVolLookupByKey

public StorageVol storageVolLookupByKey(String key)
Fetch a a storage volume based on its globally unique key

Parameters: key globally unique key

Returns: a storage volume

storageVolLookupByPath

public StorageVol storageVolLookupByPath(String path)
Fetch a storage volume based on its locally (host) unique path

Parameters: path locally unique path

Returns: a storage volume

streamNew

public Stream streamNew(int flags)
Creates a new stream object which can be used to perform streamed I/O with other public API function.

Parameters: flags use Stream.VIR_STREAM_NONBLOCK if non-blocking is required

Returns: the new object