new Domain()
Domain
Methods
abortBlockJob(disk, flags)
Cancel the active block job on the given disk.
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
flags |
Number | bitwise-OR of virDomainBlockJobAbortFlags |
Throws:
Error
attachDevice(xml)
Create a virtual device attachment to backend
Parameters:
Name | Type | Description |
---|---|---|
xml |
String | XML description of one device |
Throws:
Error
commitBlock(disk, base, top, bandWidth, flags)
Commit changes that were made to temporary top-level files within a disk
image backing file chain into a lower-level base file
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
base |
String | path to backing file to merge into, or device shorthand |
top |
String | path to file within backing chain that contains data to be merged, or device shorthand |
bandWidth |
Number | specify bandwidth limit |
flags |
Number | bitwise-OR of virDomainBlockCommitFlags |
Throws:
Error
copyBlock(disk, xml, params, flags)
Copy the guest-visible contents of a disk image to a new file described by
the specified xml
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
xml |
String | XML description of the copy destination |
params |
Object | block copy parameter objects |
flags |
Number | bitwise-OR of virDomainBlockCopyFlags |
Throws:
Error
coreDump(to, flags)
Dump the core of a domain on a given file for analysis
Parameters:
Name | Type | Description |
---|---|---|
to |
String | path for the core file |
flags |
Number | bitwise-OR of virDomainCoreDumpFlags |
Throws:
Error
coreDumpWithFormat(to, format, flags)
Dump the core of a domain on a given file for analysis
Parameters:
Name | Type | Description |
---|---|---|
to |
String | path for the core file |
format |
Number | format of domain memory's dump |
flags |
Number | bitwise-OR of virDomainCoreDumpFlags |
Throws:
Error
create(flags)
Launch a defined domain
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of supported virDomainCreateFlags |
Throws:
Error
createWithFiles(files, flags)
Launch a defined domain
Parameters:
Name | Type | Description |
---|---|---|
files |
Array | list of file descriptors |
flags |
Number | bitwise-OR of supported virDomainCreateFlags |
Throws:
Error
destroy(flags)
Destroy the domain object. The running instance is shutdown if not down
already and all resources used by it are given back to the hypervisor.
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainDestroyFlagsValues |
Throws:
Error
detachDevice(xml, flags)
Detach a virtual device from a domain, using the flags parameter to control
how the device is detached
Parameters:
Name | Type | Description |
---|---|---|
xml |
String | XML description of one device |
flags |
Number | bitwise-OR of virDomainDeviceModifyFlags |
Throws:
Error
freezeFileSystem(mnts) → {Number}
Freeze specified filesystems within the guest
Parameters:
Name | Type | Description |
---|---|---|
mnts |
Array | list of mount points to be frozen |
Throws:
Error
Returns:
the number of frozen filesystems
- Type
- Number
getAutostart() → {Boolean}
Returns a boolean value indicating whether the domain configured to be
automatically started when the host machine boots
Throws:
Error
Returns:
- Type
- Boolean
getBlkioParameters(flags) → {Array}
Returns all blkio parameters
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact and virTypedParameterFlags |
Throws:
Error
Returns:
blkio parameter object
- Type
- Array
getBlockInfo(disk) → {Object}
Returns information about a domain's block device.
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
Throws:
Error
Returns:
- Type
- Object
getBlockIoTune(disk, flags) → {Array}
Returns all block IO tunable parameters for a given device
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
flags |
Number | bitwise-OR of virDomainModificationImpact and virTypedParameterFlags |
Throws:
Error
Returns:
blkio parameter objects
- Type
- Array
getBlockJobInfo(disk, flags) → {Object}
Request block job information for the given disk
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
flags |
Number | bitwise-OR of virDomainBlockJobInfoFlags |
Throws:
Error
Returns:
block job info
- Type
- Object
getBlockStats(disk) → {Object}
Returns block device (disk) stats for block devices attached to the domain
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
Throws:
Error
Returns:
- Type
- Object
getBlockStatsParameters(disk, flags) → {Array}
Returns block stats parameters for block devices attached to the domain
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
flags |
Number | bitwise-OR of virTypedParameterFlags |
Returns:
- Type
- Array
getConnection() → {Connection}
Returns the connection pointer associated with a domain. The reference
counter on the connection is not increased by this call
Throws:
Error
Returns:
- Type
- Connection
getControlInfo() → {Object}
Returns details about current state of control interface to a domain.
Throws:
Error
Returns:
control info
- Type
- Object
getCPUStats(start, ncpus, flags) → {Array}
Returns statistics relating to CPU usage attributable to a single domain
Parameters:
Name | Type | Description |
---|---|---|
start |
Number | which cpu to start with, or -1 for summary |
ncpus |
Number | how many cpus to query |
flags |
Number | bitwise-OR of virTypedParameterFlags |
Throws:
Error
Returns:
typed parameter objects
- Type
- Array
getDiskErrors()
Returns all I/O errors that encountered with disks. Disks with no error will
not be returned
getEmulatorPinInfo(flags) → {Array}
Query the CPU affinity setting of all emulator threads of domain, store it
in cpumap.
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact Must not be VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG concurrently. |
Throws:
Error
Returns:
- Type
- Array
getFileSystemInfo() → {Array}
Return a list of mapping information for each mounted file systems within
the specified guest and the disks
Throws:
Error
Returns:
mount points information
- Type
- Array
getHostname() → {String}
Returns the hostname for that domain.
Throws:
Error
Returns:
- Type
- String
getId()
Returns he hypervisor ID number for the domain
getInterfaceAddresses(source) → {Array}
Returns the interfaces present in given domain along with their IP and MAC
addresses
Parameters:
Name | Type | Description |
---|---|---|
source |
Number | one of the virDomainInterfaceAddressesSource constants |
Throws:
Error
Returns:
interface objects
- Type
- Array
getInterfaceParameters(device, flags) → {Array}
Returns all interface parameters
Parameters:
Name | Type | Description |
---|---|---|
device |
String | the interface name or mac address |
flags |
Number | bitwise-OR of virDomainModificationImpact and virTypedParameterFlags |
Throws:
Error
Returns:
typed parameters
- Type
- Array
getInterfaceStats(path) → {Array}
Returns network interface stats for interfaces attached to the domain
Parameters:
Name | Type | Description |
---|---|---|
path |
String | path to the interface |
Throws:
Error
Returns:
interface stats
- Type
- Array
getIOThreadInfo(flags) → {Object}
Returns IOThreads of an active domain including the cpumap information to
determine on which CPU the IOThread has affinity to run
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact Must not be VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG concurrently. |
Throws:
Error
Returns:
IOThread info
- Type
- Object
getJobInfo() → {Object}
Returns information about progress of a background job on a domain.
Will return an error if the domain is not active.
Throws:
Error
Returns:
job information
- Type
- Object
getJobStats(flags) → {Array}
Returns information about progress of a background job on a domain
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainGetJobStatsFlags |
Returns:
- Type
- Array
getMaxMemory() → {Number}
Returns the maximum amount of physical memory allocated to a domain
Throws:
Error
Returns:
the memory size in kibibytes (blocks of 1024 bytes)
- Type
- Number
getMaxVcpus() → {Number}
Returns the maximum number of virtual CPUs supported for the guest VM
Throws:
Error
Returns:
the maximum of virtual CPU
- Type
- Number
getMemoryParameters(flags) → {Array}
Returns all memory parameters
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact and virTypedParameterFlags |
Throws:
Error
Returns:
typed parameters
- Type
- Array
getMetadata(type, uri, flags) → {String}
Returns the appropriate domain element
Parameters:
Name | Type | Description |
---|---|---|
type |
Number | type of metadata, from virDomainMetadataType |
uri |
String | XML namespace identifier |
flags |
Number | bitwise-OR of virDomainModificationImpact |
Throws:
Error
Returns:
the metadata string
- Type
- String
getName() → {String}
Returns the public name for that domain
Returns:
domain name
- Type
- String
getNumaParameters(flags) → {Array}
Returns all numa parameters
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact and virTypedParameterFlags |
Throws:
Error
Returns:
typed parameters
- Type
- Array
getOSType() → {String}
Returns the type of domain operation system.
Throws:
Error
Returns:
- Type
- String
getSchedulerParameters(flags) → {Array}
Returns all scheduler parameters
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact and virTypedParameterFlags |
Throws:
Error
Returns:
typed parameters
- Type
- Array
getSchedulerType() → {String}
Returns the scheduler type
Throws:
Error
Returns:
- Type
- String
getSecurityLabel() → {Object}
Returns the security label of an active domain
Throws:
Error
Returns:
security label
- Type
- Object
getSecurityLabelList()
Returns the security labels of an active domain
getState() → {Object}
Returns the domain state
Throws:
Error
Returns:
domain state and reason
- Type
- Object
getTime() → {Number}
Returns the guest time in nanoseconds
Throws:
Error
Returns:
- Type
- Number
getUUID() → {String}
Returns the UUID for a domain
Throws:
Error
Returns:
UUID
- Type
- String
getUUIDString() → {String}
Returns the UUID for a domain as string
Throws:
Error
Returns:
UUID string
- Type
- String
getVcpuPinInfo(ncpumaps, manlen, flags) → {Array}
Returns the CPU affinity setting of all virtual CPUs of domain
Parameters:
Name | Type | Description |
---|---|---|
ncpumaps |
the number of cpumap | |
manlen |
the number of bytes in one cpumap | |
flags |
bitwise-OR of virDomainModificationImpact Must not be VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG concurrently. |
Throws:
Error
Returns:
the virtual CPUs
- Type
- Array
getVcpus(flags) → {Array}
Returns the information about virtual CPUs of domain
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainModificationImpact Must not be VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG concurrently. |
Throws:
Error
Returns:
- Type
- Array
getVcpusFlags(flags) → {Number}
Returns the number of virtual CPUs used by the domain
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainVcpuFlags |
Throws:
Error
Returns:
- Type
- Number
getXMLDesc(flags) → {String}
Returns the XML description of the domain
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainXMLFlags |
Throws:
Error
Returns:
- Type
- String
hasManagedSaveImage() → {Boolean}
Check if a domain has a managed save image as created by
Domain#managedSave().
Throws:
Error
Returns:
- Type
- Boolean
injectNMI()
Send NMI to the guest
Throws:
Error
isActive() → {Boolean}
Determine if the domain is currently running
Throws:
Error
Returns:
- Type
- Boolean
isPersistent() → {Boolean}
Determine if the domain has a persistent configuration which means it will
still exist after shutting down
Throws:
Error
Returns:
- Type
- Boolean
isUpdated() → {Boolean}
Determine if the domain has been updated
Throws:
Error
Returns:
- Type
- Boolean
peekBlock(disk, offset, size) → {ArrayBuffer}
read the contents of a domain's disk device
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
offset |
Number | offset within block device |
size |
Number | size to read |
Throws:
Error
Returns:
- Type
- ArrayBuffer
pullBlock(disk, bandWidth, flags)
Populate a disk image with data from its backing image
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
bandWidth |
Number | specify bandwidth limit |
flags |
Number | bitwise-OR of virDomainBlockPullFlags |
Throws:
Error
rebaseBlock(disk, base, bandWidth, flags)
Populate a disk image with data from its backing image chain, and setting
the backing image to base
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
base |
String | path to backing file to keep, or device shorthand, or null for no backing file |
bandWidth |
Number | specify bandwidth limit |
flags |
Number | bitwise-OR of virDomainBlockRebaseFlags |
Throws:
Error
reboot(flags)
Reboot a domain, the domain object is still usable thereafter, but the
domain OS is being stopped for a restart
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainRebootFlagValues |
Throws:
Error
ref()
Increment the reference count on the domain
Throws:
Error
reset()
Reset a domain immediately without any guest OS shutdown. Reset emulates the
power reset button on a machine, where all hardware sees the RST line set
and reinitializes internal state.
Throws:
Error
resizeBlock(disk, size, flags)
Resize a block device of domain while the domain is running
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block image, or shorthand |
size |
Number | new size of the block image |
flags |
Number | bitwise-OR of virDomainBlockResizeFlags |
Throws:
Error
restore(from, dxml, flags)
Restore a domain saved to disk by Domain#save()
Parameters:
Name | Type | Description |
---|---|---|
from |
String | path to the input file |
dxml |
String | (optional) XML config for adjusting guest xml used on restore |
flags |
Number | bitwise-OR of virDomainSaveRestoreFlags |
Throws:
Error
resume()
Resume a suspended domain, the process is restarted from the state where it
was frozen by calling Domain#suspend()
Throws:
Error
save(to, dxml, flags)
Suspend a domain and save its memory contents to a file on disk
Parameters:
Name | Type | Description |
---|---|---|
to |
String | path for the output file |
dxml |
String | (optional) XML config for adjusting guest xml used on restore |
flags |
Number | bitwise-OR of virDomainSaveRestoreFlags |
Throws:
Error
screenshot(screen) → {Object}
Take a screenshot of current domain console as a stream
Parameters:
Name | Type | Description |
---|---|---|
screen |
Number | monitor ID to take screenshot from |
Throws:
Error
Returns:
the screenshot object
- Type
- Object
sendKey(codeset, holdtime, keycodes)
Send key(s) to the guest.
Parameters:
Name | Type | Description |
---|---|---|
codeset |
Number | the code set of keycodes, from virKeycodeSet |
holdtime |
Number | the duration (in milliseconds) that the keys will be held |
keycodes |
Array | array of keycodes |
Throws:
Error
sendProcessSignal(pid, signal, flags)
Send a signal to the designated process in the guest
Parameters:
Name | Type | Description |
---|---|---|
pid |
Number | a positive integer process ID, or negative integer process group ID |
signal |
Number | a signal from the virDomainProcessSignal enum |
flags |
Number | one of the virDomainProcessSignalFlag values |
Throws:
Error
setAutostart(autostart)
Configure the domain to be automatically started when the host machine boots.
Parameters:
Name | Type | Description |
---|---|---|
autostart |
Boolean | whether the domain should be automatically started |
Throws:
Error
setBlockJobSpeed(disk, bandWidth, flags)
Set the maximimum allowable bandwidth that a block job may consume
Parameters:
Name | Type | Description |
---|---|---|
disk |
String | path to the block device, or device shorthand |
bandWidth |
Number | specify bandwidth limit |
flags |
Number | bitwise-OR of virDomainBlockJobSetSpeedFlags |
Throws:
Error
setMetadata(type, metadata, key, uri, flags)
Sets the appropriate domain element given by type to the value of metadata
Parameters:
Name | Type | Description |
---|---|---|
type |
Number | type of metadata, from virDomainMetadataType |
metadata |
String | new metadata text |
key |
String | XML namespace key, or null |
uri |
String | XML namespace URI, or null |
flags |
Number | bitwise-OR of virDomainModificationImpact |
Throws:
Error
setTime(nanoseconds, flags)
When a domain is suspended or restored from a file the domain's OS has no
idea that there was a big gap in the time. Depending on how long the gap
was, NTP might not be able to resynchronize the guest.
Parameters:
Name | Type | Description |
---|---|---|
nanoseconds |
Number | time to set, in nanoseconds |
flags |
Number | bitwise-OR of virDomainSetTimeFlags |
Throws:
Error
shutdown(flags)
Shutdown a domain
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of virDomainShutdownFlagValues |
Throws:
Error
suspend()
Suspends an 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
Throws:
Error
thawFileSystem(mnts) → {Number}
Thaw specified filesystems within the guest
Parameters:
Name | Type | Description |
---|---|---|
mnts |
Array | list of mount points to be thaw |
Throws:
Error
Returns:
the number of thawed filesystems
- Type
- Number
trimFileSystem(mnt, min)
Calls FITRIM within the guest
Parameters:
Name | Type | Description |
---|---|---|
mnt |
String | which mount point to trim |
min |
Number | Minimum contiguous free range to discard in bytes |
Throws:
Error
undefine(flags)
Undefine a domain. If the domain is running, it's converted to transient
domain, without stopping it. If the domain is inactive, the domain
configuration is removed.
Parameters:
Name | Type | Description |
---|---|---|
flags |
Number | bitwise-OR of supported virDomainUndefineFlagsValues |
Throws:
Error
updateDevice(xml, flags)
Parameters:
Name | Type | Description |
---|---|---|
xml |
String | XML description of one device |
flags |
Number | bitwise-OR of virDomainDeviceModifyFlags |
Throws:
Error