org.libvirt
public class Connect extends Object
Field Summary | |
---|---|
protected ConnectionPointer | VCP
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 | |
---|---|
String | 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. |
CPUCompareResult | compareCPU(String xmlDesc)
Compares the given CPU description with the host CPU
|
static Connect | connectionForDomain(Domain domain)
Creates a new connection object from the domain. |
static Connect | connectionForNetwork(Network network)
Creates a new connection object from the network. |
static Connect | connectionForSecret(Secret secret)
Creates a new connection object from the network. |
static long | connectionVersion(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 |
Device | deviceCreateXML(String xmlDesc)
Create a new device on the VM host machine, for example, virtual HBAs
created using vport_create.
|
Device | deviceLookupByName(String name)
Fetch a device based on its unique name
|
Domain | domainCreateLinux(String xmlDesc, int flags)
Launches a new Linux guest domain. |
Domain | domainCreateXML(String xmlDesc, int flags)
Launch a new guest domain, based on an XML description
|
Domain | domainDefineXML(String xmlDesc)
Defines a domain, but does not start it
|
int | domainEventDeregisterAny(int callbackID)
Removes an event callback.
|
int | domainEventRegisterAny(Domain domain, int eventId, Libvirt.VirConnectDomainEventGenericCallback cb)
Adds a callback to receive notifications of arbitrary domain events
occurring on a domain.
|
Domain | domainLookupByID(int id)
Finds a domain based on the hypervisor ID number.
|
Domain | domainLookupByName(String name)
Looks up a domain based on its name.
|
Domain | domainLookupByUUID(int[] UUID)
Looks up a domain based on its UUID in array form. |
Domain | domainLookupByUUID(UUID uuid)
Fetch a domain based on its globally unique id
|
Domain | domainLookupByUUIDString(String UUID)
Looks up a domain based on its UUID in String form.
|
String | domainXMLFromNative(String nativeFormat, String nativeConfig, int flags)
Reads a native XML configuration document, and generates generates a
domain configuration file describing the domain. |
String | domainXMLToNative(String nativeFormat, String domainXML, int flags)
Reads a domain XML configuration document, and generates generates a
native configuration file describing the domain. |
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. |
String | getCapabilities()
Provides capabilities of the hypervisor / driver.
|
long | getCellsFreeMemory(int startCells, int maxCells)
NUMA Support |
long | getFreeMemory()
Returns the free memory for the connection |
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.
|
long | getHypervisorVersion(String type)
Returns the version of the hypervisor against which the library was
compiled. |
long | getLibVirVersion()
Gets the version of the native libvirt library that the JNI part is
linked to.
|
int | getMaxVcpus(String type)
Provides the maximum number of virtual CPUs supported for a guest VM of a
specific type. |
String | getType()
Gets the name of the Hypervisor software used.
|
String | getURI()
Returns the URI (name) of the hypervisor connection. |
long | getVersion()
Gets the version level of the Hypervisor running. |
Interface | interfaceDefineXML(String xmlDesc)
Define an interface (or modify existing interface configuration)
|
Interface | interfaceLookupByMACString(String mac)
Try to lookup an interface on the given hypervisor based on its MAC.
|
Interface | interfaceLookupByName(String name)
Try to lookup an interface on the given hypervisor based on its name.
|
boolean | isConnected()
Verify the connect is active.
|
int | isEncrypted()
Determine if the connection is encrypted
|
int | isSecure()
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.
|
Network | networkCreateXML(String xmlDesc)
Creates and starts a new virtual network. |
Network | networkDefineXML(String xmlDesc)
Defines a network, but does not create it. |
NetworkFilter | networkFilterDefineXML(String xmlDesc)
Defines a networkFilter
|
NetworkFilter | networkFilterLookupByName(String name)
Fetch a network filter based on its unique name
|
NetworkFilter | networkFilterLookupByUUID(int[] UUID)
Looks up a network filter based on its UUID in array form. |
NetworkFilter | networkFilterLookupByUUID(UUID uuid)
Fetch a network filter based on its globally unique id
|
NetworkFilter | networkFilterLookupByUUIDString(String UUID)
Looks up a network filter based on its UUID in String form.
|
Network | networkLookupByName(String name)
Looks up a network on the based on its name.
|
Network | networkLookupByUUID(UUID uuid)
Fetch a network based on its globally unique id
|
Network | networkLookupByUUIDString(String UUID)
Looks up a network based on its UUID represented as a String.
|
NodeInfo | nodeInfo()
Returns a NodeInfo object describing the hardware configuration of the
node.
|
int | numOfDefinedDomains()
Provides the number of inactive domains.
|
int | numOfDefinedInterfaces()
Provides the number of defined interfaces.
|
int | numOfDefinedNetworks()
Provides the number of inactive networks.
|
int | numOfDefinedStoragePools()
Provides the number of inactive storage pools
|
int | numOfDevices(String capabilityName)
Provides the number of node devices.
|
int | numOfDomains()
Provides the number of active domains.
|
int | numOfInterfaces()
Provides the number of interfaces.
|
int | numOfNetworkFilters()
Provides the number of network filters
|
int | numOfNetworks()
Provides the number of active networks.
|
int | numOfSecrets()
Fetch number of currently defined secrets.
|
int | numOfStoragePools()
Provides the number of active storage pools
|
protected void | processError()
call the error handling logic. |
void | restore(String from)
Restores a domain saved to disk by Domain.save().
|
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). |
Secret | secretLookupByUUID(int[] UUID)
Looks up a secret based on its UUID in array form. |
Secret | secretLookupByUUID(UUID uuid)
Fetch a secret based on its globally unique id
|
Secret | secretLookupByUUIDString(String UUID)
Looks up a secret based on its UUID in String form.
|
void | setConnectionErrorCallback(Libvirt.VirErrorCallback callback) |
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 callback
|
StoragePool | storagePoolCreateXML(String xmlDesc, int flags)
Create a new storage based on its XML description. |
StoragePool | storagePoolDefineXML(String xml, int flags)
Define a new inactive storage pool based on its XML description. |
StoragePool | storagePoolLookupByName(String name)
Fetch a storage pool based on its unique name
|
StoragePool | storagePoolLookupByUUID(UUID uuid)
Fetch a storage pool based on its globally unique id
|
StoragePool | storagePoolLookupByUUIDString(String UUID)
Fetch a storage pool based on its globally unique id
|
StorageVol | storageVolLookupByKey(String key)
Fetch a a storage volume based on its globally unique key
|
StorageVol | storageVolLookupByPath(String path)
Fetch a storage volume based on its locally (host) unique path
|
Stream | streamNew(int flags)
Creates a new stream object which can be used to perform streamed I/O
with other public API function.
|
Parameters: uri The connection URI
Throws: LibvirtException
See Also: The URI documentation
Parameters: uri The connection URI readOnly Whether the connection is read-only
Throws: LibvirtException
See Also: The URI documentation
Parameters: uri The connection URI auth a ConnectAuth object flags
Throws: LibvirtException
See Also: The URI documentation
Parameters: xmlCPUs array of XML descriptions of host CPUs
Returns: XML description of the computed CPU or NULL on error.
Throws: LibvirtException
Returns: number of references left (>= 0) for success, -1 for failure.
Throws: LibvirtException
Parameters: xmlDesc
Returns: comparison result according to enum CPUCompareResult
Throws: LibvirtException
See Also: Libvirt
Documentation
Parameters: domain
Returns: a new connection
Parameters: network
Returns: a new connection
Parameters: network
Returns: a new 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
Parameters: xmlDesc the device to create
Returns: the Device object
Throws: LibvirtException
Parameters: name name of device to fetch
Returns: Device object
Throws: LibvirtException
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
Parameters: xmlDesc
Returns: the Domain object
Throws: LibvirtException
See Also: The XML format
description
Parameters: xmlDesc
Returns: the Domain object
Throws: LibvirtException
See Also: The XML format
description
Parameters: callbackID the callback to deregister
Returns:
Throws: LibvirtException
See Also: Libvirt
Documentation
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
Parameters: id the hypervisor id
Returns: the Domain object
Throws: LibvirtException
Parameters: name the name of the domain
Returns: the Domain object
Throws: LibvirtException
Parameters: UUID the UUID as an unpacked int array
Returns: the Domain object
Throws: LibvirtException
Parameters: UUID a java UUID
Returns: a new domain object
Throws: LibvirtException
Parameters: UUID the UUID in canonical String representation
Returns: the Domain object
Throws: LibvirtException
Returns:
Throws: LibvirtException
Returns:
Throws: LibvirtException
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
Returns: an XML String describing the capabilities.
Throws: LibvirtException
See Also: The XML format
description
Returns: the hostname
Throws: LibvirtException
Parameters: type
Returns: major * 1,000,000 + minor * 1,000 + release
Throws: LibvirtException
Returns: major * 1,000,000 + minor * 1,000 + release
Throws: LibvirtException
Parameters: type
Returns: the number of CPUs
Throws: LibvirtException
Returns: the name
Throws: LibvirtException
Returns: the URI
Throws: LibvirtException
Returns: major * 1,000,000 + minor * 1,000 + release
Throws: LibvirtException
Parameters: xmlDesc the interface to create
Returns: the Interface object
Throws: LibvirtException
Throws: LibvirtException
Throws: LibvirtException
Returns: boolean The true connected, or false not.
Throws: LibvirtException
Returns: 1 if encrypted, 0 if not encrypted, -1 on error
Throws: LibvirtException
See Also: Libvirt
Documentation
Returns: 1 if secure, 0 if not secure, -1 on error
Throws: LibvirtException
See Also: Libvirt
Documentation
Returns: an Array of Strings that contains the names of the defined domains currently inactive
Throws: LibvirtException
Returns: an Array of Strings that contains the names of the interfaces on this host
Throws: LibvirtException
Returns: an Array of Strings that contains the names of the inactive networks
Throws: LibvirtException
Returns: an Array of Strings that contains the names of the defined storage pools
Throws: LibvirtException
Parameters: capabilityName optional capability name
Returns: and array of the IDs of the active domains
Throws: LibvirtException
Returns: an Array of Strings that contains the names of the interfaces on this host
Throws: LibvirtException
Returns: an Array of Strings that contains the names network filters
Throws: LibvirtException
Returns: an Array of Strings that contains the names of the active networks
Throws: LibvirtException
Returns: an Array of Strings that contains the uuids of the defined secrets
Returns: an Array of Strings that contains the names of the defined storage pools
Throws: LibvirtException
Parameters: xmlDesc the Network Description
Returns: the Network object representing the created network
Throws: LibvirtException
See Also: The XML format
description
Parameters: xmlDesc
Returns: the resulting Network object
Throws: LibvirtException
See Also: The XML format
description
Parameters: xmlDesc the descirption of the filter
Returns: the new filer
Throws: LibvirtException
See Also: Libvirt Documentation
Parameters: name name of network filter to fetch
Returns: network filter object
Throws: LibvirtException
See Also: Libvirt Documentation
Parameters: UUID the UUID as an unpacked int array
Returns: the network filter object
Throws: LibvirtException
Parameters: UUID a java UUID
Returns: a new network filter object
Throws: LibvirtException
Parameters: UUID the UUID in canonical String representation
Returns: the Network Filter object
Throws: LibvirtException
Parameters: name name of the network
Returns: The Network object found
Throws: LibvirtException
Parameters: UUID a java UUID
Returns: a new network object
Throws: LibvirtException
Parameters: UUID the UUID in canonical String representation
Returns: The Network object found
Throws: LibvirtException
Returns: a NodeInfo object
Throws: LibvirtException
Returns: the number of inactive domains
Throws: LibvirtException
Returns: the number of interfaces
Throws: LibvirtException
Returns: the number of inactive networks
Throws: LibvirtException
Returns: the number of pools found
Throws: LibvirtException
Returns: the number of inactive domains
Throws: LibvirtException
Returns: the number of active domains
Throws: LibvirtException
Returns: the number of interfaces
Throws: LibvirtException
Returns: the number of network filters
Throws: LibvirtException
Returns: the number of active networks
Throws: LibvirtException
Returns: the number of secrets
Returns: the number of pools found
Throws: LibvirtException
Throws: LibvirtException
Parameters: from the path of the saved file on the remote host
Throws: LibvirtException
Parameters: xmlDesc the secret to create
Returns: the Secret object
Throws: LibvirtException
Parameters: UUID the UUID as an unpacked int array
Returns: the Secret object
Throws: LibvirtException
Parameters: UUID a java UUID
Returns: a new domain object
Throws: LibvirtException
Parameters: UUID the UUID in canonical String representation
Returns: the Domain object
Throws: LibvirtException
Parameters: memory in kilobytes
Throws: LibvirtException
Parameters: callback a Class to perform the callback
Parameters: xmlDesc XML description for new pool flags future flags, use 0 for now
Returns: StoragePool object
Throws: LibvirtException
Parameters: xml XML description for new pool flags flags future flags, use 0 for now
Returns: StoragePool object
Throws: LibvirtException
Parameters: name name of pool to fetch
Returns: StoragePool object
Throws: LibvirtException
Parameters: UUID a java UUID
Returns: a new network object
Throws: LibvirtException
Parameters: UUID globally unique id of pool to fetch
Returns: VirStoragePool object
Throws: LibvirtException
Parameters: key globally unique key
Returns: a storage volume
Parameters: path locally unique path
Returns: a storage volume
Parameters: flags use Stream.VIR_STREAM_NONBLOCK if non-blocking is required
Returns: the new object