Class: 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
Source:
Throws:
Error

attachDevice(xml)

Create a virtual device attachment to backend
Parameters:
Name Type Description
xml String XML description of one device
Source:
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
Source:
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
Source:
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
Source:
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
Source:
Throws:
Error

create(flags)

Launch a defined domain
Parameters:
Name Type Description
flags Number bitwise-OR of supported virDomainCreateFlags
Source:
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
Source:
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
Source:
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
Source:
Throws:
Error

freezeFileSystem(mnts) → {Number}

Freeze specified filesystems within the guest
Parameters:
Name Type Description
mnts Array list of mount points to be frozen
Source:
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
Source:
Throws:
Error
Returns:
Type
Boolean

getBlkioParameters(flags) → {Array}

Returns all blkio parameters
Parameters:
Name Type Description
flags Number bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
Throws:
Error
Returns:
Type
Connection

getControlInfo() → {Object}

Returns details about current state of control interface to a domain.
Source:
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
Source:
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
Source:

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.
Source:
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
Source:
Throws:
Error
Returns:
mount points information
Type
Array

getHostname() → {String}

Returns the hostname for that domain.
Source:
Throws:
Error
Returns:
Type
String

getId()

Returns he hypervisor ID number for the domain
Source:

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
Source:
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
Source:
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
Source:
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.
Source:
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.
Source:
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
Source:
Returns:
Type
Array

getMaxMemory() → {Number}

Returns the maximum amount of physical memory allocated to a domain
Source:
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
Source:
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
Source:
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
Source:
Throws:
Error
Returns:
the metadata string
Type
String

getName() → {String}

Returns the public name for that domain
Source:
Returns:
domain name
Type
String

getNumaParameters(flags) → {Array}

Returns all numa parameters
Parameters:
Name Type Description
flags Number bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
Source:
Throws:
Error
Returns:
typed parameters
Type
Array

getOSType() → {String}

Returns the type of domain operation system.
Source:
Throws:
Error
Returns:
Type
String

getSchedulerParameters(flags) → {Array}

Returns all scheduler parameters
Parameters:
Name Type Description
flags Number bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
Source:
Throws:
Error
Returns:
typed parameters
Type
Array

getSchedulerType() → {String}

Returns the scheduler type
Source:
Throws:
Error
Returns:
Type
String

getSecurityLabel() → {Object}

Returns the security label of an active domain
Source:
Throws:
Error
Returns:
security label
Type
Object

getSecurityLabelList()

Returns the security labels of an active domain
Source:

getState() → {Object}

Returns the domain state
Source:
Throws:
Error
Returns:
domain state and reason
Type
Object

getTime() → {Number}

Returns the guest time in nanoseconds
Source:
Throws:
Error
Returns:
Type
Number

getUUID() → {String}

Returns the UUID for a domain
Source:
Throws:
Error
Returns:
UUID
Type
String

getUUIDString() → {String}

Returns the UUID for a domain as string
Source:
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.
Source:
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.
Source:
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
Source:
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
Source:
Throws:
Error
Returns:
Type
String

hasManagedSaveImage() → {Boolean}

Check if a domain has a managed save image as created by Domain#managedSave().
Source:
Throws:
Error
Returns:
Type
Boolean

injectNMI()

Send NMI to the guest
Source:
Throws:
Error

isActive() → {Boolean}

Determine if the domain is currently running
Source:
Throws:
Error
Returns:
Type
Boolean

isPersistent() → {Boolean}

Determine if the domain has a persistent configuration which means it will still exist after shutting down
Source:
Throws:
Error
Returns:
Type
Boolean

isUpdated() → {Boolean}

Determine if the domain has been updated
Source:
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
Source:
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
Source:
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
Source:
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
Source:
Throws:
Error

ref()

Increment the reference count on the domain
Source:
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.
Source:
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
Source:
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
Source:
Throws:
Error

resume()

Resume a suspended domain, the process is restarted from the state where it was frozen by calling Domain#suspend()
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
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
Source:
Throws:
Error

shutdown(flags)

Shutdown a domain
Parameters:
Name Type Description
flags Number bitwise-OR of virDomainShutdownFlagValues
Source:
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
Source:
Throws:
Error

thawFileSystem(mnts) → {Number}

Thaw specified filesystems within the guest
Parameters:
Name Type Description
mnts Array list of mount points to be thaw
Source:
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
Source:
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
Source:
Throws:
Error

updateDevice(xml, flags)

Parameters:
Name Type Description
xml String XML description of one device
flags Number bitwise-OR of virDomainDeviceModifyFlags
Source:
Throws:
Error