Class Connect
- Author:
- stoty
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static enum
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a read-write Connect object from the supplied URI.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 callbackConnect
(URI uri, Connect.OpenFlags... flags) Constructs a read-write Connect object from the supplied URI.Connect
(URI uri, ConnectAuth auth) Constructs a Connect object from the supplied URI, using the supplied authentication callbackConnect
(URI uri, ConnectAuth auth, Connect.OpenFlags... flags) Constructs a Connect object from the supplied URI, using the supplied authentication callback -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified listener to receive agent lifecycle events.void
Adds the specified I/O error listener to receive I/O error events for domains of this connection.void
Adds the specified listener to receive lifecycle events for domains of this connection.void
Adds the specified listener to receive PMSuspend events for domains of this connection.void
Adds the specified listener to receive PMWakeup events for domains of this connection.void
Adds the specified reboot listener to receive reboot events for domains of this connection.baselineCPU
(String[] xmlCPUs) Computes the most feature-rich CPU which is compatible with all given host CPUs.int
close()
Closes the connection to the hypervisor/driver.compareCPU
(String xmlDesc) Compares the given CPU description with the host CPUstatic long
connectionVersion
(Connect conn) Deprecated.static int[]
convertUUIDBytes
(byte[] bytes) Helper function to convert bytes into ints for the UUID callsstatic byte[]
createUUIDBytes
(int[] uuid) Helper function to convert UUIDs into a stirng for the uuid callsdeviceCreateXML
(String xmlDesc) Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.deviceLookupByName
(String name) Fetch a device based on its unique namedomainCreateLinux
(String xmlDesc, int flags) Launches a new Linux guest domain.domainCreateXML
(String xmlDesc, int flags) Launch a new guest domain, based on an XML descriptiondomainDefineXML
(String xmlDesc) Defines a domain, but does not start itdomainLookupByID
(int id) Finds a domain based on the hypervisor ID number.domainLookupByName
(String name) Looks up a domain based on its name.domainLookupByUUID
(int[] uuid) Looks up a domain based on its UUID in array form.domainLookupByUUID
(UUID uuid) Fetch a domain based on its globally unique idLooks up a domain based on its uuid in String form.domainXMLFromNative
(String nativeFormat, String nativeConfig, int flags) Reads a native XML configuration document, and generates generates a domain configuration file describing the domain.domainXMLToNative
(String nativeFormat, String domainXML, int flags) Reads a domain XML configuration document, and generates generates a native configuration file describing the domain.boolean
protected void
finalize()
findStoragePoolSources
(String type, String srcSpecs, int flags) Talks to a storage backend and attempts to auto-discover the set of available storage pool sources.Provides capabilities of the hypervisor / driver.long
getCellsFreeMemory
(int startCells, int maxCells) NUMA Supportlong
Returns the free memory for the connectionReturns the system hostname on which the hypervisor is running.long
getHypervisorVersion
(String type) Deprecated.To get the version of the running hypervisor usegetVersion()
instead.long
Get the libvirt library version of this connection.long
Deprecated.useLibrary.getVersion()
insteadint
getMaxVcpus
(String type) Provides the maximum number of virtual CPUs supported for a guest VM of a specific type.Returns the security model of the connected node.Returns the XML description of the sysinfo details for the host on which the hypervisor is running.getType()
Gets the name of the Hypervisor software used.getURI()
Returns the URI (name) of the hypervisor connection.long
Gets the version level of the Hypervisor running.int
hashCode()
interfaceDefineXML
(String xmlDesc) Define an interface (or modify existing interface configuration)Try to lookup an interface on the given hypervisor based on its MAC.interfaceLookupByName
(String name) Try to lookup an interface on the given hypervisor based on its name.boolean
isAlive()
Determine if the connection to the hypervisor is still alive.boolean
Verify the connect is active.int
Determine if the connection is encryptedint
isSecure()
Determine if the connection is secureDomain[]
listAllDomains
(int flags) Gets an array of domains.String[]
Lists the names of the defined but inactive domainsString[]
Provides the list of names of defined interfaces on this hostString[]
Lists the inactive networksString[]
Provides the list of names of inactive storage pools.String[]
listDevices
(String capabilityName) List the names of the devices on this nodeint[]
Lists the active domains.String[]
Provides the list of names of interfaces on this hostString[]
Lists the names of the network filtersString[]
Lists the active networks.String[]
Retrieve the List UUIDs of defined secretsString[]
Provides the list of names of active storage pools.networkCreateXML
(String xmlDesc) Creates and starts a new virtual network.networkDefineXML
(String xmlDesc) Defines a network, but does not create it.networkFilterDefineXML
(String xmlDesc) Defines a networkFilterFetch a network filter based on its unique namenetworkFilterLookupByUUID
(int[] uuid) Looks up a network filter based on its UUID in array form.Fetch a network filter based on its globally unique idLooks up a network filter based on its uuid in String form.networkLookupByName
(String name) Looks up a network on the based on its name.networkLookupByUUID
(int[] uuid) Deprecated.use the UUIDString or UUID API.networkLookupByUUID
(UUID uuid) Fetch a network based on its globally unique idLooks up a network based on its uuid represented as a String.nodeInfo()
Returns a NodeInfo object describing the hardware configuration of the node.int
Provides the number of inactive domains.int
Provides the number of defined interfaces.int
Provides the number of inactive networks.int
Provides the number of inactive storage poolsint
numOfDevices
(String capabilityName) Provides the number of node devices.int
Provides the number of active domains.int
Provides the number of interfaces.int
Provides the number of network filtersint
Provides the number of active networks.int
Fetch number of currently defined secrets.int
Provides the number of active storage poolsvoid
Register the specified connection close listener to receive notifications when this connection is closed.void
Removes the specified agent lifecycle event listener so that it no longer receives agent lifecycle events.void
Removes the specified Block Job listener so that it no longer receives eventsvoid
Removes the specified I/O error listener so that it no longer receives I/O error events.void
Removes the specified lifecycle event listener so that it no longer receives lifecycle events.void
Removes the specified PMSuspend listener so that it no longer receives PMSuspend events.void
Removes the specified PMWakeup listener so that it no longer receives PMWakeup events.void
Restores a domain saved to disk by Domain.save().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).secretLookupByUUID
(int[] uuid) Looks up a secret based on its UUID in array form.secretLookupByUUID
(UUID uuid) Fetch a secret based on its globally unique idLooks up a secret based on its uuid in String form.void
void
setDom0Memory
(long memory) change the amount of memory reserved to Domain0.static void
setErrorCallback
(Libvirt.VirErrorCallback callback) Sets the error function to a user defined callbackboolean
setKeepAlive
(int interval, int count) Start sending keepalive messages.storagePoolCreateXML
(String xmlDesc, int flags) Create a new storage based on its XML description.storagePoolDefineXML
(String xml, int flags) Define a new inactive storage pool based on its XML description.Fetch a storage pool based on its unique namestoragePoolLookupByUUID
(int[] uuid) Deprecated.Use the UUIDString or UUID APIs.storagePoolLookupByUUID
(UUID uuid) Fetch a storage pool based on its globally unique idFetch a storage pool based on its globally unique idFetch a a storage volume based on its globally unique keystorageVolLookupByPath
(String path) Fetch a storage volume based on its locally (host) unique pathstreamNew
(int flags) Creates a new stream object which can be used to perform streamed I/O with other public API function.void
Unregister the previously registered close listener.
-
Field Details
-
vcp
The native virConnectPtr.
-
-
Constructor Details
-
Connect
Constructs a read-write Connect object from the supplied URI.- Parameters:
uri
- The connection URI- Throws:
LibvirtException
- See Also:
-
Connect
Constructs a read-write Connect object from the supplied URI.- Parameters:
uri
- The connection URI- Throws:
LibvirtException
- See Also:
-
Connect
Constructs a Connect object from the supplied URI.- Parameters:
uri
- The connection URIreadOnly
- Whether the connection is read-only- Throws:
LibvirtException
- See Also:
-
Connect
Constructs a Connect object from the supplied URI, using the supplied authentication callback- Parameters:
uri
- The connection URIauth
- a ConnectAuth objectflags
-- Throws:
LibvirtException
- See Also:
-
Connect
Constructs a Connect object from the supplied URI, using the supplied authentication callback- Parameters:
uri
- The connection URIauth
- a ConnectAuth objectflags
-- Throws:
LibvirtException
- See Also:
-
Connect
Constructs a Connect object from the supplied URI, using the supplied authentication callback- Parameters:
uri
- The connection URIauth
- a ConnectAuth object- Throws:
LibvirtException
- See Also:
-
-
Method Details
-
connectionVersion
Deprecated.UsegetLibVersion()
instead.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:
-
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 -
getLibVersion
Get the libvirt library version of this connection.- Returns:
- The version of libvirt used by the daemon running on
the connected host in the format
major * 1,000,000 + minor * 1,000 + release
. - Throws:
LibvirtException
- See Also:
-
setErrorCallback
Sets the error function to a user defined callback- Parameters:
callback
- a Class to perform the callback- Throws:
LibvirtException
-
hashCode
public int hashCode() -
equals
-
baselineCPU
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
Closes the connection to the hypervisor/driver. Calling any methods on the object after close() will result in an exception.- Returns:
- number of remaining references (>= 0)
- Throws:
LibvirtException
-
registerCloseListener
Register the specified connection close listener to receive notifications when this connection is closed.Note: There can only be at most one registered listener at a time.
- Parameters:
l
- the connection close listener- Throws:
LibvirtException
- on failure- See Also:
-
unregisterCloseListener
Unregister the previously registered close listener. When there currently is no registered close listener, this method does nothing. -
compareCPU
Compares the given CPU description with the host CPU- Parameters:
xmlDesc
-- Returns:
- comparison result according to enum CPUCompareResult
- Throws:
LibvirtException
- See Also:
-
deviceCreateXML
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
Fetch a device based on its unique name- Parameters:
name
- name of device to fetch- Returns:
- Device object
- Throws:
LibvirtException
-
domainCreateLinux
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 XMLflags
- an optional set of flags (unused)- Returns:
- the Domain object
- Throws:
LibvirtException
- See Also:
-
domainCreateXML
Launch a new guest domain, based on an XML description- Parameters:
xmlDesc
-- Returns:
- the Domain object
- Throws:
LibvirtException
- See Also:
-
domainDefineXML
Defines a domain, but does not start it- Parameters:
xmlDesc
-- Returns:
- the Domain object
- Throws:
LibvirtException
- See Also:
-
addIOErrorListener
Adds the specified I/O error listener to receive I/O error events for domains of this connection.- Parameters:
l
- the I/O error listener- Throws:
LibvirtException
- on failure- See Also:
-
addAgentLifecycleListener
Adds the specified listener to receive agent lifecycle events.- Parameters:
cb
- the agent lifecycle listener- Throws:
LibvirtException
- on failure- See Also:
-
addLifecycleListener
Adds the specified listener to receive lifecycle events for domains of this connection.- Parameters:
l
- the lifecycle listener- Throws:
LibvirtException
- on failure- See Also:
-
addPMSuspendListener
Adds the specified listener to receive PMSuspend events for domains of this connection.- Parameters:
l
- the PMSuspend listener- Throws:
LibvirtException
- on failure- Since:
- 1.5.2
- See Also:
-
removePMSuspendListener
Removes the specified PMSuspend listener so that it no longer receives PMSuspend events.- Parameters:
l
- the PMSuspend listener- Throws:
LibvirtException
- Since:
- 1.5.2
- See Also:
-
addPMWakeupListener
Adds the specified listener to receive PMWakeup events for domains of this connection.- Parameters:
l
- the PMWakeup listener- Throws:
LibvirtException
- on failure- Since:
- 1.5.2
- See Also:
-
removePMWakeupListener
Removes the specified PMWakeup listener so that it no longer receives PMWakeup events.- Parameters:
l
- the PMWakeup listener- Throws:
LibvirtException
- See Also:
-
removeLifecycleListener
Removes the specified lifecycle event listener so that it no longer receives lifecycle events.- Parameters:
l
- the lifecycle event listener- Throws:
LibvirtException
- See Also:
-
removeAgentLifecycleListener
Removes the specified agent lifecycle event listener so that it no longer receives agent lifecycle events.- Parameters:
l
- the agent lifecycle event listener- Throws:
LibvirtException
- See Also:
-
addRebootListener
Adds the specified reboot listener to receive reboot events for domains of this connection.- Parameters:
l
- the reboot listener- Throws:
LibvirtException
- on failure- Since:
- 1.5.2
- See Also:
-
removeBlockJobListener
Removes the specified Block Job listener so that it no longer receives events- Parameters:
l
-- Throws:
LibvirtException
-
removeIOErrorListener
Removes the specified I/O error listener so that it no longer receives I/O error events.- Parameters:
l
- the I/O error listener- Throws:
LibvirtException
- See Also:
-
domainLookupByID
Finds a domain based on the hypervisor ID number.- Parameters:
id
- the hypervisor id- Returns:
- the Domain object
- Throws:
LibvirtException
-
domainLookupByName
Looks up a domain based on its name.- Parameters:
name
- the name of the domain- Returns:
- the Domain object
- Throws:
LibvirtException
-
domainLookupByUUID
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
Fetch a domain based on its globally unique id- Parameters:
uuid
- a java UUID- Returns:
- a new domain object
- Throws:
LibvirtException
-
domainLookupByUUIDString
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) throws LibvirtException 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:
- domain XML as String, or
null
on error - Throws:
LibvirtException
-
domainXMLToNative
public String domainXMLToNative(String nativeFormat, String domainXML, int flags) throws LibvirtException 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:
- domain XML as String, or
null
on error - Throws:
LibvirtException
-
finalize
- Overrides:
finalize
in classObject
- Throws:
LibvirtException
-
findStoragePoolSources
public String findStoragePoolSources(String type, String srcSpecs, int flags) throws LibvirtException 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 discoversrcSpecs
- XML document specifying discovery sourcflags
- 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
Provides capabilities of the hypervisor / driver.- Returns:
- an XML String describing the capabilities.
- Throws:
LibvirtException
- See Also:
-
getCellsFreeMemory
NUMA Support- Throws:
LibvirtException
-
getFreeMemory
Returns the free memory for the connection- Throws:
LibvirtException
-
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
Deprecated.To get the version of the running hypervisor usegetVersion()
instead.Returns the version of the hypervisor against which the library was compiled. Since libvirt 0.9.3 this simply returns the same version number asLibrary.getVersion()
.- Parameters:
type
- The type of connection/driver to look at. SeegetType()
. May benull
.- Returns:
- major * 1,000,000 + minor * 1,000 + release
- Throws:
LibvirtException
-
getLibVirVersion
Deprecated.useLibrary.getVersion()
insteadGets 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
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 <domain> element of the XML.- Parameters:
type
-- Returns:
- the number of CPUs
- Throws:
LibvirtException
-
getSecurityModel
Returns the security model of the connected node.- Throws:
LibvirtException
-
getSysinfo
Returns the XML description of the sysinfo details for the host on which the hypervisor is running.This information is generally available only for hypervisors running with root privileges.
- Returns:
- sysinfo details in the same format as the
<sysinfo>
element of a domain XML. - Throws:
LibvirtException
- Since:
- 1.5.2
-
getType
Gets the name of the Hypervisor software used.- Returns:
- the name
- Throws:
LibvirtException
-
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
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
Define an interface (or modify existing interface configuration)- Parameters:
xmlDesc
- the interface to create- Returns:
- the Interface object
- Throws:
LibvirtException
-
interfaceLookupByMACString
Try to lookup an interface on the given hypervisor based on its MAC.- Throws:
LibvirtException
-
interfaceLookupByName
Try to lookup an interface on the given hypervisor based on its name.- Throws:
LibvirtException
-
isEncrypted
Determine if the connection is encrypted- Returns:
- 1 if encrypted, 0 if not encrypted
- Throws:
LibvirtException
- See Also:
-
isSecure
Determine if the connection is secure- Returns:
- 1 if secure, 0 if not secure
- Throws:
LibvirtException
- See Also:
-
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
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
Lists the inactive networks- Returns:
- an Array of Strings that contains the names of the inactive networks
- Throws:
LibvirtException
-
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
List the names of the devices on this node- Parameters:
capabilityName
- optional capability name- Throws:
LibvirtException
-
listDomains
Lists the active domains.- Returns:
- and array of the IDs of the active domains
- Throws:
LibvirtException
-
listAllDomains
Gets an array of domains.- Parameters:
flags
- bitwise-OR ofConnect.ConnectListAllDomainsFlags
- Returns:
- array of Domain objects
- Throws:
LibvirtException
-
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
Lists the names of the network filters- Returns:
- an Array of Strings that contains the names network filters
- Throws:
LibvirtException
-
listNetworks
Lists the active networks.- Returns:
- an Array of Strings that contains the names of the active networks
- Throws:
LibvirtException
-
listSecrets
Retrieve the List UUIDs of defined secrets- Returns:
- an Array of Strings that contains the uuids of the defined secrets
- Throws:
LibvirtException
-
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
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:
-
networkDefineXML
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:
-
networkFilterDefineXML
Defines a networkFilter- Parameters:
xmlDesc
- the descirption of the filter- Returns:
- the new filer
- Throws:
LibvirtException
- See Also:
-
networkFilterLookupByName
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:
-
networkFilterLookupByUUID
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
Fetch a network filter based on its globally unique id- Parameters:
uuid
- a java UUID- Returns:
- a new network filter object
- Throws:
LibvirtException
-
networkFilterLookupByUUIDString
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
Looks up a network on the based on its name.- Parameters:
name
- name of the network- Returns:
- The Network object found
- Throws:
LibvirtException
-
networkLookupByUUID
Deprecated.use the UUIDString or UUID API.Looks up a network based on its UUID represented as an int array. 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 object found
- Throws:
LibvirtException
-
networkLookupByUUID
Fetch a network based on its globally unique id- Parameters:
uuid
- a java UUID- Returns:
- a new network object
- Throws:
LibvirtException
-
networkLookupByUUIDString
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
Returns a NodeInfo object describing the hardware configuration of the node.- Returns:
- a NodeInfo object
- Throws:
LibvirtException
-
numOfDefinedDomains
Provides the number of inactive domains.- Returns:
- the number of inactive domains
- Throws:
LibvirtException
-
numOfDefinedInterfaces
Provides the number of defined interfaces.- Returns:
- the number of interfaces
- Throws:
LibvirtException
-
numOfDefinedNetworks
Provides the number of inactive networks.- Returns:
- the number of inactive networks
- Throws:
LibvirtException
-
numOfDefinedStoragePools
Provides the number of inactive storage pools- Returns:
- the number of pools found
- Throws:
LibvirtException
-
numOfDevices
Provides the number of node devices.- Returns:
- the number of inactive domains
- Throws:
LibvirtException
-
numOfDomains
Provides the number of active domains.- Returns:
- the number of active domains
- Throws:
LibvirtException
-
numOfInterfaces
Provides the number of interfaces.- Returns:
- the number of interfaces
- Throws:
LibvirtException
-
numOfNetworkFilters
Provides the number of network filters- Returns:
- the number of network filters
- Throws:
LibvirtException
-
numOfNetworks
Provides the number of active networks.- Returns:
- the number of active networks
- Throws:
LibvirtException
-
numOfSecrets
Fetch number of currently defined secrets.- Returns:
- the number of secrets
- Throws:
LibvirtException
-
numOfStoragePools
Provides the number of active storage pools- Returns:
- the number of pools found
- Throws:
LibvirtException
-
restore
Restores a domain saved to disk by Domain.save().- Parameters:
from
- the path of the saved file on the remote host- Throws:
LibvirtException
-
secretDefineXML
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
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
Fetch a secret based on its globally unique id- Parameters:
uuid
- a java UUID- Returns:
- a new domain object
- Throws:
LibvirtException
-
secretLookupByUUIDString
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
- Throws:
LibvirtException
-
setDom0Memory
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
-
storagePoolCreateXML
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 poolflags
- future flags, use 0 for now- Returns:
- StoragePool object
- Throws:
LibvirtException
-
storagePoolDefineXML
Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.- Parameters:
xml
- XML description for new poolflags
- flags future flags, use 0 for now- Returns:
- StoragePool object
- Throws:
LibvirtException
-
storagePoolLookupByName
Fetch a storage pool based on its unique name- Parameters:
name
- name of pool to fetch- Returns:
- StoragePool object
- Throws:
LibvirtException
-
storagePoolLookupByUUID
Deprecated.Use the UUIDString or UUID APIs.Fetch a storage pool based on its globally unique id- Parameters:
uuid
- globally unique id of pool to fetch- Returns:
- a new network object
- Throws:
LibvirtException
-
storagePoolLookupByUUID
Fetch a storage pool based on its globally unique id- Parameters:
uuid
- a java UUID- Returns:
- a new network object
- Throws:
LibvirtException
-
storagePoolLookupByUUIDString
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
Fetch a a storage volume based on its globally unique key- Parameters:
key
- globally unique key- Returns:
- a storage volume
- Throws:
LibvirtException
-
storageVolLookupByPath
Fetch a storage volume based on its locally (host) unique path- Parameters:
path
- locally unique path- Returns:
- a storage volume
- Throws:
LibvirtException
-
streamNew
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
- Throws:
LibvirtException
-
isConnected
Verify the connect is active.- Returns:
- boolean The true connected, or false not.
- Throws:
LibvirtException
-
isAlive
Determine if the connection to the hypervisor is still alive.A connection will be classed as alive if it is either local, or running over a channel (TCP or UNIX socket) which is not closed.
- Returns:
true
if alive,false
otherwise.- Throws:
LibvirtException
-
setKeepAlive
Start sending keepalive messages. Afterinterval
seconds of inactivity, consider the connection to be broken when no response is received aftercount
keepalive messages sent in a row.In other words, sending
count + 1
keepalive message results in closing the connection.When interval is <= 0, no keepalive messages will be sent.
When count is 0, the connection will be automatically closed after interval seconds of inactivity without sending any keepalive messages.
Note: client has to implement and run event loop to be able to use keepalive messages. Failure to do so may result in connections being closed unexpectedly.
Note: This API function controls only keepalive messages sent by the client. If the server is configured to use keepalive you still need to run the event loop to respond to them, even if you disable keepalives by this function.
- Parameters:
interval
- number of seconds of inactivity before a keepalive message is sentcount
- number of messages that can be sent in a row- Returns:
true
when successful,false
otherwise.- Throws:
LibvirtException
-
getLibVersion()
instead.