public class Domain
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Domain.BlockCommitFlags
TODO: get generated constants from libvirt
|
static class |
Domain.BlockCopyFlags |
static class |
Domain.BlockCopyParameters |
static class |
Domain.BlockJobAbortFlags |
static class |
Domain.BlockJobInfoFlags |
static class |
Domain.BlockResizeFlags |
static class |
Domain.CreateFlags |
static class |
Domain.DeviceModifyFlags |
static class |
Domain.DomainMigrateParameters
Contains multiple constants that defines "virDomainMigrate* params" multiple field.
|
static class |
Domain.InterfaceAddressesSource |
static class |
Domain.MetadataType |
static class |
Domain.MigrateFlags |
static class |
Domain.ModificationImpact |
static class |
Domain.RebootFlags |
static class |
Domain.SnapshotCreateFlags |
static class |
Domain.SnapshotListFlags |
static class |
Domain.UndefineFlags |
static class |
Domain.VcpuFlags |
static class |
Domain.XMLFlags |
Modifier and Type | Method and Description |
---|---|
int |
abortJob()
Requests that the current background job be aborted at the soonest
opportunity.
|
void |
addAgentLifecycleListener(AgentLifecycleListener cb)
Adds the specified listener to receive agent lifecycle events for this domain.
|
void |
addBlockJobListener(BlockJobListener cb)
Adds a callback to receive notifications of Block Job events
|
void |
addIOErrorListener(IOErrorListener cb)
Adds a callback to receive notifications of IOError domain events
occurring on this domain.
|
void |
addLifecycleListener(LifecycleListener l)
Adds the specified listener to receive lifecycle events for this domain.
|
void |
addPMSuspendListener(PMSuspendListener l)
Adds the specified listener to receive PMSuspend events for this domain.
|
void |
addPMWakeupListener(PMWakeupListener l)
Adds the specified listener to receive PMWakeup events for this domain.
|
void |
addRebootListener(RebootListener l)
Adds the specified listener to receive reboot events for this domain.
|
void |
attachDevice(java.lang.String xmlDesc)
Creates a virtual device attachment to backend.
|
void |
attachDeviceFlags(java.lang.String xmlDesc,
int flags)
Creates a virtual device attachment to backend.
|
void |
blockCommit(java.lang.String disk,
java.lang.String base,
java.lang.String top,
long bandwidth,
int flags)
Commit changes that were made to temporary top-level files within a disk
image backing file chain into a lower-level base file.
|
void |
blockCopy(java.lang.String diskPath,
java.lang.String xmlDesc,
TypedParameter[] params,
int flags)
This function migrates domain's live block device (disk) to another
block device.
|
DomainBlockInfo |
blockInfo(java.lang.String path)
This function returns block device (disk) stats for block devices
attached to the domain.
|
void |
blockJobAbort(java.lang.String disk,
int flags)
Cancel the active block job on the given disk.
|
void |
blockPeek(java.lang.String disk,
long offset,
java.nio.ByteBuffer buffer)
Read the contents of a domain's disk device.
|
void |
blockResize(java.lang.String disk,
long size,
int flags)
Resize a block device of domain while the domain is running.
|
DomainBlockStats |
blockStats(java.lang.String path)
Returns block device (disk) stats for block devices attached to this
domain.
|
void |
coreDump(java.lang.String to,
int flags)
Dumps the core of this domain on a given file for analysis.
|
int |
cpuMapLength(int maxCpus)
It returns the length (in bytes) required to store the complete CPU map
between a single virtual & all physical CPUs of a domain.
|
int |
create()
Launches this defined domain.
|
int |
create(int flags)
Launches this defined domain with the provide flags.
|
void |
destroy()
Destroys this domain object.
|
void |
detachDevice(java.lang.String xmlDesc)
Destroys a virtual device attachment to backend.
|
void |
detachDeviceFlags(java.lang.String xmlDesc,
int flags)
Destroys a virtual device attachment to backend.
|
boolean |
equals(java.lang.Object obj) |
protected void |
finalize() |
int |
free()
Frees this domain object.
|
boolean |
getAutostart()
Provides a boolean value indicating whether the domain is configured to
be automatically started when the host machine boots.
|
DomainBlockJobInfo |
getBlockJobInfo(java.lang.String disk,
int flags)
Request block job information for the given disk.
|
Connect |
getConnect()
Provides the connection object associated with a domain.
|
int |
getID()
Gets the hypervisor ID number for the domain
|
DomainInfo |
getInfo()
Extract information about a domain.
|
DomainJobInfo |
getJobInfo()
Extract information about progress of a background job on a domain.
|
long |
getMaxMemory()
Retrieve the maximum amount of physical memory allocated to a domain.
|
int |
getMaxVcpus()
Provides the maximum number of virtual CPUs supported for the guest VM.
|
java.lang.String |
getMetadata(int type,
java.lang.String uri,
int flags)
Retrieves the appropriate domain element given by type.
|
java.lang.String |
getName()
Gets the public name for this domain
|
java.lang.String |
getOSType()
Gets the type of domain operation system.
|
SchedParameter[] |
getSchedulerParameters()
Gets the scheduler parameters.
|
java.lang.String |
getSchedulerType()
Gets the scheduler type.
|
SecurityLabel |
getSecurityLabel()
Get the security label of an active domain.
|
int[] |
getUUID()
Get the UUID for this domain.
|
java.lang.String |
getUUIDString()
Gets the UUID for this domain as string.
|
int[] |
getVcpusCpuMaps()
Returns the cpumaps for this domain Only the lower 8 bits of each int in
the array contain information.
|
VcpuInfo[] |
getVcpusInfo()
Extracts information about virtual CPUs of this domain
|
java.lang.String |
getXMLDesc(int flags)
Provides an XML description of the domain.
|
int |
hasCurrentSnapshot()
Determine if the domain has a snapshot
|
int |
hashCode() |
int |
hasManagedSaveImage()
Determine if the domain has a managed save image
|
java.util.Collection<DomainInterface> |
interfaceAddresses(int source,
int flags)
Retrieves a list of the network interfaces present in given domain along with their IP and MAC addresses.
|
DomainInterfaceStats |
interfaceStats(java.lang.String path)
Returns network interface stats for interfaces attached to this domain.
|
int |
isActive()
Determine if the domain is currently running
|
int |
isPersistent()
Determine if the domain has a persistent configuration which means it
will still exist after shutting down
|
boolean |
isUpdated()
Returns
true if, and only if, this domain has been updated. |
int |
managedSave()
suspend a domain and save its memory contents to a file on disk.
|
int |
managedSaveRemove()
Remove any managed save images from the domain
|
void |
memoryPeek(long start,
java.nio.ByteBuffer buffer,
MemoryAddressMode mode)
Read the contents of a domain's memory.
|
MemoryStatistic[] |
memoryStats(int number)
This function provides memory statistics for the domain.
|
Domain |
migrate(Connect dconn,
long flags,
java.lang.String dname,
java.lang.String uri,
long bandwidth)
Migrate this domain object from its current host to the destination host
given by dconn (a connection to the destination host).
|
Domain |
migrate(Connect dconn,
long flags,
java.lang.String dxml,
java.lang.String dname,
java.lang.String uri,
long bandwidth)
Migrate this domain object from its current host to the destination host
given by dconn (a connection to the destination host).
|
Domain |
migrate(Connect dconn,
TypedParameter[] params,
long flags)
Migrate the domain object from its current host to the destination host
given by dconn (a connection to the destination host).
|
int |
migrateSetMaxDowntime(long downtime)
Sets maximum tolerable time for which the domain is allowed to be paused
at the end of live migration.
|
int |
migrateToURI(java.lang.String uri,
long flags,
java.lang.String dname,
long bandwidth)
Migrate the domain object from its current host to the destination host
given by duri.
|
int |
migrateToURI(java.lang.String dconnuri,
java.lang.String miguri,
java.lang.String dxml,
long flags,
java.lang.String dname,
long bandwidth)
Migrate the domain object from its current host to the destination
denoted by a given URI.
|
void |
pinVcpu(int vcpu,
int[] cpumap)
Dynamically changes the real CPUs which can be allocated to a virtual
CPU.
|
void |
PMsuspend(SuspendTarget target)
Enter the given power management suspension target level.
|
void |
PMsuspendFor(SuspendTarget target,
long duration,
java.util.concurrent.TimeUnit unit)
Enter the given power management suspension target level for the given duration.
|
void |
PMwakeup()
Immediately wake up a guest using power management.
|
java.lang.String |
qemuAgentCommand(java.lang.String cmd,
int timeout,
int flags)
Commands for Qemu Guest Agent helper daemon
|
java.lang.String |
qemuMonitorCommand(java.lang.String cmd,
int flags)
Qemu Monitor Command - it will only work with hypervisor connections to the QEMU driver.
|
void |
reboot(int flags)
Reboot this domain, the domain object is still usable there after but the
domain OS is being stopped for a restart.
|
void |
removeBlockJobListener(BlockJobListener cb)
Removes BlockJobListener from the event framework, so it no longer receives events
|
void |
reset()
Reset a domain immediately without any guest OS shutdown.
|
void |
resume()
Resume this suspended domain, the process is restarted from the state
where it was frozen by calling virSuspendDomain().
|
int |
revertToSnapshot(DomainSnapshot snapshot)
Revert the domain to a given snapshot.
|
void |
save(java.lang.String to)
Suspends this domain and saves its memory contents to a file on disk.
|
java.lang.String |
screenshot(Stream stream,
int screen) |
void |
sendKey(KeycodeSet codeset,
int holdtime,
int... keys)
Send key(s) to the guest.
|
void |
setAutostart(boolean autostart)
Configures the network to be automatically started when the host machine
boots.
|
void |
setMaxMemory(long memory)
* Dynamically change the maximum amount of physical memory allocated to a
domain.
|
void |
setMemory(long memory)
Dynamically changes the target amount of physical memory allocated to
this domain.
|
void |
setMetadata(int type,
java.lang.String metadata,
java.lang.String key,
java.lang.String uri,
int flags)
Sets the appropriate domain element given by type to the value of metadata.
|
void |
setSchedulerParameters(SchedParameter[] params)
Changes the scheduler parameters
|
void |
setVcpus(int nvcpus)
Dynamically changes the number of virtual CPUs used by this domain.
|
void |
setVcpusFlags(int nvcpus,
int flags)
Dynamically changes the number of virtual CPUs used by this domain.
|
void |
shutdown()
Shuts down this domain, the domain object is still usable there after but
the domain OS is being stopped.
|
DomainSnapshot |
snapshotCreateXML(java.lang.String xmlDesc)
Creates a new snapshot of a domain based on the snapshot xml contained in
xmlDesc.
|
DomainSnapshot |
snapshotCreateXML(java.lang.String xmlDesc,
int flags)
Creates a new snapshot of a domain based on the snapshot xml contained in
xmlDesc.
|
DomainSnapshot |
snapshotCurrent()
Get the current snapshot for a domain, if any.
|
java.lang.String[] |
snapshotListNames()
Collect the list of domain snapshots for the given domain.
|
java.lang.String[] |
snapshotListNames(int flags)
Collect the list of domain snapshots for the given domain.
|
DomainSnapshot |
snapshotLookupByName(java.lang.String name)
Retrieve a snapshot by name
|
int |
snapshotNum()
Provides the number of domain snapshots for this domain..
|
void |
suspend()
Suspends this active domain, the process is frozen without further access
to CPU resources and I/O but the memory used by the domain at the
hypervisor level will stay allocated.
|
void |
undefine()
undefines this domain but does not stop it if it is running
|
void |
undefine(int flags)
Undefines this domain but does not stop if it it is running.
|
int |
updateDeviceFlags(java.lang.String xml,
int flags)
Change a virtual device on a domain
|
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int abortJob() throws LibvirtException
LibvirtException
public void attachDevice(java.lang.String xmlDesc) throws LibvirtException
xmlDesc
- XML description of one deviceLibvirtException
public void attachDeviceFlags(java.lang.String xmlDesc, int flags) throws LibvirtException
xmlDesc
- XML description of one deviceflags
- the an OR'ed set of Domain.DeviceModifyFlags
LibvirtException
public void blockCopy(java.lang.String diskPath, java.lang.String xmlDesc, TypedParameter[] params, int flags) throws LibvirtException
diskPath
- Path to current diskxmlDesc
- XML description of destination diskparams
- Hypervisor-specific tuning parametersflags
- Bitwise OR'ed values of Domain.BlockCopyFlags
LibvirtException
public DomainBlockInfo blockInfo(java.lang.String path) throws LibvirtException
path
- the path to the block deviceLibvirtException
public void blockPeek(java.lang.String disk, long offset, java.nio.ByteBuffer buffer) throws LibvirtException
Typical uses for this are to determine if the domain has written a Master Boot Record (indicating that the domain has completed installation), or to try to work out the state of the domain's filesystems.
(Note that in the local case you might try to open the block device or file directly, but that won't work in the remote case, nor if you don't have sufficient permission. Hence the need for this call).
The disk parameter can either be an unambiguous source name of
the block device (the <source file='...'/>
sub-element,
such as "/path/to/image"), or (since 0.9.5) the device
target shorthand (the <target dev='...'/>
sub-element,
such as "xvda").
Valid names can be found by calling getXMLDesc(int)
and
inspecting elements within //domain/devices/disk
.
This method always reads the number of bytes remaining in the
buffer, that is, buffer.remaining()
at the moment this
method is invoked. Upon return the buffer's position will be
equal to the limit, the limit itself will not have changed.
disk
- the path to the block device, or device shorthandoffset
- the offset within block devicebuffer
- the buffer receiving the dataLibvirtException
public DomainBlockStats blockStats(java.lang.String path) throws LibvirtException
<target dev='...'>
attribute within //domain/devices/disk. (For example, "xvda"). Domains
may have more than one block device. To get stats for each you should
make multiple calls to this function. Individual fields within the
DomainBlockStats object may be returned as -1, which indicates that the
hypervisor does not support that particular statistic.path
- path to the block deviceLibvirtException
public void blockResize(java.lang.String disk, long size, int flags) throws LibvirtException
disk
- path to the block image, or shorthand (like vda)size
- the new size of the block devicesflags
- bitwise OR'ed values of Domain.BlockResizeFlags
LibvirtException
public void blockCommit(java.lang.String disk, java.lang.String base, java.lang.String top, long bandwidth, int flags) throws LibvirtException
disk
- path to the block device, or device shorthandbase
- path to backing file to merge into, or device shorthand, or
NULL for defaulttop
- path to file within backing chain that contains data to be
merged, or device shorthand, or NULL to merge all possible databandwidth
- (optional) specify bandwidth limit; flags determine the unitflags
- bitwise-OR of Domain.BlockCommitFlags
LibvirtException
public DomainBlockJobInfo getBlockJobInfo(java.lang.String disk, int flags) throws LibvirtException
disk
- path to the block device, or device shorthandflags
- see Domain.BlockJobInfoFlags
LibvirtException
public void blockJobAbort(java.lang.String disk, int flags) throws LibvirtException
disk
- path to the block device, or device shorthandflags
- see Domain.BlockJobAbortFlags
LibvirtException
public void coreDump(java.lang.String to, int flags) throws LibvirtException
to
- path for the core fileflags
- extra flags, currently unusedLibvirtException
public int cpuMapLength(int maxCpus)
public int create() throws LibvirtException
LibvirtException
public int create(int flags) throws LibvirtException
LibvirtException
public void destroy() throws LibvirtException
LibvirtException
public void detachDevice(java.lang.String xmlDesc) throws LibvirtException
xmlDesc
- XML description of one deviceLibvirtException
public void detachDeviceFlags(java.lang.String xmlDesc, int flags) throws LibvirtException
xmlDesc
- XML description of one deviceLibvirtException
protected void finalize() throws LibvirtException
finalize
in class java.lang.Object
LibvirtException
public int free() throws LibvirtException
LibvirtException
public boolean getAutostart() throws LibvirtException
LibvirtException
public Connect getConnect()
public int getID() throws LibvirtException
LibvirtException
public DomainInfo getInfo() throws LibvirtException
LibvirtException
public DomainJobInfo getJobInfo() throws LibvirtException
LibvirtException
public long getMaxMemory() throws LibvirtException
LibvirtException
public int getMaxVcpus() throws LibvirtException
LibvirtException
public java.lang.String getMetadata(int type, java.lang.String uri, int flags) throws LibvirtException
type
- type of metadata, see Domain.MetadataType
uri
- XML namespace identifier if type == MetadataType.ELEMENT, null otherwiseflags
- bitwise-OR of Domain.ModificationImpact
LibvirtException
public java.lang.String getName() throws LibvirtException
LibvirtException
- neverpublic java.lang.String getOSType() throws LibvirtException
LibvirtException
public SchedParameter[] getSchedulerParameters() throws LibvirtException
LibvirtException
public java.lang.String getSchedulerType() throws LibvirtException
LibvirtException
public SecurityLabel getSecurityLabel() throws LibvirtException
null
if the domain is not
running under a security modelLibvirtException
public int[] getUUID() throws LibvirtException
LibvirtException
public java.lang.String getUUIDString() throws LibvirtException
LibvirtException
public int[] getVcpusCpuMaps() throws LibvirtException
LibvirtException
public VcpuInfo[] getVcpusInfo() throws LibvirtException
LibvirtException
public java.lang.String getXMLDesc(int flags) throws LibvirtException
flags
- not usedLibvirtException
public int hasCurrentSnapshot() throws LibvirtException
LibvirtException
public int hasManagedSaveImage() throws LibvirtException
LibvirtException
public java.util.Collection<DomainInterface> interfaceAddresses(int source, int flags) throws LibvirtException
source
- one of the Domain.InterfaceAddressesSource
constantsflags
- currently unused, pass zeroLibvirtException
- if something goes wrongpublic DomainInterfaceStats interfaceStats(java.lang.String path) throws LibvirtException
path
- path to the interfaceLibvirtException
public int isActive() throws LibvirtException
LibvirtException
public int isPersistent() throws LibvirtException
LibvirtException
public boolean isUpdated() throws LibvirtException
true
if, and only if, this domain has been updated.LibvirtException
public int managedSave() throws LibvirtException
LibvirtException
public int managedSaveRemove() throws LibvirtException
LibvirtException
public void memoryPeek(long start, java.nio.ByteBuffer buffer, MemoryAddressMode mode) throws LibvirtException
If mode is MemoryAddressMode.VIRTUAL the 'start' parameter is interpreted as virtual memory address for whichever task happens to be running on the domain at the moment. Although this sounds haphazard it is in fact what you want in order to read Linux kernel state, because it ensures that pointers in the kernel image can be interpreted coherently.
This method always reads the number of bytes remaining in the
buffer, that is, buffer.remaining()
at the moment this
method is invoked. Upon return the buffer's position will be
equal to the limit, the limit itself will not have changed.
start
- the start address of the memory to peekmode
- the mode which determines whether the given addresses
are interpreted as virtual or physical addressesLibvirtException
public MemoryStatistic[] memoryStats(int number) throws LibvirtException
number
- the number of stats to retrieveLibvirtException
public Domain migrate(Connect dconn, long flags, java.lang.String dxml, java.lang.String dname, java.lang.String uri, long bandwidth) throws LibvirtException
Flags may be bitwise OR'ed values of
MigrateFlags
.
If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name).
If this is not supported by the hypervisor, dname must be null
or
else you will get an exception.
Since typically the two hypervisors connect directly to each other in order to perform the migration, you may need to specify a path from the source to the destination. This is the purpose of the uri parameter.
If uri is null
, then libvirt will try to find the best method.
Uri may specify the hostname or IP address of the destination host as seen from the source, or uri may be a URI giving transport, hostname, user, port, etc. in the usual form.
Uri should only be specified if you want to migrate over a specific interface on the remote host.
For Qemu/KVM, the URI should be of the form "tcp://hostname[:port]"
.
This does not require TCP auth to be setup between the connections, since migrate uses a straight TCP connection (unless using the PEER2PEER flag, in which case URI should be a full fledged libvirt URI).
Refer also to driver documentation for the particular URIs supported.
The maximum bandwidth (in Mbps) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default.
Some hypervisors do not support this feature and will return an error if bandwidth is not 0. To see which features are supported by the current hypervisor, see Connect.getCapabilities, /capabilities/host/migration_features.
There are many limitations on migration imposed by the underlying technology for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.
If the hypervisor supports it, dxml can be used to alter host-specific portions of the domain XML that will be used on the destination.
dconn
- destination host (a Connect object)dxml
- (optional) XML config for launching guest on targetflags
- flagsdname
- (optional) rename domain to this at destinationuri
- (optional) dest hostname/URI as seen from the source hostbandwidth
- (optional) specify migration bandwidth limit in MbpsLibvirtException
- if the migration failspublic Domain migrate(Connect dconn, long flags, java.lang.String dname, java.lang.String uri, long bandwidth) throws LibvirtException
dconn
- destination host (a Connect object)flags
- flagsdname
- (optional) rename domain to this at destinationuri
- (optional) dest hostname/URI as seen from the source hostbandwidth
- optional) specify migration bandwidth limit in MbpsLibvirtException
public Domain migrate(Connect dconn, TypedParameter[] params, long flags) throws LibvirtException
dconn
- destination host (a Connect object)params
- (optional) migration parametersflags
- bitwise-OR of virDomainMigrateFlagsLibvirtException
public int migrateSetMaxDowntime(long downtime) throws LibvirtException
downtime
- the time to be downLibvirtException
public int migrateToURI(java.lang.String dconnuri, java.lang.String miguri, java.lang.String dxml, long flags, java.lang.String dname, long bandwidth) throws LibvirtException
The destination is given either in dconnuri (if the
PEER2PEER
is flag set), or in miguri (if neither the
PEER2PEER
nor the
TUNNELED
migration
flag is set in flags).
dconnuri
- (optional) URI for target libvirtd if @flags includes PEER2PEERmiguri
- (optional) URI for invoking the migration, not if @flags includs TUNNELEDdxml
- (optional) XML config for launching guest on targetflags
- Controls the migratedname
- The name at the destnationbandwidth
- Specify the migration bandwidthLibvirtException
public int migrateToURI(java.lang.String uri, long flags, java.lang.String dname, long bandwidth) throws LibvirtException
uri
- The destination URIflags
- Controls the migratedname
- The name at the destnationbandwidth
- Specify the migration bandwidthLibvirtException
public void PMsuspend(SuspendTarget target) throws LibvirtException
LibvirtException
public void PMsuspendFor(SuspendTarget target, long duration, java.util.concurrent.TimeUnit unit) throws LibvirtException
LibvirtException
public void PMwakeup() throws LibvirtException
Injects a wakeup into the guest that previously used
PMsuspend(org.libvirt.SuspendTarget)
or PMsuspendFor(org.libvirt.SuspendTarget, long, java.util.concurrent.TimeUnit)
, rather than
waiting for the previously requested duration (if any) to
elapse.
LibvirtException
public void pinVcpu(int vcpu, int[] cpumap) throws LibvirtException
vcpu
- virtual cpu numbercpumap
- bit map of real CPUs represented by the the lower 8 bits of
each int in the array. Each bit set to 1 means that
corresponding CPU is usable. Bytes are stored in little-endian
order: CPU0-7, 8-15... In each byte, lowest CPU number is
least significant bit.LibvirtException
public void reboot(int flags) throws LibvirtException
flags
- extra flags for the reboot operation, see Domain.RebootFlags
LibvirtException
public void resume() throws LibvirtException
LibvirtException
public void addBlockJobListener(BlockJobListener cb) throws LibvirtException
cb
- LibvirtException
public void removeBlockJobListener(BlockJobListener cb) throws LibvirtException
cb
- The BlockJobListenerLibvirtException
public void addIOErrorListener(IOErrorListener cb) throws LibvirtException
cb
- the IOErrorCallback instanceLibvirtException
- on failurepublic void addRebootListener(RebootListener l) throws LibvirtException
l
- the reboot listenerLibvirtException
- on failureConnect.addRebootListener(org.libvirt.event.RebootListener)
,
virConnectDomainEventRegisterAnypublic void addAgentLifecycleListener(AgentLifecycleListener cb) throws LibvirtException
cb
- the agent lifecycle listenerLibvirtException
- on failureConnect.addAgentLifecycleListener(org.libvirt.event.AgentLifecycleListener)
,
Connect.removeAgentLifecycleListener(org.libvirt.event.AgentLifecycleListener)
,
virConnectDomainEventRegisterAnypublic void addLifecycleListener(LifecycleListener l) throws LibvirtException
l
- the lifecycle listenerLibvirtException
- on failureConnect.addLifecycleListener(org.libvirt.event.LifecycleListener)
,
Connect.removeLifecycleListener(org.libvirt.event.LifecycleListener)
,
virConnectDomainEventRegisterAnypublic void addPMWakeupListener(PMWakeupListener l) throws LibvirtException
l
- the PMWakeup listenerLibvirtException
- on failureConnect.removePMWakeupListener(org.libvirt.event.PMWakeupListener)
,
Connect.addPMWakeupListener(org.libvirt.event.PMWakeupListener)
,
virConnectDomainEventRegisterAnypublic void addPMSuspendListener(PMSuspendListener l) throws LibvirtException
l
- the PMSuspend listenerLibvirtException
- on failureConnect.removePMSuspendListener(org.libvirt.event.PMSuspendListener)
,
Connect.addPMSuspendListener(org.libvirt.event.PMSuspendListener)
,
virConnectDomainEventRegisterAnypublic void reset() throws LibvirtException
LibvirtException
public int revertToSnapshot(DomainSnapshot snapshot) throws LibvirtException
snapshot
- the snapshot to revert toLibvirtException
public void save(java.lang.String to) throws LibvirtException
to
- path for the output fileLibvirtException
public java.lang.String screenshot(Stream stream, int screen) throws LibvirtException
LibvirtException
public void setAutostart(boolean autostart) throws LibvirtException
autostart
- LibvirtException
public void setMaxMemory(long memory) throws LibvirtException
memory
- the amount memory in kilobytesLibvirtException
public void setMemory(long memory) throws LibvirtException
memory
- in kilobytesLibvirtException
public void setMetadata(int type, java.lang.String metadata, java.lang.String key, java.lang.String uri, int flags) throws LibvirtException
type
- see Domain.MetadataType
metadata
- the new metadata contentkey
- XML namespace prefix for type MetadataType.ELEMENT, null otherwiseuri
- XML namespace URI for typeMetadataType.ELEMENT, null otherwiseflags
- see Domain.ModificationImpact
LibvirtException
public void setSchedulerParameters(SchedParameter[] params) throws LibvirtException
params
- an array of SchedParameter objects to be changedLibvirtException
public void setVcpus(int nvcpus) throws LibvirtException
nvcpus
- the new number of virtual CPUs for this domainLibvirtException
public void setVcpusFlags(int nvcpus, int flags) throws LibvirtException
nvcpus
- the new number of virtual CPUs for this domainflags
- Domain.VcpuFlags
LibvirtException
public void sendKey(KeycodeSet codeset, int holdtime, int... keys) throws LibvirtException
codeset
- the set of keycodesholdtime
- the duration that the keys will be held (in milliseconds)keys
- the key codes to be sendLibvirtException
public void shutdown() throws LibvirtException
LibvirtException
public DomainSnapshot snapshotCreateXML(java.lang.String xmlDesc, int flags) throws LibvirtException
xmlDesc
- string containing an XML description of the domainflags
- flags for creating the snapshot, see the Domain.SnapshotCreateFlags
for the flag optionsLibvirtException
public DomainSnapshot snapshotCreateXML(java.lang.String xmlDesc) throws LibvirtException
This is just a convenience method, it has the same effect
as calling snapshotCreateXML(xmlDesc, 0);
.
xmlDesc
- string containing an XML description of the domainLibvirtException
snapshotCreateXML(String, int)
,
Libvirt
Documentationpublic DomainSnapshot snapshotCurrent() throws LibvirtException
LibvirtException
public java.lang.String[] snapshotListNames(int flags) throws LibvirtException
flags
- Domain.SnapshotListFlags
LibvirtException
public java.lang.String[] snapshotListNames() throws LibvirtException
This is just a convenience method, it has the same effect
as calling snapshotListNames(0);
.
LibvirtException
snapshotListNames(int)
,
virDomainSnapshotListNamespublic DomainSnapshot snapshotLookupByName(java.lang.String name) throws LibvirtException
name
- the nameLibvirtException
public int snapshotNum() throws LibvirtException
LibvirtException
public void suspend() throws LibvirtException
LibvirtException
public void undefine() throws LibvirtException
LibvirtException
public void undefine(int flags) throws LibvirtException
flags
- flags for undefining the domain.
See virDomainUndefineFlagsValues for more informationLibvirtException
public int updateDeviceFlags(java.lang.String xml, int flags) throws LibvirtException
xml
- the xml to update withflags
- controls the updateLibvirtException
public java.lang.String qemuAgentCommand(java.lang.String cmd, int timeout, int flags) throws LibvirtException
cmd
- the guest agent command stringtimeout
- timeout secondsflags
- execution flagsLibvirtException
public java.lang.String qemuMonitorCommand(java.lang.String cmd, int flags) throws LibvirtException
cmd
- the qemu monitor command stringflags
- bitwise-or of supported virDomainQemuMonitorCommandFlagsLibvirtException