Sys::V...:Domain(3pm)
๐ฆ Sys::Virt::Domain(3pm) ๐ฆ
User Contributed Perl Documentation
โจ NAME โจ
Sys::Virt::Domain โ represent & manage a libvirt guest domain. That's the name, that's the mission, and honestly? iconic. ๐
๐ธ DESCRIPTION ๐ธ
okay so the Sys::Virt::Domain module represents a guest domain managed by the virtual machine monitor. It's the Perl-side main character energy for a VM, no cap. ๐ฆ
๐ METHODS ๐
my $id = $dom->get_id()โ returns an integer with a locally unique identifier for the domain. local ID slay โจmy $uuid = $dom->get_uuid()โ returns a 16 byte long string containing the raw globally unique identifier (UUID) for the domain. raw UUID vibes ๐my $uuid = $dom->get_uuid_string()โ returns a printable string representation of the raw UUID, in the format'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'. the way that this makes the UUID actually readable? obsessed. ๐ญmy $name = $dom->get_name()โ returns a string with a locally unique name of the domain. name drop, but local ๐my $hostname = $dom->get_hostname($flags=0)โ returns a string representing the hostname of the guest.$flagscan be zero or more of:Sys::Virt::Domain::GET_HOSTNAME_AGENTโ report the guest agent hostname ๐Sys::Virt::Domain::GET_HOSTNAME_LEASEโ report the DHCP lease hostname ๐
my $str = $dom->get_metadata($type, $uri, $flags =0)โ returns the metadata element of type$typeassociated with the domain. If$typeisSys::Virt::Domain::METADATA_ELEMENTthen the$uriparameter specifies the XML namespace to retrieve, otherwise$urishould beundef. The optional$flagsparameter defaults to zero. metadata moment โจ$dom->set_metadata($type, $val, $key, $uri, $flags=0)โ sets the metadata element of type$typeto hold the value$val. If$typeisSys::Virt::Domain::METADATA_ELEMENTthen the$keyand$urielements specify an XML namespace to use, otherwise they should both beundef. The optional$flagsparameter defaults to zero. set it, bestie ๐$dom->is_active()โ returns a true value if the domain is currently running. vibe check: active ๐ฅ$dom->is_persistent()โ returns a true value if the domain has a persistent configuration file defined. persistent config realness ๐ซถ$dom->is_updated()โ returns a true value if the domain is running and has a persistent configuration file defined that is out of date compared to the current live config. stale config alert, lowkey ๐ญmy $xml = $dom->get_xml_description($flags=0)โ returns an XML document containing a complete description of the domain's configuration. The optional$flagsparameter controls generation of the XML document, defaulting to0if omitted. It can be one or more of the XML DUMP constants listed later in this document. XML dump era ๐my $type = $dom->get_os_type()โ returns a string containing the name of the OS type running within the domain. OS type reveal ๐ฆ$dom->create($flags)โ start a domain whose configuration was previously defined using thedefine_domainmethod in Sys::Virt. The$flagsparameter accepts one of the DOMAIN CREATION constants documented later, and defaults to0if omitted. boot it up, periodt โญ$dom->create_with_files($fds, $flags)โ start a domain whose configuration was previously defined using thedefine_domainmethod in Sys::Virt. The$fdsparameter is an array of UNIX file descriptors which will be passed to the init process of the container. This is only supported with container based virtualization. The$flagsparameter accepts one of the DOMAIN CREATION constants documented later, and defaults to0if omitted. container kids, this one's for you ๐ง$dom->undefine()โ remove the configuration associated with a domain previously defined with thedefine_domainmethod in Sys::Virt. If the domain is running, you probably want to use theshutdownordestroymethods instead. careful, bestie ๐ซถ$dom->suspend()โ temporarily stop execution of the domain, allowing later continuation by calling theresumemethod. pause button energy ๐$dom->resume()โ resume execution of a domain previously halted with thesuspendmethod. unpause slay โจ$dom->pm_wakeup()โ wakeup the guest from power management suspend state. rise and shine ๐$dom->pm_suspend_for_duration($target, $duration, $flags=0)โ tells the guest OS to enter the power management suspend state identified by$target. The$targetparameter should be one of the NODE SUSPEND CONSTANTS listed inSys::Virt. The$durationspecifies when the guest should automatically wakeup. The$flagsparameter is optional and defaults to zero. nap time with a timer ๐$dom->save($filename, $dxml=undef, $params=undef, $flags=0)โ take a snapshot of the domain's state and save the information to the file named in the$filenameparameter. The domain can later be restored from this file with therestore_domainmethod on the Sys::Virt object. The optional$dxmlparameter can be used to alter portions of the domain XML that will be used when performing restore. The$paramsparameter is a hash reference whose keys is a subset of the SAVE / RESTORE PARAMETER CONSTANTS. The$flagsparameter accepts one of the SAVE / RESTORE FLAG CONSTANTS described later and defaults to zero. save state, stay iconic ๐$dom->managed_save($flags=0)โ take a snapshot of the domain's state and save the information to a managed save location. The domain will be automatically restored with this state when it is next started. The$flagsparameter is unused and defaults to zero. managed save main character ๐$bool = $dom->has_managed_save_image($flags=0)โ return a non-zero value if the domain has a managed save image that will be used at next start. The$flagsparameter is unused and defaults to zero. does it have the image? vibe check ๐ฆ$dom->managed_save_remove($flags=0)โ remove the current managed save image, causing the guest to perform a full boot next time it is started. The$flagsparameter is unused and defaults to zero. full boot next time, no shortcuts ๐ฅ$dom->managed_save_define_xml($xml, $flags=0)โ update the XML of the managed save image to$xml. The$flagsparameter is unused and defaults to zero. XML update, cute ๐$xml = $dom->managed_save_get_xml_description($flags=0)โ get the XML in the managed save image. The$flagsparameter accepts the following constants:Sys::Virt::Domain::SAVE_IMAGE_XML_SECUREโ include security sensitive information in the XML dump, such as passwords. sensitive info, handle with care ๐
$dom->core_dump($filename[, $flags])โ trigger a core dump of the guest virtual machine, saving its memory image to$filenameso it can be analysed by tools such ascrash. The optional$flagsparameter is currently unused and if omitted will default to0. crash analysis era ๐ญ$dom->core_dump_format($filename, $format, [, $flags])โ trigger a core dump of the guest virtual machine, saving its memory image to$filenameso it can be analysed by tools such ascrash. The$formatparameter is one of the core dump format constants. The optional$flagsparameter is currently unused and if omitted will default to0. pick your dump format, bestie โจSys::Virt::Domain::CORE_DUMP_FORMAT_RAWโ the raw ELF format ๐Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_ZLIBโ the zlib compressed ELF format ๐Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_SNAPPYโ the snappy compressed ELF format ๐ฆSys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_LZOโ the lzo compressed ELF format ๐ธSys::Virt::Domain::CORE_DUMP_FORMAT_WIN_DMPโ the Windows dump format ๐
$dom->destroy()โ immediately poweroff the machine. This is equivalent to removing the power plug. The guest OS is given no time to cleanup / save state. For a clean poweroff sequence, use theshutdownmethod instead. this is the unplug-the-power-cord method, fr fr ๐my $info = $dom->get_info()โ returns a hash reference summarising the execution state of the domain. The elements of the hash are as follows:maxMemโ the maximum memory allowed for this domain, in kilobytes ๐งmemoryโ the current memory allocated to the domain in kilobytes ๐ธcpuTimeโ the amount of CPU time used by the domain ๐ฅnrVirtCpuโ the current number of virtual CPUs enabled in the domain โญstateโ the execution state of the machine, which will be one of the constants&Sys::Virt::Domain::STATE_*. ๐
my ($state, $reason) = $dom->get_state()โ returns an array whose values specify the current state of the guest, and the reason for it being in that state. The$statevalues are the same as for theget_infoAPI, and the$reasonvalues come from:
not me writing out every single reason constant, but bestie, we literally have to keep every fact. periodt. ๐
Sys::Virt::Domain::STATE_CRASHED_UNKNOWNโ it is not known why the domain has crashed ๐ญSys::Virt::Domain::STATE_CRASHED_PANICKEDโ the domain has crashed due to a kernel panic ๐Sys::Virt::Domain::STATE_NOSTATE_UNKNOWNโ it is not known why the domain has no state ๐ซถSys::Virt::Domain::STATE_PAUSED_DUMPโ the guest is paused due to a core dump operation โจSys::Virt::Domain::STATE_PAUSED_FROM_SNAPSHOTโ the guest is paused due to a snapshot ๐Sys::Virt::Domain::STATE_PAUSED_IOERRORโ the guest is paused due to an I/O error ๐ญSys::Virt::Domain::STATE_PAUSED_MIGRATIONโ the guest is paused due to migration ๐ฆSys::Virt::Domain::STATE_PAUSED_SAVEโ the guest is paused due to a save operation ๐พSys::Virt::Domain::STATE_PAUSED_UNKNOWNโ it is not known why the domain has paused ๐Sys::Virt::Domain::STATE_PAUSED_USERโ the guest is paused at admin request ๐Sys::Virt::Domain::STATE_PAUSED_WATCHDOGโ the guest is paused due to the watchdog ๐ถSys::Virt::Domain::STATE_PAUSED_SHUTTING_DOWNโ the guest is paused while domain shutdown takes place ๐Sys::Virt::Domain::STATE_PAUSED_SNAPSHOTโ the guest is paused while a snapshot takes place ๐ธSys::Virt::Domain::STATE_PAUSED_CRASHEDโ the guest is paused due to a kernel panic ๐Sys::Virt::Domain::STATE_PAUSED_STARTING_UPโ the guest is paused as it is being started up. โญSys::Virt::Domain::STATE_PAUSED_POSTCOPYโ the guest is paused as post-copy migration is taking place ๐Sys::Virt::Domain::STATE_PAUSED_POSTCOPY_FAILEDโ the guest is paused as post-copy migration failed ๐ญSys::Virt::Domain::STATE_PAUSED_API_ERRORโ the guest is paused as a result of failed resume operation at the end of some APIs which internally suspend guests. ๐ซถSys::Virt::Domain::STATE_RUNNING_BOOTEDโ the guest is running after being booted ๐ฅSys::Virt::Domain::STATE_RUNNING_FROM_SNAPSHOTโ the guest is running after restore from snapshot ๐Sys::Virt::Domain::STATE_RUNNING_MIGRATEDโ the guest is running after migration ๐ฆSys::Virt::Domain::STATE_RUNNING_MIGRATION_CANCELEDโ the guest is running after migration abort ๐ธSys::Virt::Domain::STATE_RUNNING_RESTOREDโ the guest is running after restore from file ๐
Okay, picking up mid-lore: here are the rest of the domain state constants, bestie. These are literally the vibes your guest can be in, and the names tell you why it got there:
Sys::Virt::Domain::STATE_RUNNING_SAVE_CANCELEDโ the guest is running after the save got canceled. ๐Sys::Virt::Domain::STATE_RUNNING_UNKNOWNโ nobody knows why the domain started. Itโs a mystery, fr fr. ๐Sys::Virt::Domain::STATE_RUNNING_UNPAUSEDโ the guest is running after a resume.Sys::Virt::Domain::STATE_RUNNING_WAKEUPโ the guest is running after waking up from power management suspend. โจSys::Virt::Domain::STATE_RUNNING_CRASHEDโ the guest got restarted after crashing.Sys::Virt::Domain::STATE_RUNNING_POSTCOPYโ the guest is running, but post-copy is taking place.Sys::Virt::Domain::STATE_RUNNING_POSTCOPY_FAILEDโ the guest is running, but migration failed in post-copy. ๐ญSys::Virt::Domain::STATE_BLOCKED_UNKNOWNโ the guest is blocked for an unknown reason.Sys::Virt::Domain::STATE_SHUTDOWN_UNKNOWNโ it is not known why the domain has shutdown.Sys::Virt::Domain::STATE_SHUTDOWN_USERโ the guest is shutdown due to an admin request.Sys::Virt::Domain::STATE_SHUTOFF_CRASHEDโ the guest is shutoff after a crash.Sys::Virt::Domain::STATE_SHUTOFF_DESTROYEDโ the guest is shutoff after being destroyed.Sys::Virt::Domain::STATE_SHUTOFF_FAILEDโ the guest is shutoff due to a virtualization failure.Sys::Virt::Domain::STATE_SHUTOFF_FROM_SNAPSHOTโ the guest is shutoff after a snapshot.Sys::Virt::Domain::STATE_SHUTOFF_MIGRATEDโ the guest is shutoff after migration.Sys::Virt::Domain::STATE_SHUTOFF_SAVEDโ the guest is shutoff after a save.Sys::Virt::Domain::STATE_SHUTOFF_SHUTDOWNโ the guest is shutoff due to controlled shutdown.Sys::Virt::Domain::STATE_SHUTOFF_UNKNOWNโ it is not known why the domain has shutoff.Sys::Virt::Domain::STATE_SHUTOFF_DAEMONโ the daemon stopped the guest due to a failure.Sys::Virt::Domain::STATE_PMSUSPENDED_UNKNOWNโ it is not known why the domain was suspended to RAM.Sys::Virt::Domain::STATE_PMSUSPENDED_DISK_UNKNOWNโ it is not known why the domain was suspended to disk.
And now back to the methods, because we are absolutely not done slaying:
my $info = $dom->get_control_info($flags=0)โ gives you a hash reference with info about the control channel. The keys in that hash are:"state"โ one of theCONTROL INFOconstants listed later."details"โ currently unused, always0."stateTime"โ the elapsed time since the control channel entered the current state.
my $time = $dom->get_time($flags=0);โ gets the current time of the guest, in seconds and nanoseconds. The$flagsparameter is currently unused and defaults to zero. The return value is an array ref with two elements: the first contains the time in seconds, and the second contains the remaining nanoseconds. ๐ฐ๏ธ$dom->set_time($secs, $nsecs, $flags=0);โ sets the current time of the guest, in seconds and nanoseconds. The$flagsparameter accepts one of:"Sys::Virt::Domain::TIME_SYNC"โ re-sync domain time from the domain's RTC.
$dom->set_user_password($username, $password, $flags=0);โ updates the password for account$usernameto be$password.$passwordis the clear-text password string unless thePASSWORD_ENCRYPTEDflag is set."Sys::Virt::Domain::PASSWORD_ENCRYPTED"โ the$passwordis encrypted with the password scheme required by the guest OS.
$dom->rename($newname, $flags=0)โ changes the name of an inactive guest to be$newname. The$flagsparameter is currently unused and defaults to zero.my @errs = $dom->get_disk_errors($flags=0)โ returns a list of all disk errors that have occurred on the backing store for the guest's virtual disks. The returned array elements are hash references containing two keys:"path"โ the path of the disk with an error."error"โ the error type.
$dom->send_key($keycodeset, $holdtime, \@keycodes, $flags=0)โ sends a sequence of keycodes to the guest domain.$keycodesetshould be one of the constants listed later in theKEYCODE SETsection.$holdtiemis the duration, in milliseconds, to keep the key pressed before releasing it and sending the next keycode. (Yes, the page really spells it$holdtiemright there โ donโt come for me. ๐)@keycodesis an array reference containing the list of keycodes to send to the guest. The elements in the array should be keycode values from the specified keycode set.$flagsis currently unused.my $info = $dom->get_block_info($dev, $flags=0)โ returns a hash reference summarizing the disk usage of the host backing store for a guest block device. The$devparameter should be the path to the backing store on the host.$flagsis currently unused and defaults to0if omitted. The returned hash contains:capacityโ logical size in bytes of the block device backing image *allocationโ highest allocated extent in bytes of the block device backing image.physicalโ physical size in bytes of the container of the backing image.
$dom->set_max_memory($mem)โ sets the maximum memory for the domain to the value$mem. The value of the$memparameter is specified in kilobytes.$mem = $dom->get_max_memory()โ returns the current maximum memory allowed for this domain, in kilobytes.$dom->set_memory($mem, $flags)โ sets the current memory for the domain to the value$mem. The value of the$memparameter is specified in kilobytes. This must be less than or equal to the domain's max memory limit. The$flagsparameter can control whether the update affects the live guest or the inactive config, defaulting to modifying the current state.$dom->set_memory_stats_period($period, $flags)โ sets the period on which the guest's memory stats are refreshed, with$periodbeing a value in seconds. The$flagsparameter is currently unused.$dom->shutdown()โ requests that the guest OS perform a graceful shutdown and poweroff. This usually requires some form of cooperation from the guest operating system, such as responding to an ACPI signal or a guest agent process. For an immediate, forceful poweroff, use the"destroy"method instead. โ ๏ธ$dom->reboot([$flags])โ requests that the guest OS perform a graceful shutdown and optionally restart. The optional$flagsparameter is currently unused and, if omitted, defaults to zero.$dom->reset([$flags])โ performs a hardware reset of the virtual machine. The guest OS is given no opportunity to shutdown gracefully. The optional$flagsparameter is currently unused and, if omitted, defaults to zero.$dom->get_max_vcpus()โ returns the maximum number of vcpus that are configured for the domain.$dom->attach_device($xml[, $flags])โ hotplugs a new device whose configuration is given by$xml, to the running guest. The optional<$flags>parameter defaults to0, but can accept one of the device hotplug flags described later.$dom->detach_device($xml[, $flags])โ hotunplugs an existing device whose configuration is given by$xml, from the running guest. The optional<$flags>parameter defaults to0, but can accept one of the device hotplug flags described later.$dom->detach_device_alias($alias[, $flags])โ hotunplugs an existing device which is identified by$alias. The optional<$flags>parameter defaults to0, but can accept one of the device hotplug flags described later.$dom->update_device($xml[, $flags])โ updates the configuration of an existing device. The new configuration is given by$xml. The optional<$flags>parameter defaults to0, but can accept one of the device hotplug flags described later.$data = $dom->block_peek($path, $offset, $size[, $flags])โ peeks into the guest disk$path, at byte$offset, capturing$sizebytes of data. The returned scalar may contain embedded NULLs. The optional$flagsparameter is currently unused and, if omitted, defaults to zero.$data = $dom->memory_peek($offset, $size[, $flags])โ peeks into the guest memory at byte$offsetvirtual address, capturing$sizebytes of memory. The return scalar may contain embedded NULLs. The optional$flagsparameter is currently unused and, if omitted, defaults to zero.$flag = $dom->get_autostart();โ returns a true value if the guest domain is configured to automatically start upon boot. Returns false otherwise.$dom->set_autostart($flag)โ sets the state of the autostart flag, which determines whether the guest will automatically start upon boot of the host OS.$flag = $dom->get_autostart_once();โ provides a boolean value indicating whether the domain is configured to be automatically started the next time the host machine boots only.$dom->set_autostart_once($flag)โ configures the domain to be automatically started the next time the host machine boots only.$dom->set_vcpus($count, [$flags])โ sets the number of virtual CPUs in the guest VM to$count. The optional$flagsparameter can be used to control whether the setting changes the live config or the inactive config.$dom->set_vcpu($cpumap, $state, [$flags=0])โ sets the state of the CPUs in$cpumapto$state. The$flagsparameter accepts one or more of theSETVCPU OPTIONSconstants documented later, and defaults to0if omitted.$count = $dom->get_vcpus([$flags])โ gets the number of virtual CPUs in the guest VM. The optional$flagsparameter can be used to control whether to query the setting of the live config or the inactive config.$dom->set_guest_vcpus($cpumap, $state, [$flags=0])โ sets the online status of the guest OS CPUs. The$cpumapparameter describes the set of CPUs to modify (e.g."0-3,^1").$stateis either1to set the CPUs online, or0to set them offline. The$flagsparameter is currently unused and defaults to0.$info $dom->get_guest_vcpus([$flags=0])โ queries information about the guest OS CPUs. The returned data is a hash reference with the following keys:vcpusโ string containing bitmap representing CPU ids reported currently known to the guest.onlineโ string containing bitmap representing CPU ids that are currently online in the guest.offlinableโ string containing bitmap representing CPU ids that can be offlined in the guest.
The $flags parameter is currently unused and defaults to 0.
$type = $dom->get_scheduler_type()โ returns the scheduler type for the guest domain. ๐
๐พ $stats = $dom->block_stats($path)
Okay so this one grabs the current I/O stats for the block device at $path and hands you back a hash reference ๐
and the keys in it are:
rd_reqโ how many read requests went throughrd_bytesโ how many bytes got readwr_reqโ how many write requests went throughwr_bytesโ how many bytes got writtenerrsโ "some kind of error count" (the docs literally say some kind, so bestie, don't ask me for more detail than that ๐ญ)
๐ง my $params = $dom->get_scheduler_parameters($flags=0)
Returns the set of scheduler tunable parameters for the guest as a hash reference. Heads up tho: the exact keys in that hash are specific to the hypervisor โ so like, different hypervisors, different vibes, no cap ๐ฆ
โจ $dom->set_scheduler_parameters($params, $flags=0)
Updates the set of scheduler tunable parameters. The value names for tunables vary, and you can discover them using the get_scheduler_params call. (Yes, that name really does say params while the getter above says parameters โ that's the original's business, not mine, I'm just reporting it faithfully ๐)
๐ธ my $params = $dom->get_memory_parameters($flags=0)
Gives you a hash reference with the set of memory tunable parameters for the guest. The keys are one of the constants in MEMORY PARAMETERS, which is described later on in this doc. The $flags parameter accepts one or more of the CONFIG OPTION constants (also documented later), and defaults to 0 if you justโฆ don't โจ
๐ $dom->set_memory_parameters($params, $flags=0)
Updates the memory tunable parameters for the guest. $params should be a hash reference whose keys are one of the MEMORY PARAMETERS constants. Same deal with $flags: one or more CONFIG OPTION constants, defaults to 0 if omitted ๐
๐ my $params = $dom->get_blkio_parameters($flags=0)
Returns a hash reference with the set of blkio tunable parameters for the guest. Keys = one of the BLKIO PARAMETERS constants described later. $flags takes one or more CONFIG OPTION constants and defaults to 0 if you skip it ๐ซถ
๐ฅ $dom->set_blkio_parameters($params, $flags=0)
Updates the blkio tunable parameters for the guest. $params should be a hash reference whose keys are one of the BLKIO PARAMETERS constants. $flags โ you already know the drill โ one or more CONFIG OPTION constants, defaults to 0 ๐
โญ $stats = $dom->get_block_iotune($disk, $flags=0)
Returns a hash reference with the set of blkio tunable parameters for the guest disk $disk. The keys are one of the BLOCK IOTUNE PARAMETERS constants described later. It's giving "I know exactly which disk I'm obsessed with" energy ๐
๐ $dom->set_block_iotune($disk, $params, $flags=0);
Updates the blkio tunable parameters for the guest disk $disk. $params should be a hash reference whose keys are one of the BLOCK IOTUNE PARAMETERS constants. (Yup, the original's synopsis line really does end in a ; โ icon behaviour, keeping it ๐)
๐ฆ my $params = $dom->get_interface_parameters($intf, $flags=0)
Returns a hash reference with the set of interface tunable parameters for the guest. Keys are one of the INTERFACE PARAMETERS constants described later ๐
๐ $dom->set_interface_parameters($intf, $params, $flags=0)
Updates the interface tunable parameters for the guest. $params should be a hash reference whose keys are one of the INTERFACE PARAMETERS constants. Slay โจ
๐ง my $params = $dom->get_numa_parameters($flags=0)
Returns a hash reference with the set of numa tunable parameters for the guest. Keys = one of the NUMA PARAMETERS constants described later. $flags accepts one or more CONFIG OPTION constants and defaults to 0 if omitted ๐
๐ซ $dom->set_numa_parameters($params, $flags=0)
Updates the numa tunable parameters for the guest. $params should be a hash reference whose keys are one of the NUMA PARAMETERS constants. $flags: one or more CONFIG OPTION constants, defaults to 0 if omitted ๐ธ
๐ my $params = $dom->get_perf_events($flags=0)
Returns a hash reference containing the set of performance events available for the guest. Keys are one of the PERF EVENTS constants described later. $flags accepts one or more CONFIG OPTION constants, and defaults to 0 if omitted ๐ฅ
๐ฏ $dom->set_perf_events($params, $flags=0)
Updates the enabled state for performance events for the guest. $params should be a hash reference whose keys are one of the PERF EVENTS constants. $flags โ one or more CONFIG OPTION constants, defaults to 0 if omitted. Periodt ๐
๐ $dom->block_resize($disk, $newsize, $flags=0)
Resizes the disk $disk to have new size $newsize KB. And here's the important bit, bestie, so pay attention ๐ โ if the disk is backed by a special image format, the actual resize is done by the hypervisor. But if the disk is backed by a raw file, or block device, then the resize must be done prior to invoking this API call, and this call merely updates the hypervisor's view of the disk size. So like, do the actual resizing yourself first, this is just the announcement ๐
Flags you can use:
Sys::Virt::Domain::BLOCK_RESIZE_BYTESโ treat$newsizeas if it were in bytes, rather than KBSys::Virt::Domain::BLOCK_RESIZE_CAPACITYโ resize to full the capacity of the sourceSys::Virt::Domain::BLOCK_RESIZE_EXTENDโ disallow shrinking of the disk in size
๐ฐ๏ธ $dom->interface_stats($path)
Fetches the current I/O statistics for the block device given by $path. (Yes, the original says "block device" right here in the interface stats entry โ I'm not gonna gaslight you and pretend it says network interface, I'm telling you exactly what it says ๐ต) The returned hash contains keys for:
rx_bytesโ total bytes receivedrx_packetsโ total packets receivedrx_errsโ total packets received with errorsrx_dropโ total packets drop at receptiontx_bytesโ total bytes transmittedtx_packetsโ total packets transmittedtx_errsโ total packets transmitted with errorstx_dropโ total packets dropped at transmission
๐ง $dom->memory_stats($flags=0)
Fetches the current memory statistics for the guest domain. The $flags parameter is currently unused and can be omitted entirely (it's giving filler episode, honestly ๐). The returned hash contains keys for:
swap_inโ data read from swap spaceswap_outโ data written to swap spacemajor_faultโ page fault involving disk I/Ominor_faultโ page fault not involving disk I/Ounusedโ memory not used by the systemavailableโ total memory seen by guestrssโ resident set size: size of memory resident in host RAM
๐ $info = $dom->get_security_label()
Fetches info about the security label assigned to the guest domain. The returned hash reference has two keys: model gives the name of the security model in effect (e.g. selinux), while label provides the name of the security label applied to the domain. Important caveat tho โ this method only returns info about the first security label. If you want all of them, use get_security_label_list ๐
๐ท๏ธ @info = $dom->get_security_label_list()
Fetches info about all security labels assigned to the guest domain. Every element in the returned array is a hash reference, with keys exactly as described for get_security_label. So like, the full collection, no crumbs left behind โจ
๐ $ddom = $dom->migrate(destcon, \%params, flags=0)
Moves a domain to a whole other host โ main character relocation arc ๐ The destcon parameter should be a Sys::Virt connection to the remote target host. The flags parameter takes one or more of the Sys::Virt::Domain::MIGRATE_XXX constants described later in this document. And %params is a hash reference used to set various parameters for the migration operation, with these valid keys:
Sys::Virt::Domain::MIGRATE_PARAM_URIโ the URI to use for initializing the domain migration. It takes a hypervisor specific format. Theuri_transportselement of the hypervisor capabilities XML includes details of the supported URI schemes. When omitted, libvirt will auto-generate a suitable default URI. It's typically only necessary to specify this URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data.Sys::Virt::Domain::MIGRATE_PARAM_DEST_NAMEโ the name to be used for the domain on the destination host. Omitting this parameter keeps the domain name the same. This field is only allowed to be used with hypervisors that support domain renaming during migration.Sys::Virt::Domain::MIGRATE_PARAM_DEST_XMLโ the new configuration to be used for the domain on the destination host. The configuration must include an identical set of virtual devices, to ensure a stable guest ABI across migration. Only parameters related to host side configuration can be changed in the XML. Hypervisors which support this field will forbid migration if the provided XML would cause a change in the guest ABI. This field cannot be used to rename the domain during migration (use theVIR_MIGRATE_PARAM_DEST_NAMEfield for that purpose). Domain name in the destination XML must match the original domain name.
Omitting this parameter keeps the original domain configuration. Using this field with hypervisors that do not support changing domain configuration during migration will result in a failure โ so like, vibe check your hypervisor first ๐
Sys::Virt::Domain::MIGRATE_PARAM_GRAPHICS_URIโ URI to use for migrating client's connection to the domain's graphical console asVIR_TYPED_PARAM_STRING. If specified, the client will be asked to automatically reconnect using these parameters instead of the automatically computed ones. This can be useful if, e.g., the client does not have direct access to the network the virtualization hosts are connected to and needs to connect through a proxy. The URI is formed as follows:
protocol://hostname[:port]/[?parameters]
where protocol is either spice or vnc and parameters is a list of protocol specific parameters separated by &. Currently recognized parameters are tlsPort and tlsSubject. For example,
spice://target.host.com:1234/?tlsPort=4567
Sys::Virt::Domain::MIGRATE_PARAM_BANDWIDTHโ the maximum bandwidth (in MiB/s) that will be used for migration. If set to0or omitted, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if this field is used and is not0๐
Sys::Virt::Domain::MIGRATE_PARAM_BANDWIDTH_POSTCOPYโ the max bandwidth (in MiB/s) that migration gets to use during the post-copy phase ๐โโ๏ธ๐จ. If you set it to0or just... don't, libvirt picks a suitable default for you. Heads up tho: some hypervisors literally don't support this feature and will throw an error if this field is used and isn't0๐.Sys::Virt::Domain::MIGRATE_PARAM_LISTEN_ADDRESSโ the address to listen on for incoming migration connections ๐ง. If you omit it, libvirt listens on the wildcard address (0.0.0.0or::). And ngl, that default may be a security risk if guests or other untrusted users can connect to the virtualization host โ so an explicit restricted listen address is recommended, bestie. Protect yourself ๐ .Sys::Virt::Domain::MIGRATE_PARAM_DISK_PORTโ the port the destination server should use for incoming disks migration ๐. Type isVIR_TYPED_PARAM_INT. If set to0or omitted, libvirt chooses a suitable default. At the moment this is only supported by the QEMU driver, iykyk.Sys::Virt::Domain::MIGRATE_PARAM_MIGRATE_DISKSโ the list of disks to migrate when you're doing block storage migration ๐พ. And this one's a lil different from the other params: instead of a plain string, the value should be an array reference, whose elements are in turn strings representing the disk target names. Slay.Sys::Virt::Domain::MIGRATE_PARAM_COMPRESSIONโ the type of compression method to use, either"xbzrle"or"mt"๐๏ธโจ.Sys::Virt::Domain::MIGRATE_PARAM_COMPRESSION_MT_THREADSโ the number of compression threads ๐งต.Sys::Virt::Domain::MIGRATE_PARAM_COMPRESSION_MT_DTHREADSโ the number of decompression threads ๐งต (the de- version, obviously).Sys::Virt::Domain::MIGRATE_PARAM_COMPRESSION_MT_LEVELโ the compression level, from0(no compression) to9(maximum compression) ๐.Sys::Virt::Domain::MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHEโ the size of the cache for xbzrle compression ๐๏ธ.Sys::Virt::Domain::MIGRATE_PARAM_PERSIST_XMLโ the alternative persistent XML config to copy ๐.Sys::Virt::Domain::MIGRATE_PARAM_AUTO_CONVERGE_INITIALโ the initial percentage to throttle guest vCPUs ๐ข.Sys::Virt::Domain::MIGRATE_PARAM_AUTO_CONVERGE_INCREMENTโ the additional percentage step size to throttle guest vCPUs if progress is not made ๐.Sys::Virt::Domain::MIGRATE_PARAM_PARALLEL_CONNECTIONSโ the number of connections used during parallel migration ๐๐.Sys::Virt::Domain::MIGRATE_PARAM_TLS_DESTINATIONโ override the destination host name used for TLS verification ๐. So usually the TLS certificate from the destination host has to match the host's name for TLS verification to succeed. But when the certificate doesn't match the destination hostname and you do know the expected certificate's hostname, this parameter lets you pass that expected hostname when starting the migration. Crisis averted ๐ซถ.Sys::Virt::Domain::MIGRATE_PARAM_DISKS_URIโ the URI to use for initializing the domain migration for storage ๐บ๏ธ. It takes a hypervisor specific format. Theuri_transportselement of the hypervisor capabilities XML includes details of the supported URI schemes. When omitted, libvirt auto-generates a suitable default URI. It's typically only necessary to specify this URI if the destination host has multiple interfaces and a specific interface is required to transmit storage data. Fancy ๐ .Sys::Virt::Domain::MIGRATE_PARAM_ZLIB_LEVELโ the level of compression for zlib. Accepted values are in the range0-9.0is no compression,1is maximum speed, and9is maximum compression โก.Sys::Virt::Domain::MIGRATE_PARAM_ZSTD_LEVELโ the level of compression for zstd. Accepted values are in the range0-20.0is no compression,1is maximum speed, and20is maximum compression ๐ฅ.Sys::Virt::Domain::MIGRATE_PARAM_DISKS_DETECT_ZEROESโ enable zero detection on a list of disks so you avoid transferring zero blocks ๐ณ๏ธ. And this one comes with an actual warning, bestie:
Users must ensure that any pre-created storage source on the destination will be cleared and thus read all-zeroes before using this feature โ otherwise the destination image may become corrupted ๐ญ. Like, fr fr, don't skip that.
Same deal as MIGRATE_PARAM_MIGRATE_DISKS: instead of a plain string, the value should be an array reference, whose elements are in turn strings representing the disk target names.
Sys::Virt::Domain::MIGRATE_PARAM_BANDWIDTH_AVAIL_SWITCHOVERโ the max bandwidth (in MiB/s) that will be used for migration during the switchover phase ๐. If set to0or omitted, QEMU will estimate a suitable default. Iconic of QEMU tbh.Sys::Virt::Domain::MIGRATE_PARAM_MIGRATE_DISKS_TARGET_ZEROโ list of target disks that can be assumed to be initialized to all zeros ๐ซง.
$ddom = $dom->migrate(destcon, flags=0, dname=undef, uri=undef,
bandwidth=0)
Migrate a domain to an alternative host ๐ฆ. The way that using positional parameters with migrate is deprecated in favour of passing a hash reference as described above โ so use the hash ref, bestie, the positional thing is giving legacy ๐.
$ddom = $dom->migrate2(destcon, dxml, flags, dname, uri, bandwidth)
Migrate a domain to an alternative host. This method is deprecated in favour of passing a hash ref to migrate. Yeah, it's old news ๐.
$ddom = $dom->migrate_to_uri(desturi, \%params, flags=0)
Migrate a domain to an alternative host. The desturi parameter should be a valid libvirt connection URI for the remote target host ๐. The flags parameter takes one or more of the Sys::Virt::Domain::MIGRATE_XXX constants described later in this document. The %params parameter is a hash reference used to set various parameters for the migration operation, with the same keys described for the migrate API. Chef's kiss ๐
$dom->migrate_to_uri(desturi, flags, dname, bandwidth)
Migrate a domain to an alternative host. Use of positional parameters with migrate_to_uri is deprecated in favour of passing a hash reference as described above. Same energy as before, pls stop using positional args ๐ญ.
$dom->migrate_to_uri2(dconnuri, miguri, dxml, flags, dname, bandwidth)
Migrate a domain to an alternative host. This method is deprecated in favour of passing a hash ref to migrate_to_uri. It's giving old era โจ.
$dom->migrate_set_max_downtime($downtime, $flags=0)
Set the maximum allowed downtime during migration of the guest โธ๏ธ. A longer downtime makes it more likely that migration will complete, at the cost of longer time blackout for the guest OS at the switch over point. The downtime parameter is measured in milliseconds. The $flags parameter is currently unused and defaults to zero.
$downtime = $dom->migrate_get_max_downtime($flags=0)
Get the current value of the maximum downtime allowed during a migration of a guest. The returned <downtime> value is measured in milliseconds โฑ๏ธ. The $flags parameter is currently unused and defaults to zero.
$dom->migrate_set_max_speed($bandwidth, $flags=0)
Set the maximum allowed bandwidth during migration of the guest ๐. The bandwidth parameter is measured in MB/second. The $flags parameter takes zero or more of the constants:
$Sys::Virt::Domain::MIGRATE_MAX_SPEED_POSTCOPYโ set the post-copy speed instead of the pre-copy speed ๐.
$bandwidth = $dom->migrate_get_max_speed($flags=0)
Get the maximum allowed bandwidth during migration of the guest. The returned <bandwidth> value is measured in MB/second. The $flags parameter accepts the same constants as migrate_set_max_speed ๐.
$dom->migrate_set_compression_cache($cacheSize, $flags=0)
Set the maximum allowed compression cache size during migration of the guest ๐๏ธ. The cacheSize parameter is measured in bytes. The $flags parameter is currently unused and defaults to zero.
$cacheSize = $dom->migrate_get_compression_cache($flags=0)
Get the maximum allowed compression cache size during migration of the guest. The returned <bandwidth> value is measured in bytes โ and yes, the doc really does call it <bandwidth> there, that's what it says, copying it verbatim ๐ซ . The $flags parameter is currently unused and defaults to zero.
$dom->migrate_start_post_copy($flags=0)
Switch the domain from pre-copy to post-copy mode ๐. This requires that the original migrate command had the Sys::Virt::Domain::MIGRATE_POST_COPY flag specified. No flag, no switch, that's the rule โ.
$dom->inject_nmi($flags)
Trigger an NMI in the guest virtual machine ๐ฅ. The $flags parameter is currently unused and defaults to 0.
$dom->open_console($st, $devname, $flags)
Open the text console for a serial, parallel or paravirt console device identified by $devname, connecting it to the stream $st ๐ฅ๏ธ. If $devname is undefined, the default console will be opened. $st must be a Sys::Virt::Stream object used for bi-directional communication with the console. $flags is currently unused, defaulting to 0.
$dom->open_channel($st, $devname, $flags)
Open the text console for a data channel device identified by $devname, connecting it to the stream $st ๐ก. $st must be a Sys::Virt::Stream object used for bi-directional communication with the channel. $flags is currently unused, defaulting to 0.
$dom->open_graphics($idx, $fd, $flags)
Open the graphics console for a guest, identified by $idx, counting from 0 ๐จ. The $fd should be a file descriptor for an anonymous socket pair. The $flags argument should be one of the constants listed at the end of this document, and defaults to 0.
$fd = $dom->open_graphics_fd($idx, $flags)
Open the graphics console for a guest, identified by $idx, counting from 0. The $flags argument should be one of the constants listed at the end of this document, and defaults to 0. The return value will be a file descriptor connected to the console which must be closed when no longer needed ๐ช. And this method is preferred over open_graphics since it will work correctly under sVirt mandatory access control policies. The upgrade u deserve ๐.
my $mimetype = $dom->screenshot($st, $screen, $flags)
Capture a screenshot of the virtual machine's monitor ๐ธ. The $screen parameter controls which monitor is captured when using a multi-head or multi-card configuration. $st must be a Sys::Virt::Stream object from which the data can be read. $flags is currently unused and defaults to 0. The mimetype of the screenshot is returned ๐ผ๏ธโจ.
@vcpuinfo = $dom->get_vcpu_info($flags=0)
Bestie, this one grabs the tea on every vCPU in a running guest domain. You get back a list with one element per vCPU, and each element is a hash reference. The hash keys are: number โ the vCPU number; cpu โ the physical CPU where that vCPU is currently scheduled; cpuTime โ the cumulative execution time of the vCPU; state โ the running state; and affinity โ the allowed scheduler placement. The affinity value is a string representing a bitmask against physical CPUs, 8 cpus per character. To extract the bits, use the unpack function with the b* template โจ.
NB: thestate,cpuTime, andcpuvalues are only available if you use a$flagsvalue of0and the domain is currently running. Otherwise theyโll all be set to zero. No cap, thatโs just how it is ๐ .
$dom->pin_vcpu($vcpu, $mask)
Pins the virtual CPU given by index $vcpu to the physical CPUs given by $mask. The $mask is a string representing a bitmask against physical CPUs, 8 cpus per character. Lock it in, bestie ๐
$mask = $dom->get_emulator_pin_info()
Gets the CPU affinity info for the emulator process, slay. The returned $mask is a bitstring against physical CPUs, 8 cpus per character. To extract the bits, use the unpack function with the b* template ๐.
$dom->pin_emulator($newmask, $flags=0)
Pins the emulator threads to the physical CPUs identified by the affinity in $newmask. The $newmask is a bitstring against the physical CPUa, 8 cpus per character. To create a suitable bitstring, use the vec function with a value of 1 for the BITS parameter. Emulator threads? Pinned. Periodt ๐ง
@iothreadinfo = $dom->get_iothread_info($flags=0)
IOThread info incoming! This checks the state of all IOThreads in a running guest domain. The returned list has one element for each IOThread, and each element is a hash reference. The keys are: number โ the IOThread number; and affinity โ the allowed scheduler placement. The affinity value is a string representing a bitmask against physical CPUs, 8 cpus per character. To extract the bits, use the unpack function with the b* template. iykyk ๐
$dom->pin_iothread($iothread, $mask)
Pins the IOThread given by index $iothread to the physical CPUs given by $mask. The $mask is a string representing a bitmask against physical CPUs, 8 cpus per character. Another one pinned, no biggie ๐
$dom->add_iothread($iothread, $flags=0)
Adds a new IOThread by the $iothread value to the guest domain. The $flags parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. New thread, who dis? ๐ฆ
$dom->del_iothread($iothread, $flags=0)
Deletes an existing IOThread by the $iothread value from the guest domain. The $flags parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. Bye-bye, IOThread ๐
$dom->set_iothread($iothread, $params, $flags=0)
Sets parameters for the IOThread by the $iothread value on the guest domain. The $params parameter is a hash reference whose keys are the IOTHREAD STATS constants documented later. The $flags parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. Customizing the vibe check โ๏ธ
my @stats = $dom->get_cpu_stats($startCpu, $numCpus, $flags=0)
Requests the guests host physical CPU usage statistics, starting from host CPU $startCpu and counting up to $numCpus. If $startCpu is -1 and $numCpus is 1, then the utilization across all CPUs is returned. Returns an array of hash references, each element containing stats for one CPU. Number-crunching era ๐ข
my $info = $dom->get_job_info()
Returns a hash reference summarising the execution state of the background job. The elements of the hash are as follows:
typeโ The type of job, one of the JOB TYPE constants listed later in this document.timeElapsedโ The elapsed time in milliseconds.timeRemainingโ The expected remaining time in milliseconds. Only set if thetypeisJOB_UNBOUNDED.dataTotalโ The total amount of data expected to be processed by the job, in bytes.dataProcessedโ The current amount of data processed by the job, in bytes.dataRemainingโ The expected amount of data remaining to be processed by the job, in bytes.memTotalโ The total amount of memory expected to be processed by the job, in bytes.memProcessedโ The current amount of memory processed by the job, in bytes.memRemainingโ The expected amount of memory remaining to be processed by the job, in bytes.fileTotalโ The total amount of file expected to be processed by the job, in bytes.fileProcessedโ The current amount of file processed by the job, in bytes.fileRemainingโ The expected amount of file remaining to be processed by the job, in bytes.
Job info? We got it. Obsessed ๐ซถ
my ($type, $stats) = $dom->get_job_stats($flags=0)
Returns an array summarising the execution state of the background job. The $type value is one of the JOB TYPE constants listed later in this document. The $stats value is a hash reference, whose elements are one of the following constants.
typeโ The type of job, one of the JOB TYPE constants listed later in this document.- The
$flagsparameter defaults to zero and can take one of the following constants. Sys::Virt::Domain::JOB_STATS_COMPLETEDโ Return the stats of the most recently completed job.Sys::Virt::Domain::JOB_STATS_KEEP_COMPLETEDโ Don't clear the completed stats after reading them.
- The
Sys::Virt::Domain::JOB_TIME_ELAPSEDโ The elapsed time in milliseconds.Sys::Virt::Domain::JOB_TIME_ELAPSED_NETโ Time in milliseconds since the beginning of the migration job NOT including the time required to transfer control flow from the source host to the destination host.Sys::Virt::Domain::JOB_TIME_REMAININGโ The expected remaining time in milliseconds. Only set if thetypeisJOB_UNBOUNDED.Sys::Virt::Domain::JOB_DATA_TOTALโ The total amount of data expected to be processed by the job, in bytes.Sys::Virt::Domain::JOB_DATA_PROCESSEDโ The current amount of data processed by the job, in bytes.Sys::Virt::Domain::JOB_DATA_REMAININGโ The expected amount of data remaining to be processed by the job, in bytes.Sys::Virt::Domain::JOB_MEMORY_TOTALโ The total amount of memory expected to be processed by the job, in bytes.Sys::Virt::Domain::JOB_MEMORY_PROCESSEDโ The current amount of memory processed by the job, in bytes.Sys::Virt::Domain::JOB_MEMORY_REMAININGโ The expected amount of memory remaining to be processed by the job, in bytes.Sys::Virt::Domain::JOB_MEMORY_CONSTANTโ The number of pages filled with a constant byte which have been transferred.Sys::Virt::Domain::JOB_MEMORY_NORMALโ The number of pages transferred without any compression.Sys::Virt::Domain::JOB_MEMORY_NORMAL_BYTESโ The number of bytes transferred without any compression.Sys::Virt::Domain::JOB_MEMORY_BPSโ The bytes per second transferred.Sys::Virt::Domain::JOB_MEMORY_DIRTY_RATEโ The number of memory pages dirtied per second.Sys::Virt::Domain::JOB_MEMORY_PAGE_SIZEโ The memory page size in bytes.Sys::Virt::Domain::JOB_MEMORY_ITERATIONโ The total number of iterations over guest memory.Sys::Virt::Domain::JOB_MEMORY_POSTCOPY_REQSโ The number of page requests received from the destination host during post-copy migration.Sys::Virt::Domain::JOB_DISK_TOTALโ The total amount of file expected to be processed by the job, in bytes.Sys::Virt::Domain::JOB_DISK_PROCESSEDโ The current amount of file processed by the job, in bytes.Sys::Virt::Domain::JOB_DISK_REMAININGโ The expected amount of file remaining to be processed by the job, in bytes.Sys::Virt::Domain::JOB_DISK_BPSโ The bytes per second transferred.Sys::Virt::Domain::JOB_AUTO_CONVERGE_THROTTLEโ The percentage by which vCPUs are currently throttled.Sys::Virt::Domain::JOB_COMPRESSION_CACHEโ The size of the compression cache in bytes.Sys::Virt::Domain::JOB_COMPRESSION_BYTESโ The number of compressed bytes transferred.Sys::Virt::Domain::JOB_COMPRESSION_PAGESโ The number of compressed pages transferred.Sys::Virt::Domain::JOB_COMPRESSION_CACHE_MISSESโ The number of changing pages not in compression cache.Sys::Virt::Domain::JOB_COMPRESSION_OVERFLOWโ The number of changing pages in the compression cache but sent uncompressed since the compressed page was larger than the non-compressed page.Sys::Virt::Domain::JOB_DOWNTIMEโ The number of milliseconds of downtime expected during migration switchover.Sys::Virt::Domain::JOB_DOWNTIME_NETโ Real measured downtime (ms) NOT including the time required to transfer control flow from the source host to the destination host.Sys::Virt::Domain::JOB_SETUP_TIMEโ The number of milliseconds of time doing setup of the job.Sys::Virt::Domain::JOB_OPERATIONโ The type of operation associated with the job.Sys::Virt::Domain::JOB_SUCCESSโ Whether the job was successfully completed.Sys::Virt::Domain::JOB_DISK_TEMP_TOTALโ Possible total temporary disk space for the job in bytes.Sys::Virt::Domain::JOB_DISK_TEMP_USEDโ Current total temporary disk space for the job in bytes.Sys::Virt::Domain::JOB_ERRMSGโ The error message from a failed job.Sys::Virt::Domain::JOB_VFIO_DATA_TRANSFERREDโ Total data transferred for VFIO devices.
The values for the Sys::Virt::Domain::JOB_OPERATION field are:
Sys::Virt::Domain::JOB_OPERATION_UNKNOWNโ No known job type.Sys::Virt::Domain::JOB_OPERATION_STARTโ The guest is starting.Sys::Virt::Domain::JOB_OPERATION_SAVEโ The guest is saving to disk.Sys::Virt::Domain::JOB_OPERATION_RESTOREโ The guest is restoring from disk.Sys::Virt::Domain::JOB_OPERATION_MIGRATION_INโ The guest is migrating in from another host.Sys::Virt::Domain::JOB_OPERATION_MIGRATION_OUTโ the guest is migrating out to another host ๐ฆSys::Virt::Domain::JOB_OPERATION_SNAPSHOTโ the guest is saving a snapshot ๐ธSys::Virt::Domain::JOB_OPERATION_SNAPSHOT_REVERTโ the guest is reverting to a snapshot โชSys::Virt::Domain::JOB_OPERATION_DUMPโ the guest is saving a crash dump ๐Sys::Virt::Domain::JOB_OPERATION_BACKUPโ the guest is performing a block backup ๐Sys::Virt::Domain::JOB_OPERATION_SNAPSHOT_DELETEโ the guest is deleting a snapshot ๐๏ธ
$dom->abort_job($flags=0)
Aborts whatever job is currently running. Like, right now. The valid $flags are:
Sys::Virt::Domain::DOMAIN_ABORT_JOB_POSTCOPYโ interrupt post-copy migration. The good news? It can be resumed later using the migrate APIs with the"MIGRATE_POSTCOPY_RESUME"flag. So it's not a permanent goodbye, bestie ๐ซถ
my $info = $dom->get_block_job_info($path, $flags=0)
Hands you back a hash reference that summarises the execution state of the block job โจ The $path parameter should be the fully qualified path of the block device that's being changed. Valid $flags include:
Sys::Virt::Domain::BLOCK_JOB_INFO_BANDWIDTH_BYTESโ treat the bandwidth value as bytes instead of MiB.
$dom->set_block_job_speed($path, $bandwidth, $flags=0)
Change the maximum I/O bandwidth used by the block job currently executing for $path. The $bandwidth argument is specified in MB/s. The $flags parameter can take the bitwise union of these values:
Sys::Virt::Domain::BLOCK_JOB_SPEED_BANDWIDTH_BYTESโ the$bandwidthvalue is measured in bytes/s instead of MB/s.
$dom->abort_block_job($path, $flags=0)
Abort the current job that's executing for the block device associated with $path. Bye job ๐
$dom->block_pull($path, $bandwidth, $flags=0)
Merge the backing files associated with $path into the top level file ๐ธ The $bandwidth parameter specifies the maximum I/O rate to allow, in MB/s. The $flags parameter can take the bitwise union of these values:
Sys::Virt::Domain::BLOCK_PULL_BANDWIDTH_BYTESโ the$bandwidthvalue is measured in bytes/s instead of MB/s.
$dom->block_rebase($path, $base, $bandwidth, $flags=0)
Switch the backing path associated with $path to instead use $base โ glow-up for your backing chain ๐
The $bandwidth parameter specifies the maximum I/O rate to allow, in MB/s. The $flags parameter can take the bitwise union of these values:
Sys::Virt::Domain::BLOCK_REBASE_BANDWIDTH_BYTESโ the$bandwidthvalue is measured in bytes/s instead of MB/s.
$dom->block_copy($path, $destxml, $params, $flags=0)
Copy the contents of a disk image $path into the target volume described by $destxml, which follows the schema of the <disk> element in the domain XML ๐ The $params parameter is a hash of optional parameters to control the process:
Sys::Virt::Domain::BLOCK_COPY_BANDWIDTHโ the maximum bandwidth in bytes per second.Sys::Virt::Domain::BLOCK_COPY_GRANULARITYโ the granularity in bytes of the copy process.Sys::Virt::Domain::BLOCK_COPY_BUF_SIZEโ the maximum amount of data in flight in bytes.
$dom->block_commit($path, $base, $top, $bandwidth, $flags=0)
Commit the changes that were made to the temporary top level file $top. It takes all the differences between $top and $base and merges them into $base ๐ง The $bandwidth parameter specifies the maximum I/O rate to allow, in MB/s. The $flags parameter can take the bitwise union of these values:
Sys::Virt::Domain::BLOCK_COMMIT_BANDWIDTH_BYTESโ the$bandwidthvalue is measured in bytes instead of MB/s.
$count = $dom->num_of_snapshots()
Return the number of saved snapshots for the domain. Just the count, no vibes attached ๐ข
@names = $dom->list_snapshot_names()
List the names of all saved snapshots โจ Those names can be used with "lookup_snapshot_by_name".
@snapshots = $dom->list_snapshots()
Return a list of all snapshots currently known to the domain. The elements in the returned list are instances of the Sys::Virt::DomainSnapshot class. Heads up though: this method requires O(n) RPC calls, so the "list_all_snapshots" method is recommended as the more efficient alternative ๐โโ๏ธ๐จ
my @snapshots = $dom->list_all_snapshots($flags)
Return a list of all domain snapshots associated with this domain. The elements in the returned list are instances of the Sys::Virt::DomainSnapshot class. The $flags parameter can be used to filter the list of returned domain snapshots ๐ฅ
my $snapshot = $dom->get_snapshot_by_name($name)
Return the domain snapshot whose name is $name. The returned object is an instance of the Sys::Virt::DomainSnapshot class ๐ฆ
$dom->has_current_snapshot()
Returns a true value if the domain has a currently active snapshot. A yes/no vibe check ๐ซถ
$snapshot = $dom->current_snapshot()
Returns the currently active snapshot for the domain โ the main character snapshot, if you will ๐
$snapshot = $dom->create_snapshot($xml[, $flags])
Create a new snapshot from the $xml. The $flags parameter accepts the SNAPSHOT CREATION constants listed in "Sys::Virt::DomainSnapshots" ๐ธ
my @checkpoints = $dom->list_all_checkpoints($flags)
Return a list of all domain checkpoints associated with this domain. The elements in the returned list are instances of the Sys::Virt::DomainCheckpoint class. The $flags parameter can be used to filter the list of returned domain checkpoints ๐
my $checkpoint = $dom->get_checkpoint_by_name($name)
Return the domain checkpoint whose name is $name. The returned object is an instance of the Sys::Virt::DomainCheckpoint class ๐
$checkpoint = $dom->create_checkpoint($xml[, $flags])
Create a new checkpoint from the $xml. The $flags parameter accepts the CHECKPOINT CREATION constants listed in "Sys::Virt::DomainCheckpoints" โญ
$dom->backup_begin($backupxml, $checkpointxml=undef, $flags=0);
Start a point-in-time backup job for the specified disks of a running domain ๐ The $backupxml parameter describes the backup operation, including which disks to use. The optional $checkpointxml parameter can be used to create a checkpoint covering the same point in time as the backup. The optional $flags parameter can be one of these constants:
Sys::Virt::Domain::BACKUP_BEGIN_REUSE_EXTERNALโ assume that the output/temporary files for the backup have already been precreated by the caller, with the correct size and format.Sys::Virt::Domain::BACKUP_BEGIN_PRESERVE_SHUTDOWN_DOMAINโ preserve the domain if the guest OS shuts down while the backup is running.
$xml = $dom->backup_get_xml_description($flags=0);
Get the XML description of the currently executing backup job โจ But if there's no backup job running? An error is raised. No job, no XML, periodt ๐ญ
$dom->fs_trim($mountPoint, $minimum, $flags=0);
Issue an FS_TRIM command to the device at $mountPoint to remove chunks of unused space that are at least $minimum bytes in length ๐งน $flags is currently unused and defaults to zero.
$dom->fs_freeze(\@mountPoints, $flags=0);
Freeze all the filesystems associated with the @mountPoints array reference ๐ง If @mountPoints is an empty list, then all filesystems will be frozen. $flags is currently unused and defaults to zero.
$dom->fs_thaw(\@mountPoints, $flags=0);
Thaw all the filesystems associated with the @mountPoints array reference ๐ฅ If @mountPoints is an empty list, then all filesystems will be thawed. $flags is currently unused and defaults to zero.
@fslist = $dom->get_fs_info($flags=0);
Obtain a list of all guest filesystems. The returned list contains one element per filesystem, and each value is a hash reference with these keys ๐
nameโ the name of the guest device that is mounted.fstypeโ the filesystem type (e.g.'ext4','fat','ntfs', etc).mountpointโ the location in the filesystem tree of the mount.devaliasโ an array reference containing the list of device aliases associated with the guest device. These device aliases correspond to disk target names in the guest XML configuration.
@nics = $dom->get_interface_addresses($src, $flags=0);
Obtain a list of all guest network interfaces ๐ The $src parameter is one of these constants:
Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_LEASEโ extract the DHCP server lease information.Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_AGENTโ query the guest OS via an agent.Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_ARPโ extract from the local ARP tables.
The returned list contains one element for each interface. Each value in the list is a hash reference with these keys:
nameโ the name of the guest interface that is mounted.hwaddrโ the hardware address, aka MAC, if available.addrsโ an array reference containing the list of IP addresses associated with the guest NIC. Each element in that array is a further hash containing:addrโ the IP address string.prefixโ the IP address network prefix.typeโ the IP address type (IPv4 vs IPv6).
$dom->send_process_signal($pid, $signum, $flags=0);
Send the process $pid the signal $signum ๐ Real talk though: the $signum value must be one of the constants listed later, not a POSIX or Linux signal value. Don't try it, bestie. $flags is currently unused and defaults to zero.
$dom->set_block_threshold($dev, $threshold, $flags=0);
Set the threshold level for delivering EVENT_ID_BLOCK_THRESHOLD if the device or backing chain element described by $dev gets written beyond the set $threshold level ๐จ The threshold level is unset once the event fires. And ngl, the event might not be delivered at all if libvirtd was not running at the moment when the threshold was reached ๐ญ
$dom->set_lifecycle_action($type, $action, $flags=0)
Changes the actions of lifecycle events for the domain, represented as <on_$type>$action</on_$type> in the domain XML ๐ธ
$info = $dom->get_launch_security_info($flags=0)
Get information about the domain launch security policy ๐ $flags is currently unused and defaults to zero. The returned hash may contain these keys:
Sys::Virt::Domain::LAUNCH_SECURITY_SEV_MEASUREMENTโ the AMD SEV launch measurement.Sys::Virt::Domain::LAUNCH_SECURITY_SEV_API_MAJORโ the host SEV API major version.Sys::Virt::Domain::LAUNCH_SECURITY_SEV_API_MINORโ the host SEV API minor version.Sys::Virt::Domain::LAUNCH_SECURITY_SEV_BUILD_IDโ the host SEV firmware build ID ๐ ๏ธSys::Virt::Domain::LAUNCH_SECURITY_SEV_POLICYโ the guest SEV policySys::Virt::Domain::LAUNCH_SECURITY_SEV_SNP_POLICYโ the guest SEV-SNP policy
๐
$dom->set_launch_security_state(\%params, $flags=0)
okay so this one sets info about the domain launch security state. and listen โ $flags is currently unused and defaults to zero, so literally just leave it alone bestie, it's giving decorative.
The hash you pass in may contain these keys โจ
Sys::Virt::Domain::LAUNCH_SECURITY_SEV_SECRETโ the SEV secret string to inject ๐คซSys::Virt::Domain::LAUNCH_SECURITY_SEV_SECRET_HEADERโ the SEV secret header string to injectSys::Virt::Domain::LAUNCH_SECURITY_SEV_SECRET_SET_ADDRESSโ the address at which to inject the SEV secret. and if you omit it? no stress, it can be automatically determined from the firmware ๐ง
๐ฆ $info = $dom->get_guest_info($types, $flags=0)
Get info about the domain guest configuration, periodt. The $types parameter is the main character here โ it decides what pieces of information come back, and you build it by bitwise-or-ing these constants together ๐
Sys::Virt::Domain::GUEST_INFO_USERSโ active user information ๐ซถ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_USER_COUNTโ the number of active users on this domain, as an unsigned int.Sys::Virt::Domain::GUEST_INFO_USER_PREFIXโ the parameter name prefix to access each user entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the user suffix parameters to form a complete parameter name.Sys::Virt::Domain::GUEST_INFO_USER_SUFFIX_NAMEโ username of the user, as a string.Sys::Virt::Domain::GUEST_INFO_USER_SUFFIX_DOMAINโ domain of the user, as a string (may only be present on certain guest types ๐).Sys::Virt::Domain::GUEST_INFO_USER_SUFFIX_LOGIN_TIMEโ the login time of a user, in milliseconds since the epoch, as unsigned long long.
Sys::Virt::Domain::GUEST_INFO_OSโ misc operating system information ๐ป The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_OS_IDโ a string identifying the operating system.Sys::Virt::Domain::GUEST_INFO_OS_NAMEโ the name of the operating system, suitable for presentation to a user, as a string.Sys::Virt::Domain::GUEST_INFO_OS_PRETTY_NAMEโ a pretty name for the operating system, suitable for presentation to a user, as a string. (pretty name!! she understood the assignment ๐ )Sys::Virt::Domain::GUEST_INFO_OS_VERSIONโ the version of the operating system, suitable for presentation to a user, as a string.Sys::Virt::Domain::GUEST_INFO_OS_VERSION_IDโ the version id of the operating system, suitable for processing by scripts, as a string.Sys::Virt::Domain::GUEST_INFO_OS_KERNEL_RELEASEโ the release of the operating system kernel, as a string.Sys::Virt::Domain::GUEST_INFO_OS_KERNEL_VERSIONโ the version of the operating system kernel, as a string.Sys::Virt::Domain::GUEST_INFO_OS_MACHINEโ the machine hardware name, as a string.Sys::Virt::Domain::GUEST_INFO_OS_VARIANTโ a specific variant or edition of the operating system, suitable for presentation to a user, as a string.Sys::Virt::Domain::GUEST_INFO_OS_VARIANT_IDโ the id for a specific variant or edition of the operating system, as a string.
Sys::Virt::Domain::GUEST_INFO_TIMEZONEโ the guest timezone ๐ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_TIMEZONE_NAMEโ the name of the timezone, as a string.Sys::Virt::Domain::GUEST_INFO_TIMEZONE_OFFSETโ the offset to UTC in seconds, as an int.
Sys::Virt::Domain::GUEST_INFO_HOSTNAMEโ the guest hostname ๐ท๏ธ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_HOSTNAME_HOSTNAMEโ the hostname of the domain, as a string.
Sys::Virt::Domain::GUEST_INFO_FILESYSTEMโ filesystem mount information ๐๏ธ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_FS_COUNTโ the number of filesystems defined on this domain, as an unsigned int.Sys::Virt::Domain::GUEST_INFO_FS_PREFIXโ the parameter name prefix to access each filesystem entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the filesystem suffix parameters to form a complete parameter name.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_MOUNTPOINTโ the path to the mount point for the filesystem, as a string.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_NAMEโ device name in the guest (e.g.sda1), as a string.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_FSTYPEโ the type of filesystem, as a string.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_TOTAL_BYTESโ the total size of the filesystem, as an unsigned long long.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_USED_BYTESโ the number of bytes used in the filesystem, as an unsigned long long.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_DISK_COUNTโ the number of disks targeted by this filesystem, as an int.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_DISK_PREFIXโ the parameter name prefix to access each disk entry. Concatenate the filesystem prefix, the filesystem entry number formatted as an unsigned integer, the disk prefix, the disk entry number formatted as an unsigned integer, and one of the disk suffix parameters to form a complete parameter name. (yes it's a whole little name stack, she's nested like that ๐ช)Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_DISK_SUFFIX_ALIASโ the device alias of the disk (e.g.sda), as a string.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_DISK_SUFFIX_SERIALโ the serial number of the disk, as a string.Sys::Virt::Domain::GUEST_INFO_FS_SUFFIX_DISK_SUFFIX_DEVICEโ the device node of the disk, as a string.
Sys::Virt::Domain::GUEST_INFO_DISKSโ block device information ๐พ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_DISK_COUNTโ the number of disks defined on this domain, as an unsigned int.Sys::Virt::Domain::GUEST_INFO_DISK_PREFIXโ the parameter name prefix to access each disk entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the disk suffix parameters to form a complete parameter name.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_NAMEโ device node (Linux) or device UNC (Windows), as a string.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_PARTITIONโ whether this is a partition (true) or disk (false), as a boolean.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_DEPENDENCY_COUNTโ e.g. for LVs of the LVM this will hold the list of PVs, for LUKS encrypted volume this will contain the disk where the volume is placed. (Linux).Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_DEPENDENCY_PREFIXโ the parameter name prefix to access each dependency entry. Concatenate the disk prefix, the disk entry number formatted as an unsigned integer, the dependency prefix, the dependency entry number formatted as an unsigned integer, and one of the dependency suffix parameters to form a complete parameter name.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_DEPENDENCY_SUFFIX_NAMEโ a dependency name, as a string.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_SERIALโ optional disk serial number, as a string.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_ALIASโ the device alias of the disk (e.g.sda), as a string.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_GUEST_ALIASโ optional alias assigned to the disk; on Linux this is a name assigned by device mapper, as a string.Sys::Virt::Domain::GUEST_INFO_DISK_SUFFIX_GUEST_BUSโ disk bus as reported by the guest OS.
Sys::Virt::Domain::GUEST_INFO_INTERFACESโ network interfaces information ๐ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_IF_COUNTโ the number of interfaces defined on this domain, as an unsigned int.Sys::Virt::Domain::GUEST_INFO_IF_PREFIXโ the parameter name prefix to access each interface entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the interface suffix parameters to form a complete parameter name.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_NAMEโ name in the guest (e.g.eth0) for the interface, as a string.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_HWADDRโ hardware address in the guest of the interface, as a string.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_ADDR_COUNTโ the number of IP addresses of interface, as an unsigned int.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_ADDR_PREFIXโ the parameter name prefix to access each address entry. Concatenate the interface prefix, the interface entry number formatted as an unsigned integer, the address prefix, the address entry number formatted as an unsigned integer, and one of the address suffix parameters to form a complete parameter name.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_ADDR_SUFFIX_TYPEโ the IP address type (e.g.ipv4), as a string.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_ADDR_SUFFIX_ADDRโ the IP address, as a string.Sys::Virt::Domain::GUEST_INFO_IF_SUFFIX_ADDR_SUFFIX_PREFIXโ the prefix of IP address, as an unsigned int.
Sys::Virt::Domain::GUEST_INFO_LOADโ system load information ๐ฅ The following keys will be used for the returned parameters:Sys::Virt::Domain::GUEST_INFO_LOAD_1Mโ the guest load averaged over 1 minute, as a double ๐Sys::Virt::Domain::GUEST_INFO_LOAD_5Mโ the guest load averaged over 5 minutes, as a double ๐Sys::Virt::Domain::GUEST_INFO_LOAD_15Mโ the guest load averaged over 15 minutes, as a double ๐
$flags is currently unused and defaults to zero. (iconic behaviour honestly, it's just vibing there)
$dom->set_agent_response_timeout($timeout, $flags=0)
Sets how long we wait for guest agent to answer a command before we're like "ok bestie I'm leaving". $timeout is a positive integer = the number of seconds to wait, or one of these constants:
Sys::Virt::Domain::AGENT_RESPONSE_TIMEOUT_BLOCKโ wait forever, no timeout at all. main character patience โจSys::Virt::Domain::AGENT_RESPONSE_TIMEOUT_NOWAITโ don't want at all, return immediately. literally zero chill ๐Sys::Virt::Domain::AGENT_RESPONSE_TIMEOUT_DEFAULTโ use the hypervisor driver's default timeout, let the driver decide, iykyk
The $flags parameter is currently unused and defaults to zero.
my @keys = $dom->authorized_ssh_keys_get($user, $flags=0)
Gets you the list of authorized SSH keys for the user account $user. The $flags parameter is currently unused and defaults to zero. ๐
$dom->authorized_ssh_keys_set($user, \@keys, $flags=0)
Updates the list of authorized SSH keys for the user account $user. The @keys parameter should be an array reference holding the new keys, if any. Default behaviour = set the authorized SSH keys to exactly the set you specified in @keys, no leftovers, periodt. You can modify that with the $flags parameter, which takes these constants:
Sys::Virt::Domain::AUTHORIZED_SSH_KEYS_SET_APPENDโ append@keysto the current set of keys instead of replacing the existing keys ๐Sys::Virt::Domain::AUTHORIZED_SSH_KEYS_SET_REMOVEโ remove@keysfrom the current set of keys instead of replacing the existing keys. And it is not an error if the keys do not exist, so you can't get in trouble for it ๐
my @msgs = $dom->get_messages($flags=0)
Retrieves a list of messages associated with the domain. The optional $flags parameter can accept zero or more of:
Sys::Virt::Domain::MESSAGE_DEPRECATIONโ warnings about use of deprecated features โ ๏ธSys::Virt::Domain::MESSAGE_TAINTINGโ warnings about actions that have tainting the domain (that's the original phrasing, we keep the facts but the typo... yeah it's documented like that ๐ซถ)Sys::Virt::Domain::MESSAGE_IOERRORSโ warnings about I/O errors that have occurred on the domain ๐ญ
$dom->start_dirty_rate_calc($dom, $secs, $flags=0)
Requests calculation of the domain's memory dirty rate over the next $secs seconds. And yes, the signature literally lists $dom in there, that's how it's written, do not come for me ๐ $flags accepts one or more of:
Sys::Virt::Domain::DIRTYRATE_MODE_PAGE_SAMPLINGโ page sampling modeSys::Virt::Domain::DIRTYRATE_MODE_DIRTY_BITMAPโ dirty bitmap modeSys::Virt::Domain::DIRTYRATE_MODE_DIRTY_RINGโ dirty ring mode
$dom->fd_associate($name, \@fds, $flags=0)
Associates a set of file descriptors in @fds with the domain and gives them the name $name. If $flags is non-zero, it can take one or more of:
Sys::Virt::Domain::FD_ASSOCIATE_SECLABEL_RESTOREโ attempt to restore the label when shutting down ๐Sys::Virt::Domain::FD_ASSOCIATE_SECLABEL_WRITABLEโ label the FD to permit the guest to write to it โ๏ธ
$dom->graphics_reload($type, $flags=0)
Requests a reload of the graphics backend state. The $type parameter says what type of graphics backend to reload if there are multiple present. It takes one of these constants:
Sys::Virt::Domain::GRAPHICS_RELOAD_TYPE_ANYโ reload state for any graphics backend type ๐Sys::Virt::Domain::GRAPHICS_RELOAD_TYPE_VNCโ reload state for only VNC graphics backends
The $flags parameter is currently unused and defaults to zero.
$dom->del_throttle_group($group, $flags=0)
Deletes a throttlegroup from the domain. The $group you're deleting must not have a throttlefilter associated with it, and it can be any of the current valid group. ๐๏ธ
$dom->set_throttle_group($group, $params, $flags=0)
Adds a throttlegroup or changes all of the throttlegroup options within a specific domain. The $params should be a hash reference whose keys are one of the BLKIO TUNING PARAMETERS constants.
โจ CONSTANTS โจ
A bunch of the APIs take a "flags" parameter. In most cases passing a value of zero will be totally satisfactory, no notes. Some APIs, however, accept named constants to alter their behaviour. This section documents the currently known constants ๐
๐ฆ DOMAIN STATE
These are useful for interpreting the "state" key in the hash returned by the "get_info" method.
Sys::Virt::Domain::STATE_NOSTATEโ the domain is active, but is not running / blocked (e.g. idle)Sys::Virt::Domain::STATE_RUNNINGโ the domain is active and running ๐ฅSys::Virt::Domain::STATE_BLOCKEDโ the domain is active, but execution is blockedSys::Virt::Domain::STATE_PAUSEDโ the domain is active, but execution has been pausedSys::Virt::Domain::STATE_SHUTDOWNโ the domain is active, but in the shutdown phaseSys::Virt::Domain::STATE_SHUTOFFโ the domain is inactive, and shut down.Sys::Virt::Domain::STATE_CRASHEDโ the domain is inactive, and crashed. ๐Sys::Virt::Domain::STATE_PMSUSPENDEDโ the domain is active, but in power management suspend state
๐ CONTROL INFO
These constants tell you what the guest domain control channel status is:
Sys::Virt::Domain::CONTROL_ERRORโ the control channel has a fatal errorSys::Virt::Domain::CONTROL_OKโ the control channel is ready for jobs โSys::Virt::Domain::CONTROL_OCCUPIEDโ the control channel is busySys::Virt::Domain::CONTROL_JOBโ the control channel is busy with a job
If the status is "Sys::Virt::Domain::CONTROL_ERROR", then one of these describes the reason:
Sys::Virt::Domain::CONTROL_ERROR_REASON_NONEโ there is no reason for the error availableSys::Virt::Domain::CONTROL_ERROR_REASON_UNKNOWNโ the reason for the error is unknownSys::Virt::Domain::CONTROL_ERROR_REASON_INTERNALโ there was an internal error in libvirtSys::Virt::Domain::CONTROL_ERROR_REASON_MONITORโ there was an error speaking to the monitor ๐ญ
๐ธ DOMAIN CREATION
These control the behaviour of domain creation:
Sys::Virt::Domain::START_PAUSEDโ keep the guest vCPUs paused after starting the guestSys::Virt::Domain::START_AUTODESTROYโ automatically destroy the guest when the connection is closed (or fails)Sys::Virt::Domain::START_BYPASS_CACHEโ do not use OS I/O cache if starting a domain with a saved state imageSys::Virt::Domain::START_FORCE_BOOTโ boot the guest, even if there was a saved snapshotSys::Virt::Domain::START_VALIDATEโ validate the XML document against the XML schemaSys::Virt::Domain::START_RESET_NVRAMโ reset the firmware NVRAM state from its original template ๐
๐ง DOMAIN DEFINE
These control the behaviour of domain define operations:
Sys::Virt::Domain::DEFINE_VALIDATEโ validate the XML document against the XML schema
โจ๏ธ KEYCODE SETS
These define the set of supported keycode sets:
Sys::Virt::Domain::KEYCODE_SET_LINUXโ the Linux event subsystem keycodesSys::Virt::Domain::KEYCODE_SET_XTโ the original XT keycodesSys::Virt::Domain::KEYCODE_SET_ATSET1โ the AT Set1 keycodes (aka XT)Sys::Virt::Domain::KEYCODE_SET_ATSET2โ the AT Set2 keycodes (aka AT)Sys::Virt::Domain::KEYCODE_SET_ATSET3โ the AT Set3 keycodes (aka PS2)Sys::Virt::Domain::KEYCODE_SET_OSXโ the OS-X keycodesSys::Virt::Domain::KEYCODE_SET_XT_KBDโ the XT keycodes from the Linux Keyboard driverSys::Virt::Domain::KEYCODE_SET_USBโ the USB HID keycode setSys::Virt::Domain::KEYCODE_SET_WIN32โ the Windows keycode setSys::Virt::Domain::KEYCODE_SET_QNUMโ the XT keycode set, with the extended scancodes using the high bit of the first byte, instead of the low bit of the second byte.Sys::Virt::Domain::KEYCODE_SET_RFBโ a deprecated alias for"Sys::Virt::Domain::KEYCODE_SET_QNUM"โ ๏ธ
๐ MEMORY PEEK
These can be used with the "memory_peek" method's flags parameter:
Sys::Virt::Domain::MEMORY_VIRTUALโ indicates that the offset is using virtual memory addressing.Sys::Virt::Domain::MEMORY_PHYSICALโ indicates that the offset is using physical memory addressing.
โญ VCPU STATE
These are useful when interpreting the virtual CPU run state:
Sys::Virt::Domain::VCPU_OFFLINEโ the virtual CPU is not onlineSys::Virt::Domain::VCPU_RUNNINGโ the virtual CPU is executing code ๐ฅSys::Virt::Domain::VCPU_BLOCKEDโ the virtual CPU is waiting to be scheduled
๐ VCPU HOST PLACEMENT STATE
These are useful when interpreting the virtual CPU host placement:
Sys::Virt::Domain::VCPU_INFO_CPU_OFFLINEโ the virtual CPU is not onlineSys::Virt::Domain::VCPU_INFO_CPU_UNAVAILABLEโ the virtual CPU placement is not available from this hypervisor
๐ OPEN GRAPHICS CONSTANTS
These are used when opening a connection to the guest graphics server:
Sys::Virt::Domain::OPEN_GRAPHICS_SKIPAUTHโ skip authentication of the client ๐
๐ซถ OPEN CONSOLE CONSTANTS
These are used when opening a connection to the guest console:
Sys::Virt::Domain::OPEN_CONSOLE_FORCEโ force opening of the console, disconnecting any other open sessionSys::Virt::Domain::OPEN_CONSOLE_SAFEโ check if the console driver supports safe operations
๐ OPEN CHANNEL CONSTANTS
These are used when opening a connection to the guest channel:
Sys::Virt::Domain::OPEN_CHANNEL_FORCEโ force opening of the channel, disconnecting any other open session
๐ฆ XML DUMP OPTIONS
These control the information included in the XML configuration dump:
Sys::Virt::Domain::XML_INACTIVEโ report the persistent inactive configuration for the guest, even if it is currently running.Sys::Virt::Domain::XML_SECUREโ include security sensitive information in the XML dump, such as passwords. โ ๏ธ (yes, actual passwords, be careful who sees this dump bestie)Sys::Virt::Domain::XML_UPDATE_CPUโ update the CPU model definition to match the current executing state.Sys::Virt::Domain::XML_MIGRATABLEโ update the XML to allow migration to older versions of libvirt
๐ DEVICE HOTPLUG OPTIONS
These control device hotplug operations:
Sys::Virt::Domain::DEVICE_MODIFY_CURRENTโ modify the domain in its current stateSys::Virt::Domain::DEVICE_MODIFY_LIVEโ only touches the live state of the domain, like editing the running vibe without savingSys::Virt::Domain::DEVICE_MODIFY_CONFIGโ only touches the persistent config of the domain, so it changes what's written down, not what's happening rnSys::Virt::Domain::DEVICE_MODIFY_FORCEโ bestie said do it, so it forces the device to be modified ๐
๐ธ MEMORY OPTIONS ๐ธ
okay so these constants are the little dials that control memory change operations โจ
Sys::Virt::Domain::MEM_CURRENTโ modify the current stateSys::Virt::Domain::MEM_LIVEโ modify only the live state of the domainSys::Virt::Domain::MEM_CONFIGโ modify only the persistent config of the domainSys::Virt::Domain::MEM_MAXIMUMโ modify the maximum memory value, aka the absolute ceiling
๐ CONFIG OPTIONS ๐
these ones decide what configuration a domain update actually changes โ choose wisely fr fr
Sys::Virt::Domain::AFFECT_CURRENTโ modify the current stateSys::Virt::Domain::AFFECT_LIVEโ modify only the live state of the domainSys::Virt::Domain::AFFECT_CONFIGโ modify only the persistent config of the domain
๐ฆ SETVCPU OPTIONS ๐ฆ
the constants that control what setting vCPUs changes ๐
Sys::Virt::Domain::SETVCPU_AFFECT_CURRENTโ modify the current stateSys::Virt::Domain::SETVCPU_AFFECT_LIVEโ modify only the live state of the domainSys::Virt::Domain::SETVCPU_AFFECT_CONFIGโ modify only the persistent config of the domainSys::Virt::Domain::SETVCPU_ASYNC_UNPLUGโ do not wait for the guest to comply with the request (so like, fire and forget, no cap)
๐ฅ MIGRATE OPTIONS ๐ฅ
the constants that control how migration is performed โ this is the main-character section, buckle up ๐
Sys::Virt::Domain::MIGRATE_LIVEโ migrate the guest without interrupting its execution on the source hostSys::Virt::Domain::MIGRATE_PEER2PEERโ manage the migration process over a direct peer-2-peer connection between the source and destination hostlibvirtddaemonsSys::Virt::Domain::MIGRATE_TUNNELLEDโ tunnel the migration data over thelibvirtdaemon connection, rather than the native hypervisor data transport. Requires thePEER2PEERflag to be set.Sys::Virt::Domain::MIGRATE_PERSIST_DESTโ make the domain persistent on the destination host, defining its configuration file upon completion of migrationSys::Virt::Domain::MIGRATE_UNDEFINE_SOURCEโ remove the domain's persistent configuration after migration completes successfullySys::Virt::Domain::MIGRATE_PAUSEDโ do not re-start execution of the guest CPUs on the destination host after migration completesSys::Virt::Domain::MIGRATE_NON_SHARED_DISKโ copy the complete contents of the disk images during migrationSys::Virt::Domain::MIGRATE_NON_SHARED_INCโ copy the incrementally changed contents of the disk images during migrationSys::Virt::Domain::MIGRATE_CHANGE_PROTECTIONโ do not allow changes to the virtual domain configuration while migration is taking place. This option is automatically implied if you're doing a peer-2-peer migration.Sys::Virt::Domain::MIGRATE_UNSAFEโ migrate even if the compatibility check indicates the migration will be unsafe to the guest ๐ (it's literally called unsafe, bestie)Sys::Virt::Domain::MIGRATE_OFFLINEโ migrate the guest config if the guest is not currently runningSys::Virt::Domain::MIGRATE_COMPRESSEDโ enable compression of the migration data streamSys::Virt::Domain::MIGRATE_ABORT_ON_ERRORโ abort if an I/O error occurs on the diskSys::Virt::Domain::MIGRATE_AUTO_CONVERGEโ force convergence of the migration operation by throttling guest runtimeSys::Virt::Domain::MIGRATE_RDMA_PIN_ALLโ pin memory for RDMA transferSys::Virt::Domain::MIGRATE_POSTCOPYโ enable support for post-copy migrationSys::Virt::Domain::MIGRATE_TLSโ setting this flag will cause the migration to attempt to use the TLS environment configured by the hypervisor in order to perform the migration. If it's incorrectly configured on either source or destination, the migration will fail. ๐Sys::Virt::Domain::MIGRATE_PARALLELโ send memory pages to the destination host through several network connections. See"Sys::Virt::Domain::MIGRATE_PARAM_PARALLEL_*"parameters for configuring the parallel migrationSys::Virt::Domain::MIGRATE_NON_SHARED_SYNCHRONOUS_WRITESโ force the guest writes which happen when copying disk images for non-shared storage migration to be synchronously written to the destination. This ensures the storage migration converges for VMs doing heavy I/O on fast local storage and slow mirrorSys::Virt::Domain::MIGRATE_POSTCOPY_RESUMEโ resume migration which failed in post-copy phaseSys::Virt::Domain::MIGRATE_ZEROCOPYโ attempt to avoid copying data. This is a request, not a guarantee, and may apply to either one or both directions of data transfer at the discretion of the hypervisor implementation
โญ UNDEFINE CONSTANTS โญ
the following constants can be used when undefining virtual domain configurations โ think of it as the "what else should I clean up while I'm here" menu ๐งน
Sys::Virt::Domain::UNDEFINE_MANAGED_SAVEโ also remove any managed save image when undefining the virtual domainSys::Virt::Domain::UNDEFINE_SNAPSHOTS_METADATAโ also remove any snapshot metadata when undefining the virtual domainSys::Virt::Domain::UNDEFINE_NVRAMโ also remove any NVRAM state file when undefining the virtual domainSys::Virt::Domain::UNDEFINE_KEEP_NVRAMโ keep the NVRAM state file when undefining the virtual domainSys::Virt::Domain::UNDEFINE_CHECKPOINTS_METADATAโ also remove any checkpoint metadata when undefining the virtual domainSys::Virt::Domain::UNDEFINE_TPMโ also remove any TPM state when undefining the virtual domainSys::Virt::Domain::UNDEFINE_KEEP_TPMโ keep the TPM state when undefining the virtual domain
๐ JOB TYPES ๐
these constants describe the different background job types โ like, what is your domain even doing behind the scenes rn
Sys::Virt::Domain::JOB_NONEโ no job is activeSys::Virt::Domain::JOB_BOUNDEDโ a job with a finite completion time is activeSys::Virt::Domain::JOB_UNBOUNDEDโ a job with an unbounded completion time is activeSys::Virt::Domain::JOB_COMPLETEDโ the job has finished, but isn't cleaned upSys::Virt::Domain::JOB_FAILEDโ the job has hit an error, but isn't cleaned up ๐ญSys::Virt::Domain::JOB_CANCELLEDโ the job was aborted at user request, but isn't cleaned up
๐ MEMORY PARAMETERS ๐
these constants are useful when getting/setting memory parameters for guests โจ
Sys::Virt::Domain::MEMORY_HARD_LIMITโ the maximum memory the guest can useSys::Virt::Domain::MEMORY_SOFT_LIMITโ the memory upper limit enforced during memory contentionSys::Virt::Domain::MEMORY_MIN_GUARANTEEโ the minimum memory guaranteed to be reserved for the guestSys::Virt::Domain::MEMORY_SWAP_HARD_LIMITโ the maximum swap the guest can useSys::Virt::Domain::MEMORY_PARAM_UNLIMITEDโ the value of an unlimited memory parameter
๐ BLKIO PARAMETERS ๐
these parameters control I/O tuning for the domain as a whole โ the whole-domain vibe check, not per-disk
Sys::Virt::Domain::BLKIO_WEIGHTโ the I/O weight parameterSys::Virt::Domain::BLKIO_DEVICE_WEIGHTโ the per-device I/O weight parameterSys::Virt::Domain::BLKIO_DEVICE_READ_BPSโ the per-device I/O bytes read per secondSys::Virt::Domain::BLKIO_DEVICE_READ_IOPSโ the per-device I/O operations read per secondSys::Virt::Domain::BLKIO_DEVICE_WRITE_BPSโ the per-device I/O bytes write per secondSys::Virt::Domain::BLKIO_DEVICE_WRITE_IOPSโ the per-device I/O operations write per second
๐ BLKIO TUNING PARAMETERS ๐
and these ones control I/O tuning for an individual guest disk โ one disk at a time, main character energy ๐ซถ
Sys::Virt::Domain::BLOCK_IOTUNE_TOTAL_BYTES_SECโ the total bytes processed per secondSys::Virt::Domain::BLOCK_IOTUNE_READ_BYTES_SECโ the bytes read per secondSys::Virt::Domain::BLOCK_IOTUNE_WRITE_BYTES_SECโ the bytes written per secondSys::Virt::Domain::BLOCK_IOTUNE_TOTAL_IOPS_SECโ the total I/O operations processed per secondSys::Virt::Domain::BLOCK_IOTUNE_READ_IOPS_SECโ the I/O operations read per secondSys::Virt::Domain::BLOCK_IOTUNE_WRITE_IOPS_SECโ the I/O operations written per secondSys::Virt::Domain::BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAXโ the maximum total bytes processed per secondSys::Virt::Domain::BLOCK_IOTUNE_READ_BYTES_SEC_MAXโ the maximum bytes read per secondSys::Virt::Domain::BLOCK_IOTUNE_WRITE_BYTES_SEC_MAXโ the maximum bytes written per secondSys::Virt::Domain::BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAXโ the maximum total I/O operations processed per secondSys::Virt::Domain::BLOCK_IOTUNE_READ_IOPS_SEC_MAXโ the maximum I/O operations read per secondSys::Virt::Domain::BLOCK_IOTUNE_WRITE_IOPS_SEC_MAXโ the maximum I/O operations written per secondSys::Virt::Domain::BLOCK_IOTUNE_SIZE_IOPS_SECโ the maximum I/O operations per secondSys::Virt::Domain::BLOCK_IOTUNE_GROUP_NAMEโ a string representing a group name to allow sharing of I/O throttling quota between multiple drivesSys::Virt::Domain::BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum total bytes processed per secondSys::Virt::Domain::BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum bytes read per secondSys::Virt::Domain::BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum bytes written per secondSys::Virt::Domain::BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum total I/O operations processed per secondSys::Virt::Domain::BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum I/O operations read per secondSys::Virt::Domain::BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum I/O operations written per second
๐ง SCHEDULER CONSTANTS ๐ง
the scheduler knobs, aka how much CPU love your VM gets ๐
Sys::Virt::Domain::SCHEDULER_CAPโ the VM cap tunableSys::Virt::Domain::SCHEDULER_CPU_SHARESโ the CPU shares tunableSys::Virt::Domain::SCHEDULER_LIMITโ the VM limit tunableSys::Virt::Domain::SCHEDULER_RESERVATIONโ the VM reservation tunableSys::Virt::Domain::SCHEDULER_SHARESโ the VM shares tunableSys::Virt::Domain::SCHEDULER_VCPU_PERIODโ the VCPU period tunableSys::Virt::Domain::SCHEDULER_VCPU_QUOTAโ the VCPU quota tunableSys::Virt::Domain::SCHEDULER_GLOBAL_PERIODโ the VM global period tunableSys::Virt::Domain::SCHEDULER_GLOBAL_QUOTAโ the VM global quota tunableSys::Virt::Domain::SCHEDULER_WEIGHTโ the VM weight tunable
๐ฆ NUMA PARAMETERS ๐ฆ
Okay bestie, these constants are the ones you want when you're getting/setting the guest NUMA memory policy ๐
Sys::Virt::Domain::NUMA_MODEโ the NUMA policy mode, that's the vibe selectorSys::Virt::Domain::NUMA_NODESETโ the NUMA nodeset mask, aka which nodes are invited to the party
And these next ones are what you use to interpret the value of that Sys::Virt::Domain::NUMA_MODE parameter ๐
Sys::Virt::Domain::NUMATUNE_MEM_STRICTโ allocation is mandatory from the mask nodes, no substitutions, periodtSys::Virt::Domain::NUMATUNE_MEM_PREFERREDโ allocation is preferred from the masked nodes, like, it'd be niceSys::Virt::Domain::NUMATUNE_MEM_INTERLEAVEโ allocation is interleaved across all masked nodes, spreading the love ๐Sys::Virt::Domain::NUMATUNE_MEM_RESTRICTIVEโ allocation is determined by the host using the masked nodes.
๐ INTERFACE PARAMETERS ๐
These constants are your go-tos when getting/setting the per network interface tunable parameters โ the little knobs on your NIC โจ
Sys::Virt::Domain::BANDWIDTH_IN_AVERAGEโ the average inbound bandwidthSys::Virt::Domain::BANDWIDTH_IN_PEAKโ the peak inbound bandwidthSys::Virt::Domain::BANDWIDTH_IN_BURSTโ the burstable inbound bandwidthSys::Virt::Domain::BANDWIDTH_IN_FLOORโ the minimum inbound bandwidth (the floor, literally the floor)Sys::Virt::Domain::BANDWIDTH_OUT_AVERAGEโ the average outbound bandwidthSys::Virt::Domain::BANDWIDTH_OUT_PEAKโ the peak outbound bandwidthSys::Virt::Domain::BANDWIDTH_OUT_BURSTโ the burstable outbound bandwidth
๐ฅ PERF EVENTS ๐ฅ
These constants define performance events that you can monitor for a guest โ it's giving main character observability ๐
Sys::Virt::Domain::PERF_PARAM_CMTโ the CMT event counter, which you use to measure the usage of cache (bytes) by applications running on the platform. It corresponds to theperf.cmtfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_MBMLโ the MBML event counter, for monitoring the amount of data (bytes/s) sent through the memory controller on the socket. It corresponds to theperf.mbmlfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_MBMTโ the MBMT event counter, for monitoring total system bandwidth (bytes/s) from one level of cache to another. It corresponds to theperf.mbmtfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_CACHE_MISSESโ the cache_misses perf event counter, which measures the count of cache misses by applications running on the platform. It corresponds to theperf.cache_missesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_CACHE_REFERENCESโ the cache_references perf event counter, which measures the count of cache hits by applications running on the platform. It corresponds to theperf.cache_referencesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_CPU_CYCLESโ the cpu_cycles perf event counter, which measures how many cpu cycles one instruction needs. It corresponds to theperf.cpu_cyclesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_INSTRUCTIONSโ the instructions perf event counter, which measures the count of instructions by applications running on the platform. It corresponds to theperf.instructionsfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_BRANCH_INSTRUCTIONSโ the branch_instructions perf event counter, which measures the count of instructions by applications running on the platform. It corresponds to theperf.branch_instructionsfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_BRANCH_MISSESโ the branch_misses perf event, which measures the count of branch misses by applications running on the platform. It corresponds to theperf.branch_missesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_BUS_CYCLESโ the bus_cycles perf event counter, which measures the count of bus cycles by applications running on the platform. It corresponds to theperf.bus_cyclesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_STALLED_CYCLES_FRONTENDโ the stalled_cycles_frontend perf event counter, which measures the count of stalled cpu cycles in the frontend of the instruction processor pipeline by applications running on the platform. It corresponds to theperf.stalled_cycles_frontendfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_STALLED_CYCLES_BACKENDโ the stalled_cycles_backend perf event counter, which measures the count of stalled cpu cycles in the backend of the instruction processor pipeline by application running on the platform. It corresponds to theperf.stalled_cycles_backendfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_REF_CPU_CYCLESโ the ref_cpu_cycles perf event counter, which measures the count of total cpu cycles not affected by CPU frequency scaling by applications running on the platform. It corresponds to theperf.ref_cpu_cyclesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_CPU_CLOCKโ the cpu_clock perf event counter, which measures the count of cpu clock time by applications running on the platform. It corresponds to theperf.cpu_clockfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_TASK_CLOCKโ the task_clock perf event counter, which measures the count of task clock time by applications running on the platform. It corresponds to theperf.task_clockfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTSโ the page_faults perf event counter, which measures the count of page faults by applications running on the platform. It corresponds to theperf.page_faultsfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_CONTEXT_SWITCHESโ the context_switches perf event counter, which measures the count of context switches by applications running on the platform. It corresponds to theperf.context_switchesfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_CPU_MIGRATIONSโ the cpu_migrations perf event counter, which measures the count of cpu migrations by applications running on the platform. It corresponds to theperf.cpu_migrationsfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS_MINโ the page_faults_min perf event counter, which measures the count of minor page faults by applications running on the platform. It corresponds to theperf.page_faults_minfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS_MAJโ the page_faults_maj perf event counter, which measures the count of major page faults by applications running on the platform. It corresponds to theperf.page_faults_majfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_ALIGNMENT_FAULTSโ the alignment_faults perf event counter, which measures the count of alignment faults by applications running on the platform. It corresponds to theperf.alignment_faultsfield in the *Stats APIs.Sys::Virt::Domain::PERF_PARAM_EMULATION_FAULTSโ the emulation_faults perf event counter, which measures the count of emulation faults by applications running on the platform. It corresponds to theperf.emulation_faultsfield in the *Stats APIs.
That's a lot of counters and honestly? iconic. Go off, perf subsystem ๐
๐ง IOTHREAD STATS ๐ง
These constants define IOThread statistics that you can monitor for a guest โ the lowkey backstage crew of your domain ๐ซถ
Sys::Virt::Domain::IOTHREAD_PARAM_POLL_MAX_NSโ the maximum polling time that can be used by the polling algorithm, in ns. The polling time starts at 0 (zero) and is the time spent by the guest to process IOThread data before returning the CPU to the host. The polling time gets dynamically modified over time based on thepoll_growandpoll_shrinkparameters you provide.Sys::Virt::Domain::IOTHREAD_PARAM_POLL_GROWโ gives the dynamic polling adjustment algorithm a value to use when growing its polling interval, all the way up to thepoll_max_nsvalue.Sys::Virt::Domain::IOTHREAD_PARAM_POLL_SHRINKโ gives the dynamic polling adjustment algorithm a value to use when shrinking its polling interval, for when the polling interval exceeds thepoll_max_nsvalue.Sys::Virt::Domain::IOTHREAD_PARAM_THREAD_POOL_MINโ sets the lower bound for thread pool size. A value of-1disables this bound, leaving the hypervisor to use its default value โ though heads up, that value is not accepted for running domains. Due to internal implementation, it's recommended to set lower and upper bounds separately.Sys::Virt::Domain::IOTHREAD_PARAM_THREAD_POOL_MAXโ sets the upper bound for thread pool size. A value of-1disables this bound, leaving the hypervisor to use its default value โ and again, that value is not accepted for running domains. Since the upper bound has to be equal to or greater than the lower bound, a value of 0 is not accepted. Due to internal implementation, it's recommended to set lower and upper bounds separately.
bestie pls note those-1and0caveats, they will absolutely catch you slippin' ๐
๐ VCPU FLAGS ๐
These constants are useful when getting/setting the VCPU count for a guest โ vCPU math, but make it fashion โจ
Sys::Virt::Domain::VCPU_LIVEโ flag to request the live valueSys::Virt::Domain::VCPU_CONFIGโ flag to request the persistent config valueSys::Virt::Domain::VCPU_CURRENTโ flag to request the current config valueSys::Virt::Domain::VCPU_MAXIMUMโ flag to request adjustment of the maximum vCPU valueSys::Virt::Domain::VCPU_GUESTโ flag to request the guest VCPU maskSys::Virt::Domain::VCPU_HOTPLUGGABLEโ flag to make vcpus added hot(un)pluggableSys::Virt::Domain::VCPU_ASYNC_UNPLUGโ flag to not wait for the guest to comply with unplug request(s) โ impatient queen behavior, no cap
๐ STATE CHANGE EVENTS ๐
These constants let you interpret domain state change events. Each event contains both a state change and a reason โ so it's like a story with a plot twist ๐ฌ
Sys::Virt::Domain::EVENT_DEFINEDโ indicates that a persistent configuration has been defined for the domain.Sys::Virt::Domain::EVENT_DEFINED_ADDEDโ the defined configuration is newly addedSys::Virt::Domain::EVENT_DEFINED_UPDATEDโ the defined configuration is an update to an existing configurationSys::Virt::Domain::EVENT_DEFINED_RENAMEDโ the defined configuration is a rename of an existing configurationSys::Virt::Domain::EVENT_DEFINED_FROM_SNAPSHOTโ the defined configuration was restored from a snapshot
Sys::Virt::Domain::EVENT_RESUMEDโ the domain has resumed execution ๐โโ๏ธ๐จSys::Virt::Domain::EVENT_RESUMED_MIGRATEDโ bestie the domain came back to life because migration finished ๐ and heads up: this one gets emitted on the destination host, not where it came from.Sys::Virt::Domain::EVENT_RESUMED_UNPAUSEDโ the domain resumed because the admin literally just unpaused it. that's it, that's the reason ๐Sys::Virt::Domain::EVENT_RESUMED_FROM_SNAPSHOTโ resumed because it got restored from a snapshot. time travel vibes โจSys::Virt::Domain::EVENT_RESUMED_POSTCOPYโ the domain is resumed, but post-copy is still running in the background ๐ like it's smiling but it's still working.Sys::Virt::Domain::EVENT_RESUMED_POSTCOPY_FAILEDโ okay so the domain is running, but migration failed in post-copy. ๐ญ running but not okay.
Sys::Virt::Domain::EVENT_STARTEDโ the domain has started running!! main character energy activated ๐Sys::Virt::Domain::EVENT_STARTED_BOOTEDโ the domain was booted from a shutoff state. classic fresh start ๐ธSys::Virt::Domain::EVENT_STARTED_MIGRATEDโ started due to an incoming migration, so it basically moved in from another host ๐งณSys::Virt::Domain::EVENT_STARTED_RESTOREDโ restored from a saved state file. nap โ wake, no notes ๐คSys::Virt::Domain::EVENT_STARTED_FROM_SNAPSHOTโ restored from a snapshot ๐ธSys::Virt::Domain::EVENT_STARTED_WAKEUPโ woken up from suspend. the domain said "five more minutes" and then got up anyway โฐSys::Virt::Domain::EVENT_STARTED_RECREATEDโ the secure domain started after being recreated for a reboot ๐
Sys::Virt::Domain::EVENT_STOPPEDโ the domain has stopped running. it's giving closed for business ๐ชSys::Virt::Domain::EVENT_STOPPED_CRASHEDโ stopped because the guest operating system has crashed ๐ not the vibe.Sys::Virt::Domain::EVENT_STOPPED_DESTROYEDโ stopped because the administrator issued a destroy command. admin said "nope" ๐ซกSys::Virt::Domain::EVENT_STOPPED_FAILEDโ stopped because of a fault in the host virtualization environment ๐ ๏ธSys::Virt::Domain::EVENT_STOPPED_MIGRATEDโ stopped because it was migrated to another machine โ๏ธ bye bestieSys::Virt::Domain::EVENT_STOPPED_SAVEDโ the domain was saved to a state file ๐พSys::Virt::Domain::EVENT_STOPPED_SHUTDOWNโ stopped due to graceful shutdown of the guest. so polite ๐ทSys::Virt::Domain::EVENT_STOPPED_FROM_SNAPSHOTโ stopped due to a snapshot ๐ธSys::Virt::Domain::EVENT_STOPPED_RECREATEDโ the secure domain stopped to be recreated for a reboot ๐
Sys::Virt::Domain::EVENT_SHUTDOWNโ the domain has shut down but is not yet stopped โ like it's leaving the party but still saying goodbyes ๐ฅนSys::Virt::Domain::EVENT_SHUTDOWN_FINISHEDโ the domain finished shutting down โSys::Virt::Domain::EVENT_SHUTDOWN_HOSTโ shutdown due to a host trigger ๐ฅ๏ธSys::Virt::Domain::EVENT_SHUTDOWN_GUESTโ shutdown due to a guest trigger ๐ฎ
Sys::Virt::Domain::EVENT_SUSPENDEDโ the domain has stopped executing but still exists. sleeping beauty energy, no cap ๐ดSys::Virt::Domain::EVENT_SUSPENDED_MIGRATEDโ suspended due to offline migration ๐งณSys::Virt::Domain::EVENT_SUSPENDED_PAUSEDโ suspended due to an administrator pause request โSys::Virt::Domain::EVENT_SUSPENDED_IOERRORโ suspended due to a block device I/O error. yikes ๐จSys::Virt::Domain::EVENT_SUSPENDED_FROM_SNAPSHOTโ suspended due to a resume from snapshot ๐ธSys::Virt::Domain::EVENT_SUSPENDED_WATCHDOGโ suspended due to the watchdog triggering ๐Sys::Virt::Domain::EVENT_SUSPENDED_RESTOREDโ suspended due to a restore from saved state ๐พSys::Virt::Domain::EVENT_SUSPENDED_API_ERRORโ suspended due to an API error ๐ตโ๐ซSys::Virt::Domain::EVENT_SUSPENDED_POSTCOPYโ suspended for post-copy migration ๐Sys::Virt::Domain::EVENT_SUSPENDED_POSTCOPY_FAILEDโ suspended due to post-copy migration failing ๐Sys::Virt::Domain::EVENT_SUSPENDED_GUEST_SHUTDOWNโ suspended after guest os shut-down โ and note that a long running job is preserving the VM until completion ๐ซถ
Sys::Virt::Domain::EVENT_UNDEFINEDโ the persistent configuration has gone away ๐ซฅSys::Virt::Domain::EVENT_UNDEFINED_REMOVEDโ the domain configuration is gone because the administrator removed it ๐๏ธSys::Virt::Domain::EVENT_UNDEFINED_RENAMEDโ the undefined configuration is a rename of an existing configuration โ๏ธ
Sys::Virt::Domain::EVENT_PMSUSPENDEDโ the domain has stopped running ๐ดSys::Virt::Domain::EVENT_PMSUSPENDED_MEMORYโ the domain has suspend to RAM ๐งSys::Virt::Domain::EVENT_PMSUSPENDED_DISKโ the domain has suspend to Disk ๐ฟ
Sys::Virt::Domain::EVENT_CRASHEDโ the domain has crashed ๐ฅSys::Virt::Domain::EVENT_CRASHED_PANICKEDโ crashed due to a kernel panic ๐ฑSys::Virt::Domain::EVENT_CRASHED_CRASHLOADEDโ the domain has crashed and reloaded itself. honestly iconic, it got back up ๐
โจ EVENT ID CONSTANTS โจ
These are the big category IDs โ the vibe check for what kind of event you're looking at ๐ซ
Sys::Virt::Domain::EVENT_ID_LIFECYCLEโ domain lifecycle events ๐ฑSys::Virt::Domain::EVENT_ID_REBOOTโ soft / warm reboot events ๐Sys::Virt::Domain::EVENT_ID_RTC_CHANGEโ RTC clock adjustments โฐSys::Virt::Domain::EVENT_ID_IO_ERRORโ file IO errors, typically from disks ๐จSys::Virt::Domain::EVENT_ID_WATCHDOGโ watchdog device triggering ๐Sys::Virt::Domain::EVENT_ID_GRAPHICSโ graphics client connections ๐ผ๏ธSys::Virt::Domain::EVENT_ID_IO_ERROR_REASONโ file IO errors, typically from disks, but with a root cause ๐Sys::Virt::Domain::EVENT_ID_CONTROL_ERRORโ errors from the virtualization control channel ๐กSys::Virt::Domain::EVENT_ID_BLOCK_JOBโ completion status of asynchronous block jobs, identified by source file name ๐Sys::Virt::Domain::EVENT_ID_BLOCK_JOB_2โ completion status of asynchronous block jobs, identified by target device name ๐ฏSys::Virt::Domain::EVENT_ID_DISK_CHANGEโ changes in disk media ๐ฝSys::Virt::Domain::EVENT_ID_TRAY_CHANGEโ CDROM media tray state ๐Sys::Virt::Domain::EVENT_ID_PMSUSPENDโ power management initiated suspend to RAM ๐Sys::Virt::Domain::EVENT_ID_PMSUSPEND_DISKโ power management initiated suspend to Disk ๐ฟSys::Virt::Domain::EVENT_ID_PMWAKEUPโ power management initiated wakeup โ๏ธSys::Virt::Domain::EVENT_ID_BALLOON_CHANGEโ balloon target changes ๐Sys::Virt::Domain::EVENT_ID_DEVICE_ADDEDโ asynchronous guest device addition โSys::Virt::Domain::EVENT_ID_DEVICE_REMOVEDโ asynchronous guest device removal โSys::Virt::Domain::EVENT_ID_TUNABLEโ changes of any domain tuning parameters. the callback will be provided with a hash listing all the changed parameters, and the later DOMAIN TUNABLE constants can be super useful when accessing the hash keys ๐งSys::Virt::Domain::EVENT_ID_AGENT_LIFECYCLEโ domain guest agent lifecycle events. the"state"parameter passed to the callback will match one of these constants ๐Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_STATE_CONNECTEDโ the agent is now connected ๐Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTEDโ the agent is now disconnected ๐๐
The second parameter, "reason", matches one of the following constants:
Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_UNKNOWNโ the reason is unknown ๐คทSys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTEDโ the domain was initially booted ๐Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_CHANNELโ the channel on a running guest changed state ๐ถ
Sys::Virt::Domain::EVENT_ID_MIGRATION_ITERATIONโ domain migration progress iteration. the"iteration"parameter passed to the callback will specify the number of iterations migration has made over guest RAM ๐Sys::Virt::Domain::EVENT_ID_JOB_COMPLETEDโ domain background job completion notification. the callback provides a hash containing the job stats, and the keys in that hash are the same as those used with theSys::Virt::Domain::get_job_stats()method ๐Sys::Virt::Domain::EVENT_ID_DEVICE_REMOVAL_FAILEDโ guest device removal has failed ๐ฌSys::Virt::Domain::EVENT_ID_METADATA_CHANGEโ the domain metadata has changed ๐ท๏ธSys::Virt::Domain::EVENT_ID_BLOCK_THRESHOLDโ fires when the hypervisor detects that the given storage element was written beyond the point specified by threshold. genuinely so useful for thin-provisioned storage ๐๐ฆSys::Virt::Domain::EVENT_ID_MEMORY_FAILUREโ fires when the hypervisor detects hardware memory corruption ๐Sys::Virt::Domain::EVENT_ID_MEMORY_DEVICE_SIZE_CHANGEโ fires when the guest accepts a request to change the memory device size ๐Sys::Virt::Domain::EVENT_ID_NIC_MAC_CHANGEโ fires when the guest changes the MAC address on one of its virtual network interfaces ๐ชชSys::Virt::Domain::EVENT_ID_VCPU_REMOVEDโ fires when a vCPU is removed from the domain ๐งฉSys::Virt::Domain::EVENT_ID_CHANNEL_LIFECYCLEโ domain channel lifecycle events. the"state"parameter passed to the callback will match one of these constants ๐Sys::Virt::Domain::EVENT_CHANNEL_LIFECYCLE_STATE_CONNECTEDโ the channel is now connected ๐Sys::Virt::Domain::EVENT_CHANNEL_LIFECYCLE_STATE_DISCONNECTEDโ the channel is now disconnected โ๏ธ
The second parameter, "reason", matches one of the following constants:
Sys::Virt::Domain::EVENT_CHANNEL_LIFECYCLE_REASON_UNKNOWNโ the reason is unknown ๐คทSys::Virt::Domain::EVENT_CHANNEL_LIFECYCLE_REASON_DOMAIN_STARTEDโ the domain was initially booted ๐Sys::Virt::Domain::EVENT_CHANNEL_LIFECYCLE_REASON_CHANNELโ the channel on a running guest changed state ๐ถ
๐จ IO ERROR EVENT CONSTANTS ๐จ
These constants describe what action was taken due to the IO error. like, what did we do about it ๐
Sys::Virt::Domain::EVENT_IO_ERROR_NONEโ no action was taken; the error was ignored & reported as success to the guest ๐Sys::Virt::Domain::EVENT_IO_ERROR_PAUSEโ the guest is paused since the error occurred โธ๏ธSys::Virt::Domain::EVENT_IO_ERROR_REPORTโ the error has been reported to the guest OS ๐ฃ
๐ WATCHDOG EVENT CONSTANTS ๐
These constants describe what action was taken due to the watchdog firing. the dog barked, now what ๐
Sys::Virt::Domain::EVENT_WATCHDOG_NONEโ no action was taken, the watchdog was ignored ๐ซฅSys::Virt::Domain::EVENT_WATCHDOG_PAUSEโ the guest is paused since the watchdog fired โธ๏ธSys::Virt::Domain::EVENT_WATCHDOG_POWEROFFโ the guest is powered off after the watchdog fired ๐Sys::Virt::Domain::EVENT_WATCHDOG_RESETโ the guest is reset after the watchdog fired ๐Sys::Virt::Domain::EVENT_WATCHDOG_SHUTDOWNโ the guest tried to gracefully shut down after the watchdog fired ๐Sys::Virt::Domain::EVENT_WATCHDOG_DEBUGโ no action was taken, the watchdog was logged ๐Sys::Virt::Domain::EVENT_WATCHDOG_INJECTNMIโ an NMI was injected into the guest after the watchdog fired ๐ฅ
๐จ GRAPHICS EVENT PHASE CONSTANTS ๐จ
These constants describe the phase of the graphics connection, bestie ๐ผ๏ธ
Sys::Virt::Domain::EVENT_GRAPHICS_CONNECTโ the initial client connection โจSys::Virt::Domain::EVENT_GRAPHICS_INITIALIZEโ the client has been authenticated & the connection is running ๐ซSys::Virt::Domain::EVENT_GRAPHICS_DISCONNECTโ the client has disconnected ๐
๐ GRAPHICS EVENT ADDRESS CONSTANTS ๐
These constants describe the format of the address ๐ง
Sys::Virt::Domain::EVENT_GRAPHICS_ADDRESS_IPV4โ an IPv4 address ๐Sys::Virt::Domain::EVENT_GRAPHICS_ADDRESS_IPV6โ an IPv6 address โญSys::Virt::Domain::EVENT_GRAPHICS_ADDRESS_UNIXโ an UNIX socket path address ๐ฆ
๐ฝ DISK CHANGE EVENT CONSTANTS ๐ฝ
These constants describe the reason for a disk change event ๐
Sys::Virt::Domain::EVENT_DISK_CHANGE_MISSING_ON_STARTโ the disk media was cleared, as its source was missing when attempting to start the guest ๐ญSys::Virt::Domain::EVENT_DISK_DROP_MISSING_ON_STARTโ the disk device was dropped, as its source was missing when attempting to start the guest ๐
๐ฌ TRAY CHANGE CONSTANTS ๐ฌ
These constants describe the reason for a tray change event ๐
Sys::Virt::Domain::EVENT_TRAY_CHANGE_CLOSEโ the tray was closed ๐ซถSys::Virt::Domain::EVENT_TRAY_CHANGE_OPENโ the tray was opened โจ
๐ ๏ธ DOMAIN BLOCK JOB TYPE CONSTANTS ๐ ๏ธ
The following constants identify the different types of domain block jobs ๐งฐ
Sys::Virt::Domain::BLOCK_JOB_TYPE_UNKNOWNโ an unknown block job type ๐Sys::Virt::Domain::BLOCK_JOB_TYPE_PULLโ the block pull job type ๐Sys::Virt::Domain::BLOCK_JOB_TYPE_COPYโ the block copy job type ๐Sys::Virt::Domain::BLOCK_JOB_TYPE_COMMITโ the block commit job type ๐ฅSys::Virt::Domain::BLOCK_JOB_TYPE_ACTIVE_COMMITโ the block active commit job type โญSys::Virt::Domain::BLOCK_JOB_TYPE_BACKUPโ the block backup job type ๐พ
โ DOMAIN BLOCK JOB COMPLETION CONSTANTS โ
The following constants can be used to determine the completion status of a block job ๐
Sys::Virt::Domain::BLOCK_JOB_COMPLETEDโ a successfully completed block job ๐Sys::Virt::Domain::BLOCK_JOB_FAILEDโ an unsuccessful block job ๐ญSys::Virt::Domain::BLOCK_JOB_CANCELEDโ a block job canceled by the user ๐Sys::Virt::Domain::BLOCK_JOB_READYโ a block job is running ๐โโ๏ธ
๐ DOMAIN BLOCK REBASE CONSTANTS ๐
The following constants are useful when rebasing block devices ๐ง
Sys::Virt::Domain::BLOCK_REBASE_SHALLOWโ limit copy to top of source backing chain โ๏ธSys::Virt::Domain::BLOCK_REBASE_REUSE_EXTโ reuse existing external file for copy ๐ซถSys::Virt::Domain::BLOCK_REBASE_COPY_RAWโ make destination file raw ๐งฑSys::Virt::Domain::BLOCK_REBASE_COPYโ start a copy job ๐Sys::Virt::Domain::BLOCK_REBASE_COPY_DEVโ treat destination as a block device instead of file ๐ฝSys::Virt::Domain::BLOCK_REBASE_RELATIVEโ keep backing chain referenced using relative names ๐
๐ DOMAIN BLOCK COPY CONSTANTS ๐
The following constants are useful when copying block devices ๐๏ธ
Sys::Virt::Domain::BLOCK_COPY_SHALLOWโ limit copy to top of source backing chain โ๏ธSys::Virt::Domain::BLOCK_COPY_REUSE_EXTโ reuse existing external file for copy โป๏ธSys::Virt::Domain::BLOCK_COPY_TRANSIENT_JOBโ donโt force usage of recoverable job for the copy operation ๐ซงSys::Virt::Domain::BLOCK_COPY_SYNCHRONOUS_WRITESโ force the copy job to synchronously propagate guest writes into the destination image, so that the copy is guaranteed to converge โกSys::Virt::Domain::BLOCK_COPY_TARGET_ZEROEDโ the target image is guaranteed to be pre-zeroed so all reads will return zeros ๐
๐ DOMAIN BLOCK JOB ABORT CONSTANTS ๐>
The following constants are useful when aborting job copy jobs ๐จ
Sys::Virt::Domain::BLOCK_JOB_ABORT_ASYNCโ request only, do not wait for completion โฉSys::Virt::Domain::BLOCK_JOB_ABORT_PIVOTโ pivot to mirror when ending a copy job ๐
๐งท DOMAIN BLOCK COMMIT JOB CONSTANTS ๐งท
The following constants are useful with block commit job types ๐งต
Sys::Virt::Domain::BLOCK_COMMIT_DELETEโ delete any files that are invalid after commit ๐๏ธSys::Virt::Domain::BLOCK_COMMIT_SHALLOWโ NULL base means next backing file, not whole chain ๐ชSys::Virt::Domain::BLOCK_COMMIT_ACTIVEโ allow two phase commit when top is active layer ๐ญSys::Virt::Domain::BLOCK_COMMIT_RELATIVEโ keep backing chain referenced using relative names ๐
๐พ DOMAIN SAVE / RESTORE FLAG CONSTANTS ๐พ
The following constants can be used when saving or restoring virtual machines ๐ฅ๏ธ
Sys::Virt::Domain::SAVE_BYPASS_CACHEโ do not use OS I/O cache when saving state. ๐ซSys::Virt::Domain::SAVE_PAUSEDโ mark the saved state as paused to prevent the guest CPUs starting upon restore โธ๏ธSys::Virt::Domain::SAVE_RUNNINGโ mark the saved state as running to allow the guest CPUs to start upon restore โถ๏ธSys::Virt::Domain::SAVE_RESET_NVRAMโ reset the firmware NVRAM state from its original template ๐
๐ฆ SAVE / RESTORE PARAMETER CONSTANTS ๐ฆ
Sys::Virt::Domain::SAVE_PARAM_FILEโ specify the save state file to save to or restore from. ๐Sys::Virt::Domain::SAVE_PARAM_DXMLโ used to adjust guest xml on restore, e.g. to alter a device while domain is stopped. ๐Sys::Virt::Domain::SAVE_PARAM_IMAGE_FORMATโ specify the save state image format. This can be one of the following constant values ๐ผ๏ธSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_RAWโ uncompressed raw image ๐งฑSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_GZIPโ image compressed with gzip ๐๏ธSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_BZIP2โ image compressed with bzip2 ๐๏ธSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_XZโ image compressed with xz ๐๏ธSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_LZOPโ image compressed with lzop ๐๏ธSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_ZSTDโ image compressed with zstd ๐๏ธSys::Virt::Domain::SAVE_PARAM_IMAGE_FORMAT_SPARSEโ uncompressed sparse image ๐ซ๏ธ
Sys::Virt::Domain::SAVE_PARAM_PARALLEL_CHANNELSโ specify the number of IO channels to use during parallel save or restore. ๐
๐ง DOMAIN CORE DUMP CONSTANTS ๐ง
The following constants can be used when triggering domain core dumps ๐ฅ
Sys::Virt::Domain::DUMP_LIVEโ do not pause execution while dumping the guest ๐โโ๏ธSys::Virt::Domain::DUMP_CRASHโ crash the guest after completing the core dump ๐Sys::Virt::Domain::DUMP_BYPASS_CACHEโ do not use OS I/O cache when writing core dump ๐ซSys::Virt::Domain::DUMP_RESETโ reset the virtual machine after finishing the dump ๐Sys::Virt::Domain::DUMP_MEMORY_ONLYโ only include guest RAM in the dump, not the device state ๐งฉ
๐ฃ DESTROY CONSTANTS ๐ฃ
The following constants are useful when terminating guests using the "destroy" API. ๐ซก
Sys::Virt::Domain::DESTROY_DEFAULTโ destroy the guest using the default approach ๐งจSys::Virt::Domain::DESTROY_GRACEFULโ destroy the guest in a graceful manner ๐๏ธSys::Virt::Domain::DESTROY_REMOVE_LOGSโ delete log files associated with the guest ๐๏ธ
๐ SHUTDOWN CONSTANTS ๐
The following constants are useful when requesting that a guest terminate using the "shutdown" API ๐
Sys::Virt::Domain::SHUTDOWN_DEFAULTโ shutdown using the hypervisorโs default mechanism โ๏ธSys::Virt::Domain::SHUTDOWN_GUEST_AGENTโ shutdown by issuing a command to a guest agent ๐คSys::Virt::Domain::SHUTDOWN_ACPI_POWER_BTNโ shutdown by injecting an ACPI power button press ๐Sys::Virt::Domain::SHUTDOWN_INITCTLโ shutdown by talking to initctl (containers only) ๐ฆSys::Virt::Domain::SHUTDOWN_SIGNALโ shutdown by sending SIGTERM to the init process ๐ถSys::Virt::Domain::SHUTDOWN_PARAVIRTโ shutdown by issuing a paravirt power control command ๐ช
๐ REBOOT CONSTANTS ๐
The following constants are useful when requesting that a guest terminate using the "reboot" API ๐
Sys::Virt::Domain::REBOOT_DEFAULTโ reboot using the hypervisorโs default mechanism โ๏ธSys::Virt::Domain::REBOOT_GUEST_AGENTโ reboot by issuing a command to a guest agent ๐คSys::Virt::Domain::REBOOT_ACPI_POWER_BTNโ reboot by injecting an ACPI power button press ๐Sys::Virt::Domain::REBOOT_INITCTLโ reboot by talking to initctl (containers only) ๐ฆSys::Virt::Domain::REBOOT_SIGNALโ reboot by sending SIGHUP to the init process ๐ถSys::Virt::Domain::REBOOT_PARAVIRTโ reboot by issuing a paravirt power control command ๐ช
๐ท๏ธ METADATA CONSTANTS ๐ท๏ธ
The following constants are useful when reading/writing metadata about a guest ๐
Sys::Virt::Domain::METADATA_TITLEโ the short human friendly title of the guest โจSys::Virt::Domain::METADATA_DESCRIPTIONโ the long free text description of the guest ๐Sys::Virt::Domain::METADATA_ELEMENTโ the structured metadata elements for the guest ๐งฉ
โ ๏ธ DISK ERROR CONSTANTS โ ๏ธ
The following constants are useful when interpreting disk error codes ๐ง
Sys::Virt::Domain::DISK_ERROR_NONEโ no error โSys::Virt::Domain::DISK_ERROR_NO_SPACEโ the host storage has run out of free space ๐ญSys::Virt::Domain::DISK_ERROR_UNSPECโ an unspecified error has occurred. โ
๐ MEMORY STATISTIC CONSTANTS ๐
Sys::Virt::Domain::MEMORY_STAT_SWAP_INโ swap in ๐Sys::Virt::Domain::MEMORY_STAT_SWAP_OUTโ swap out ๐Sys::Virt::Domain::MEMORY_STAT_MINOR_FAULTโ minor faults ๐ชถSys::Virt::Domain::MEMORY_STAT_MAJOR_FAULTโ major faults ๐งฑSys::Virt::Domain::MEMORY_STAT_RSSโ resident memory ๐Sys::Virt::Domain::MEMORY_STAT_UNUSEDโ unused memory ๐ซงSys::Virt::Domain::MEMORY_STAT_AVAILABLEโ available memory ๐ขSys::Virt::Domain::MEMORY_STAT_ACTUAL_BALLOONโ actual balloon limit ๐Sys::Virt::Domain::MEMORY_STAT_USABLEโ amount of usable memory ๐งSys::Virt::Domain::MEMORY_STAT_LAST_UPDATEโ time of last stats refresh from guest ๐Sys::Virt::Domain::MEMORY_STAT_DISK_CACHESโ disk cache size ๐ฝSys::Virt::Domain::MEMORY_STAT_HUGETLB_PGALLOCโ the amount of successful huge page allocations ๐Sys::Virt::Domain::MEMORY_STAT_HUGETLB_PGFAILโ the amount of failed huge page allocations ๐
๐ DOMAIN LIST CONSTANTS ๐
The following constants can be used when listing domains ๐๏ธ
Sys::Virt::Domain::LIST_ACTIVEโ only list domains that are currently active (running, or paused) ๐โโ๏ธSys::Virt::Domain::LIST_AUTOSTARTโ only list domains that are set to automatically start on boot ๐Sys::Virt::Domain::LIST_HAS_SNAPSHOTโ filters to only the domains that have a stored snapshot ๐ธSys::Virt::Domain::LIST_INACTIVEโ filters to only the domains that are currently inactive (shutoff, saved) ๐ดSys::Virt::Domain::LIST_MANAGEDSAVEโ filters to only the domains that currently have a managed save state ๐พSys::Virt::Domain::LIST_NO_AUTOSTARTโ filters to only the domains that are not set to automatically start on boto ๐ฅพ (yes bestie, "boto" โ that's literally what the source says, it means boot, we love a typo that ate)Sys::Virt::Domain::LIST_NO_MANAGEDSAVEโ filters to only the domains that have no managed save state at all ๐ซSys::Virt::Domain::LIST_NO_SNAPSHOTโ filters to only the domains with no stored snapshot ๐ โโ๏ธSys::Virt::Domain::LIST_OTHERโ filters to only the domains that are not running, paused or shutoff ๐ปSys::Virt::Domain::LIST_PAUSEDโ filters to only the domains that are paused โธ๏ธSys::Virt::Domain::LIST_PERSISTENTโ filters to only the domains that have a persistent config ๐Sys::Virt::Domain::LIST_RUNNINGโ filters to only the domains that are currently running ๐โโ๏ธSys::Virt::Domain::LIST_SHUTOFFโ filters to only the domains that are currently shutoff ๐Sys::Virt::Domain::LIST_TRANSIENTโ filters to only the domains that do not have a persistent config ๐ซงSys::Virt::Domain::LIST_HAS_CHECKPOINTโ filters to only the domains that have a stored checkpoint โSys::Virt::Domain::LIST_NO_CHECKPOINTโ filters to only the domains that do not have a stored checkpoint โ
๐ SEND KEY CONSTANTS ๐
These next ones are literally only for the send_key API, iykyk:
Sys::Virt::Domain::SEND_KEY_MAX_KEYSโ the maximum number of keys you can send in a single call tosend_keyโจ๏ธ (so like, don't go over it, the API said what it said)
๐ BLOCK STATS CONSTANTS ๐
These give you the names of the well known block stats fields ๐งพ:
Sys::Virt::Domain::BLOCK_STATS_ERRSโ the number of I/O errors ๐Sys::Virt::Domain::BLOCK_STATS_FLUSH_REQโ the number of flush requests ๐ฝSys::Virt::Domain::BLOCK_STATS_FLUSH_TOTAL_TIMESโ the time spent processing flush requests โฑ๏ธSys::Virt::Domain::BLOCK_STATS_READ_BYTESโ the amount of data read ๐Sys::Virt::Domain::BLOCK_STATS_READ_REQโ the number of read requests ๐๏ธSys::Virt::Domain::BLOCK_STATS_READ_TOTAL_TIMESโ the time spent processing read requests โณSys::Virt::Domain::BLOCK_STATS_WRITE_BYTESโ the amount of data written โ๏ธSys::Virt::Domain::BLOCK_STATS_WRITE_REQโ the number of write requests ๐Sys::Virt::Domain::BLOCK_STATS_WRITE_TOTAL_TIMESโ the time spent processing write requests ๐ฐ๏ธ
๐ง CPU STATS CONSTANTS ๐ง
The names of the well known cpu stats fields, iconic behaviour:
Sys::Virt::Domain::CPU_STATS_CPUTIMEโ the total CPU time, including both hypervisor and vCPU time ๐งฎSys::Virt::Domain::CPU_STATS_USERTIMEโ ok so the source literally says "THe total time in kernel" for this one ๐ (capital T and everything, and yeah it's describing kernel time under the *user*time constant โ I'm not fixing it, I'm just reporting it, bestie)Sys::Virt::Domain::CPU_STATS_SYSTEMTIMEโ and this one says "The total time in userspace" ๐ (same energy โ swapped descriptions, and honestly? we're just gonna sit with that)Sys::Virt::Domain::CPU_STATS_VCPUTIMEโ the total vCPU time โก
๐ง CPU STATS CONSTANTS ๐ง
Not a glitch, not me repeating myself โ the page literally has this heading twice ๐ญ but the vibe this time is schedular parameters (spelling theirs, not mine) ๐:
Sys::Virt::SCHEDULER_EMULATOR_PERIODโ the duration of the time period for scheduling the emulator โฒ๏ธSys::Virt::SCHEDULER_EMULATOR_QUOTAโ the quota for the emulator in one schedular time period ๐Sys::Virt::SCHEDULER_IOTHREAD_PERIODโ the duration of the time period for scheduling the iothread ๐งตSys::Virt::SCHEDULER_IOTHREAD_QUOTAโ the quota for the iothread in one schedular time period ๐
๐ฉ DOMAIN STATS FLAG CONSTANTS ๐ฉ
These are the flags you pass when requesting bulk domain stats from Sys::Virt::get_all_domain_stats ๐ฏ:
Sys::Virt::Domain::GET_ALL_STATS_ACTIVEโ include stats for active domains ๐ขSys::Virt::Domain::GET_ALL_STATS_INACTIVEโ include stats for inactive domains ๐ดSys::Virt::Domain::GET_ALL_STATS_OTHERโ include stats for other domains ๐ฝSys::Virt::Domain::GET_ALL_STATS_PAUSEDโ include stats for paused domains โธ๏ธSys::Virt::Domain::GET_ALL_STATS_PERSISTENTโ include stats for persistent domains ๐Sys::Virt::Domain::GET_ALL_STATS_RUNNINGโ include stats for running domains ๐Sys::Virt::Domain::GET_ALL_STATS_SHUTOFFโ include stats for shutoff domains ๐Sys::Virt::Domain::GET_ALL_STATS_TRANSIENTโ include stats for transient domains ๐ซงSys::Virt::Domain::GET_ALL_STATS_ENFORCE_STATSโ require that all requested stats fields are returned ๐ค no half-measuresSys::Virt::Domain::GET_ALL_STATS_BACKINGโ get stats for image backing files too ๐๏ธSys::Virt::Domain::GET_ALL_STATS_NOWAITโ skip stats if they can't be acquired without waiting โญ๏ธ (impatient queen energy)
๐๏ธ DOMAIN STATS FIELD CONSTANTS ๐๏ธ
These control which fields come back on a stats query ๐๏ธ:
๐ Sys::Virt::Domain::STATS_BALLOON
Balloon statistics. The following keys will be used for the returned parameters:
Sys::Virt::Domain::STATS_BALLOON_CURRENTโ the memory in kiB currently used, asunsigned long long๐งฎSys::Virt::Domain::STATS_BALLOON_MAXIMUMโ the maximum memory in kiB allowed, asunsigned long long๐Sys::Virt::Domain::STATS_BALLOON_SWAP_INโ the amount of data read from swap space (in KiB), asunsigned long long๐ฅSys::Virt::Domain::STATS_BALLOON_SWAP_OUTโ the amount of memory written out to swap space (in KiB), asunsigned long๐ค (note: plainunsigned longhere, notlong longโ that's how it's written)Sys::Virt::Domain::STATS_BALLOON_MAJOR_FAULTโ the number of page faults when disk IO was required, asunsigned long long๐ฅSys::Virt::Domain::STATS_BALLOON_MINOR_FAULTโ the number of other page faults, asunsigned long long๐ฉนSys::Virt::Domain::STATS_BALLOON_UNUSEDโ the amount of memory left unused by the system (in KiB), asunsigned long๐ซSys::Virt::Domain::STATS_BALLOON_AVAILABLEโ the amount of usable memory as seen by the domain (in KiB), asunsigned long๐งบSys::Virt::Domain::STATS_BALLOON_RSSโ Resident Set Size of running domain's process (in KiB), asunsigned long long๐งSys::Virt::Domain::STATS_BALLOON_USABLEโ the amount of memory which can be reclaimed by balloon without causing host swapping (in KiB), asunsigned long long๐Sys::Virt::Domain::STATS_BALLOON_LAST_UPDATEโ timestamp of the last update of statistics (in seconds), asunsigned long long๐Sys::Virt::Domain::STATS_BALLOON_DISK_CACHESโ the amount of memory that can be reclaimed without additional I/O, typically disk (in KiB), asunsigned long long๐ฝSys::Virt::Domain::STATS_BALLOON_HUGETLB_PGALLOCโ the number of successful huge page allocations from inside the domain via virtio balloon, asunsigned long long๐โSys::Virt::Domain::STATS_BALLOON_HUGETLB_PGFAILโ the number of failed huge page allocations from inside the domain via virtio balloon, asunsigned long long๐โ
๐ฝ Sys::Virt::Domain::STATS_BLOCK
Block device info. The following keys will be used for the returned parameters:
Sys::Virt::Domain::STATS_BLOCK_COUNTโ number of block devices in the subsequent list, asunsigned int๐ขSys::Virt::Domain::STATS_BLOCK_PREFIXโ the parameter name prefix to access each disk entry. Concatenate the prefix, the entry number formatted as an unsigned integer and one of the block suffix parameters to form a complete parameter name ๐งฉ (build-a-param workshop, we love to see it)Sys::Virt::Domain::STATS_BLOCK_SUFFIX_NAMEโ name of the block device as string. Matches the target name (vda/sda/hda) of the block device. If the backing chain is listed, this name is the same for all host resources tied to the same guest device ๐ท๏ธSys::Virt::Domain::STATS_BLOCK_SUFFIX_BACKINGINDEXโ the<backingStore>index asunsigned int, only used when backing images are listed ๐๏ธSys::Virt::Domain::STATS_BLOCK_SUFFIX_PATHโ source of the block device as a string, if it is a file or block device (omitted for network sources and drives with no media inserted) ๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_RD_REQSโ number of read requests, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_RD_BYTESโ number of read bytes, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_RD_TIMESโ total time (ns) spent on reads, asunsigned long longโฑ๏ธSys::Virt::Domain::STATS_BLOCK_SUFFIX_WR_REQSโ number of write requests, asunsigned long longโ๏ธSys::Virt::Domain::STATS_BLOCK_SUFFIX_WR_BYTESโ number of written bytes, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_WR_TIMESโ total time (ns) spent on writes, asunsigned long longโณSys::Virt::Domain::STATS_BLOCK_SUFFIX_FL_REQSโ total flush requests, asunsigned long long๐ฝSys::Virt::Domain::STATS_BLOCK_SUFFIX_FL_TIMESโ total time (ns) spent on cache flushing, asunsigned long long๐งผSys::Virt::Domain::STATS_BLOCK_SUFFIX_ERRORSโ Xen only: the'oo_req'value, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_ALLOCATIONโ offset of the highest written sector, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_CAPACITYโ logical size in bytes of the block device backing image, asunsigned long๐ฆ (yep, plainunsigned long)Sys::Virt::Domain::STATS_BLOCK_SUFFIX_PHYSICALโ physical size in bytes of the container of the backing image, asunsigned long long๐งฑSys::Virt::Domain::STATS_BLOCK_SUFFIX_THRESHOLDโ current threshold for delivering theVIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLDevent in bytes, asunsigned long long. SeevirDomainSetBlockThreshold๐จSys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_DISCARD_ALIGNMENTโ alignment for discard requests in bytes, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_DISCARD_MAXโ alignment for discard requests in bytes, asunsigned long long๐ (yeah, it says alignment again, same words as the one above โ I'm reporting, not adjudicating, bestie)Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_IOV_HW_MAXโ maximal number of scatter/gather elements of requests bypassing kernel IO scheduler, asunsigned long long๐Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_IOV_MAXโ maximum number of scatter/gather elements, asunsigned long long๐๏ธSys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_MEMORY_ALIGNMENT_MINIMALโ memory alignment in bytes so that no bounce buffer is needed, asunsigned long long๐งทSys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_MEMORY_ALIGNMENT_OPTIMALโ memory alignment in bytes that is used for bounce buffers, asunsigned long long๐ฏSys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_REQUEST_ALIGNMENTโ alignment requirement, in bytes, for offset/length of I/O requests, asunsigned long long๐
okay bestie, we're still in the block-stat suffix constants and they are long, but every single one is here so nobody has to guess ๐ โจ
Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_TRANSFER_HW_MAXโ max hardware transfer length, in bytes, for requests that bypass the kernel IO scheduler; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_TRANSFER_MAXโ max transfer length, in bytes; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_TRANSFER_OPTIMALโ optimal transfer length, in bytes; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_WRITE_ZEROES_ALIGNMENTโ optimal alignment forwrite_zeroesrequests, in bytes; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LIMITS_WRITE_ZEROES_MAXโ max number of bytes that can be zeroed out at once; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_COUNTโ number of groups of statistics accounted in configured time intervals; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_PREFIXโ the parameter-name prefix for each group of timed stats. Concatenate this prefix, the entry number formatted as an unsigned integer, and one of the timed-group suffix params to make a complete parameter name ๐ซถSys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_FLUSH_LATENCY_AVGโ average latency of flush operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_FLUSH_LATENCY_MAXโ maximum latency of flush operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_FLUSH_LATENCY_MINโ minimum latency of flush operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_INTERVALโ the time interval in seconds, asunsigned long long, for which the stats in this group were collected.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_RD_LATENCY_AVGโ average latency of read operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_RD_LATENCY_MAXโ maximum latency of read operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_RD_LATENCY_MINโ minimum latency of read operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_RD_QUEUE_DEPTH_AVGโ average number of pending read operations in the defined interval; type isdouble.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_WR_LATENCY_AVGโ average latency of write operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_WR_LATENCY_MAXโ maximum latency of write operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_WR_LATENCY_MINโ minimum latency of write operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_WR_QUEUE_DEPTH_AVGโ average number of pending write operations in the defined interval; type isdouble.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_ZONE_APPEND_LATENCY_AVGโ average latency of zone append operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_ZONE_APPEND_LATENCY_MAXโ maximum latency of zone append operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_ZONE_APPEND_LATENCY_MINโ minimum latency of zone append operations in the defined interval, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_TIMED_GROUP_SUFFIX_ZONE_APPEND_QUEUE_DEPTH_AVGโ average number of pending zone append operations in the defined interval; type isdouble.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_FLUSH_PREFIXโ the parameter-name prefix for'flush'latency histograms.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_READ_PREFIXโ the parameter-name prefix for'read'latency histograms.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_WRITE_PREFIXโ the parameter-name prefix for'write'latency histograms.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_ZONE_APPEND_PREFIXโ the parameter-name prefix for'zone_append'latency histograms.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_COUNTโ the parameter-name suffix for the number of bins in the histogram stats.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_PREFIXโ the parameter-name suffix for a latency histogram bin.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_STARTโ start of the current latency histogram bin, in nanoseconds.Sys::Virt::Domain::STATS_BLOCK_SUFFIX_LATENCY_HISTOGRAM_SUFFIX_BIN_SUFFIX_VALUEโ current value for the number of occurrences of latency within this bin.
Sys::Virt::Domain::STATS_CPU_TOTAL โ CPU usage info ๐ the following keys are the ones used for the returned parameters:
Sys::Virt::Domain::STATS_CPU_TIMEโ total CPU time spent for this domain, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_CPU_USERโ user CPU time spent, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_CPU_SYSTEMโ system CPU time spent, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_CPU_HALTPOLL_SUCCESS_TIMEโ halt-polling CPU usage for the VCPU polled until a virtual interrupt was delivered, in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_CPU_HALTPOLL_FAIL_TIMEโ halt-polling CPU usage for when the VCPU had to schedule out (either because the max poll time was reached or it needed to yield the CPU), in nanoseconds; type isunsigned long long.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_COUNTโ number of cache monitors for this domain; type isunsigned int.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_PREFIXโ parameter-name prefix for each cache monitor entry. Concatenate this prefix, the entry number formatted as an unsigned integer, and one of the cache-monitor suffix params to make a complete parameter name.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_SUFFIX_NAMEโ name of the cache monitor; type isstring.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_SUFFIX_VCPUSโ Vcpu list of the cache monitor; type isstring.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_SUFFIX_BANK_COUNTโ number of cache banks in the cache monitor; type isunsigned int.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_SUFFIX_BANK_PREFIXโ parameter-name prefix for each cache monitor bank entry. Concatenate the cache monitor prefix, the cache monitor entry number formatted as an unsigned integer, the bank prefix, the bank entry number formatted as an unsigned integer, and one of the cache monitor bank suffix params to make a complete parameter name โจSys::Virt::Domain::STATS_CPU_CACHE_MONITOR_SUFFIX_BANK_SUFFIX_IDโ host-allocated cache id for the bank; type isunsigned int.Sys::Virt::Domain::STATS_CPU_CACHE_MONITOR_SUFFIX_BANK_SUFFIX_BYTESโ number of bytes of last level cache that the domain is using; type isunsigned long long.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_COUNTโ number of energy monitors for this domain; type isunsigned int.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_PREFIXโ prefix for an individual energy monitor group. Concatenate it with the monitor index and one of the"cpu.energy.monitor.<i>."suffix constants below to make a full parameter name.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_SUFFIX_NAMEโ name of the monitor group; type isstring.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_SUFFIX_VCPUSโ vCPU set covered by the monitor group; type isstring.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_COUNTโ number ofPERF_PKGnodes the monitor group exposes; type isunsigned int.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_PREFIXโ prefix for a singlemon_PERF_PKGnode inside a monitor group.Sys::Virt::Domain::STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_SUFFIX_IDโ kernel-assignedmon_PERF_PKGnode id; type isunsigned int.
Sys::Virt::Domain::STATS_INTERFACE โ network interface info ๐ธ the following keys are the ones used for the returned parameters:
Sys::Virt::Domain::STATS_NET_COUNTโ number of network interfaces on this domain; type isunsigned int.Sys::Virt::Domain::STATS_NET_PREFIXโ parameter-name prefix for each interface entry. Concatenate this prefix, the entry number formatted as an unsigned integer, and one of the network suffix params to make a complete parameter name.Sys::Virt::Domain::STATS_NET_SUFFIX_NAMEโ name of the interface; type isstring.Sys::Virt::Domain::STATS_NET_SUFFIX_RX_BYTESโ bytes received; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_RX_PKTSโ packets received; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_RX_ERRSโ receive errors; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_RX_DROPโ receive packets dropped; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_TX_BYTESโ bytes transmitted; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_TX_PKTSโ packets transmitted; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_TX_ERRSโ transmission errors; type isunsigned long long.Sys::Virt::Domain::STATS_NET_SUFFIX_TX_DROPโ transmit packets dropped; type isunsigned long long.
Sys::Virt::Domain::STATS_STATE โ general lifecycle state. The following keys will be used for the returned parameters
Sys::Virt::Domain::STATS_STATE_STATE(the vibe of the VM rn) โ the state of the VM, handed back as anintfrom thevirDomainStateenum ๐Sys::Virt::Domain::STATS_STATE_REASONโ the reason it entered that state, returned as anintfrom thevirDomain*Reasonenum that matches the state in question ๐ซถ
Sys::Virt::Domain::STATS_VCPU
Virtual CPU info, bestie ๐ง โ the vCPU tea. These are the keys used for the returned parameters:
Sys::Virt::Domain::STATS_VCPU_CURRENTโ current number of online virtual CPUs, as anunsigned intโจSys::Virt::Domain::STATS_VCPU_MAXIMUMโ maximum number of online virtual CPUs, as anunsigned int๐Sys::Virt::Domain::STATS_VCPU_PREFIXโ the parameter name prefix used to reach each vCPU entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the vCPU suffix parameters, and boom โ you get a complete parameter name ๐
Ngl, due to VCPU hotplug the array can be sparse ๐ญ. The actual number of entries present corresponds toVIR_DOMAIN_STATS_VCPU_CURRENT, while the array size will never exceedVIR_DOMAIN_STATS_VCPU_MAXIMUM.
Sys::Virt::Domain::STATS_VCPU_SUFFIX_STATEโ the state of virtual CPU<num>, as anintfrom thevirVcpuStateenum ๐Sys::Virt::Domain::STATS_VCPU_SUFFIX_TIMEโ virtual cpu time spent by the virtual CPU, asunsigned long longโฑ๏ธSys::Virt::Domain::STATS_VCPU_SUFFIX_WAITโ the time the vCPU wants to run but the host scheduler has something else running ahead of it, asunsigned long longโ literally stuck in traffic fr fr ๐Sys::Virt::Domain::STATS_VCPU_SUFFIX_HALTEDโ virtual CPU is halted, as aboolean. Heads up: this may indicate the processor is idle or even disabled, depending on the architecture ๐Sys::Virt::Domain::STATS_VCPU_SUFFIX_DELAYโ the time the vCPU thread was enqueued by the host scheduler but was waiting in the queue instead of running. Exposed to the VM as steal time. In nanoseconds, asunsigned long long๐ฐ๏ธ
Sys::Virt::Domain::STATS_PERF
Performance event counter values โก โ the whole perf counter mood board. Here are the keys used for the returned parameters:
Sys::Virt::Domain::STATS_PERF_CMTโ the usage of l3 cache (bytes) by applications running on the platform, asunsigned long long. Produced by thecmtperf event ๐ธSys::Virt::Domain::STATS_PERF_MBMTโ the total system bandwidth (bytes/s) from one level of cache to another, asunsigned long long. Produced by thembmtperf event ๐ฆSys::Virt::Domain::STATS_PERF_MBMLโ the amount of data (bytes/s) sent through the memory controller on the socket, asunsigned long long. Produced by thembmlperf event ๐Sys::Virt::Domain::STATS_PERF_CACHE_MISSESโ the count of cache misses, asunsigned long long. Produced by thecache_missesperf event ๐ญSys::Virt::Domain::STATS_PERF_CACHE_REFERENCESโ the count of cache hits, asunsigned long long. Produced by thecache_referencesperf event ๐Sys::Virt::Domain::STATS_PERF_INSTRUCTIONSโ the count of instructions, asunsigned long long. Produced by theinstructionsperf event ๐Sys::Virt::Domain::STATS_PERF_CPU_CYCLESโ the count of cpu cycles (total/elapsed), as anunsigned long long. Produced by thecpu_cyclesperf event ๐ฅSys::Virt::Domain::STATS_PERF_BRANCH_INSTRUCTIONSโ the count of branch instructions, asunsigned long long. Produced by thebranch_instructionsperf event ๐ฟSys::Virt::Domain::STATS_PERF_BRANCH_MISSESโ the count of branch misses, asunsigned long long. Produced by thebranch_missesperf event ๐Sys::Virt::Domain::STATS_PERF_BUS_CYCLESโ the count of bus cycles, asunsigned long long. Produced by thebus_cyclesperf event ๐Sys::Virt::Domain::STATS_PERF_STALLED_CYCLES_FRONTENDโ the count of stalled cpu cycles in the frontend of the instruction processor pipeline, asunsigned long long. Produced by thestalled_cycles_frontendperf event ๐งSys::Virt::Domain::STATS_PERF_STALLED_CYCLES_BACKENDโ the count of stalled cpu cycles in the backend of the instruction processor pipeline, asunsigned long long. Produced by thestalled_cycles_backendperf event ๐งSys::Virt::Domain::STATS_PERF_REF_CPU_CYCLESโ the count of total cpu cycles not affected by CPU frequency scaling by applications running, asunsigned long long. Produced by theref_cpu_cyclesperf event โญSys::Virt::Domain::STATS_PERF_CPU_CLOCKโ the count of cpu clock time, asunsigned long long. Produced by thecpu_clockperf event โฐSys::Virt::Domain::STATS_PERF_TASK_CLOCKโ the count of task clock time, asunsigned long long. Produced by thetask_clockperf event โSys::Virt::Domain::STATS_PERF_PAGE_FAULTSโ the count of page faults, asunsigned long long. Produced by thepage_faultsperf event ๐Sys::Virt::Domain::STATS_PERF_CONTEXT_SWITCHESโ the count of context switches, asunsigned long long. Produced by thecontext_switchesperf event ๐Sys::Virt::Domain::STATS_PERF_CPU_MIGRATIONSโ the count of cpu migrations, from one logical processor to another, asunsigned long long. Produced by thecpu_migrationsperf event ๐ฆSys::Virt::Domain::STATS_PERF_PAGE_FAULTS_MINโ the count of minor page faults, asunsigned long long. Produced by thepage_faults_minperf event ๐Sys::Virt::Domain::STATS_PERF_PAGE_FAULTS_MAJโ the count of major page faults, asunsigned long long. Produced by thepage_faults_majperf event ๐Sys::Virt::Domain::STATS_PERF_ALIGNMENT_FAULTSโ the count of alignment faults, asunsigned long long. Produced by thealignment_faultsperf event ๐Sys::Virt::Domain::STATS_PERF_EMULATION_FAULTSโ the count of emulation faults, asunsigned long long. Produced by theemulation_faultsperf event ๐ญ
Sys::Virt::Domain::STATS_IOTHREAD
IOThread performance statistics values ๐งต โ yes, the IO threads get their own little stats era. These are the keys used for the returned parameters:
Sys::Virt::Domain::STATS_IOTHREAD_COUNTโ maximum number of IOThreads in the subsequent list, as anunsigned int. Each IOThread in the list uses itsiothread_idvalue as the array index ๐ซ
Real talk: there may be fewer array entries than the iothread.count value if the polling values aren't supported ๐
Sys::Virt::Domain::STATS_IOTHREAD_PREFIXโ the parameter name prefix used to reach each iothread entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the iothread suffix parameters to form a complete parameter name ๐Sys::Virt::Domain::STATS_IOTHREAD_SUFFIX_POLL_MAX_NSโ maximum polling time in ns, as anunsigned long long. A0(zero) means polling is disabled ๐ซSys::Virt::Domain::STATS_IOTHREAD_SUFFIX_POLL_GROWโ polling time factor, as anunsigned intorunsigned long longif it exceeds the range ofunsigned int. A0(zero) means "let the underlying hypervisor choose how to grow the polling time" ๐ฑSys::Virt::Domain::STATS_IOTHREAD_SUFFIX_POLL_SHRINKโ polling time divisor, as anunsigned intorunsigned long longif it exceeds the range ofunsigned int. A0(zero) means "let the underlying hypervisor choose how to shrink the polling time" ๐
Sys::Virt::Domain::STATS_MEMORY
Memory bandwidth statistics values ๐ โ memory go brrr, quantified. Here are the keys used for the returned parameters:
Sys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_COUNTโ the number of memory bandwidth monitors for this domain, as anunsigned int๐ขSys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_PREFIXโ the parameter name prefix used to reach each bandwidth monitor entry. Concatenate the prefix, the entry number formatted as an unsigned integer, and one of the memory bandwidth suffix parameters to form a complete parameter name ๐Sys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NAMEโ the name of the bandwidth monitor, as astring๐ท๏ธSys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_VCPUSโ the vcpu list of the bandwidth monitor, as astring๐ฏSys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_COUNTโ the number of memory controllers in the bandwidth monitor ๐Sys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_PREFIXโ the parameter name prefix used to reach each controller entry. Concatenate the bandwidth monitor prefix, the monitor entry number formatted as an unsigned integer, the controller prefix, the controller entry number formatted as an unsigned integer, and one of the controller suffix parameters to form a complete parameter name ๐ช (yes it nests, it's giving nesting dolls)Sys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_IDโ host allocated memory controller id for the controller, as anunsigned int๐Sys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_LOCALโ the accumulative bytes consumed by vcpus passing through the memory controller in the same processor that the scheduled host CPU belongs to, as anunsigned long long๐Sys::Virt::Domain::STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_TOTALโ the accumulative bytes consumed by vcpus passing through all memory controllers, either local or remote, as anunsigned long long๐
Sys::Virt::Domain::STATS_DIRTYRATE
Memory dirty rate statistics ๐งผ โ how fast your memory is getting messy. These are the keys used for the returned parameters:
Sys::Virt::Domain::STATS_DIRTYRATE_CALC_STATUSโ the status of the last memory dirty rate calculation, as anintfrom thevirDomainDirtyRateStatusenum ๐Sys::Virt::Domain::STATS_DIRTYRATE_CALC_START_TIMEโ the start time in seconds of the last memory dirty rate calculation, aslong long๐Sys::Virt::Domain::STATS_DIRTYRATE_CALC_PERIODโ the period in seconds of the last memory dirty rate calculation, asintโณSys::Virt::Domain::STATS_DIRTYRATE_MEGABYTES_PER_SECONDโ the calculated memory dirty rate in MiB/s, aslong long๐
It's produced only if the calc_status is measured, bestie โ no measurement, no number ๐
Sys::Virt::Domain::STATS_DIRTYRATE_CALC_MODEโ the calculation mode used for the last measurement, handed back to you as a string, and it's one of these three values:'page-sampling','dirty-bitmap'or'dirty-ring'. Three icons, pick your fighter ๐Sys::Virt::Domain::STATS_DIRTYRATE_VCPU_PREFIXโ the parameter name prefix you use to reach each VCPU entry. Glue the prefix + the entry number (formatted as an unsigned integer) + one of the VCPU suffix parameters together and boom, you've got yourself a complete parameter name. It's giving build-a-bear but for keys ๐งธSys::Virt::Domain::STATS_DIRTYRATE_VCPU_SUFFIX_MEGABYTES_PER_SECONDโ the calculated memory dirty rate for a virtual cpu, as anunsigned long long. Yes bestie, the whole long long. ๐
Sys::Virt::Domain::STATS_VM
Hypervisor-specific stats fields for the given VM. โจ
The following keys are what gets used for the returned parameters:
Sys::Virt::Domain::STATS_VM_PREFIXโ concatenate the prefix, a hypervisor specific custom stats name, and one of theVIR_DOMAIN_STATS_CUSTOM_TYPE_*constants to form a complete parameter name.
The "STATS_VM" and "STATS_VCPU" types also use the following parameters for hypervisor specific statistics:
Sys::Virt::Domain::STATS_CUSTOM_SUFFIX_TYPE_CURโ hypervisor specific custom data type for the current instant value.
The complete parameter name is formed by concatenating the field prefix, the array index formatted as an unsigned integer, a hypervisor specific parameter name, and this data type suffix. Chain them in that exact order, no cap ๐ซถ
Sys::Virt::Domain::STATS_CUSTOM_SUFFIX_TYPE_MAXโ hypervisor specific custom data type for the aggregate value.
The complete parameter name is formed by concatenating the field prefix, the array index formatted as an unsigned integer, a hypervisor specific parameter name, and this data type suffix.
Sys::Virt::Domain::STATS_CUSTOM_SUFFIX_TYPE_SUMโ hypervisor specific custom data type for the peak value.
The complete parameter name is formed by concatenating the field prefix, the array index formatted as an unsigned integer, a hypervisor specific parameter name, and this data type suffix.
๐ธ PROCESS SIGNALS ๐ธ
These constants give you the names of signals you can send to guest processes. They mostly correspond to POSIX signal names โ literally the classic lineup, bestie. ๐
Sys::Virt::Domain::PROCESS_SIGNAL_NOPโSIGNOPSys::Virt::Domain::PROCESS_SIGNAL_HUPโSIGHUPSys::Virt::Domain::PROCESS_SIGNAL_INTโSIGINTSys::Virt::Domain::PROCESS_SIGNAL_QUITโSIGQUITSys::Virt::Domain::PROCESS_SIGNAL_ILLโSIGILLSys::Virt::Domain::PROCESS_SIGNAL_TRAPโSIGTRAPSys::Virt::Domain::PROCESS_SIGNAL_ABRTโSIGABRTSys::Virt::Domain::PROCESS_SIGNAL_BUSโSIGBUSSys::Virt::Domain::PROCESS_SIGNAL_FPEโSIGFPESys::Virt::Domain::PROCESS_SIGNAL_KILLโSIGKILLSys::Virt::Domain::PROCESS_SIGNAL_USR1โSIGUSR1Sys::Virt::Domain::PROCESS_SIGNAL_SEGVโSIGSEGVSys::Virt::Domain::PROCESS_SIGNAL_USR2โSIGUSR2Sys::Virt::Domain::PROCESS_SIGNAL_PIPEโSIGPIPESys::Virt::Domain::PROCESS_SIGNAL_ALRMโSIGALRMSys::Virt::Domain::PROCESS_SIGNAL_TERMโSIGTERMSys::Virt::Domain::PROCESS_SIGNAL_STKFLTโSIGSTKFLTSys::Virt::Domain::PROCESS_SIGNAL_CHLDโSIGCHLDSys::Virt::Domain::PROCESS_SIGNAL_CONTโSIGCONTSys::Virt::Domain::PROCESS_SIGNAL_STOPโSIGSTOPSys::Virt::Domain::PROCESS_SIGNAL_TSTPโSIGTSTPSys::Virt::Domain::PROCESS_SIGNAL_TTINโSIGTTINSys::Virt::Domain::PROCESS_SIGNAL_TTOUโSIGTTOUSys::Virt::Domain::PROCESS_SIGNAL_URGโSIGURGSys::Virt::Domain::PROCESS_SIGNAL_XCPUโSIGXCPUSys::Virt::Domain::PROCESS_SIGNAL_XFSZโSIGXFSZSys::Virt::Domain::PROCESS_SIGNAL_VTALRMโSIGVTALRMSys::Virt::Domain::PROCESS_SIGNAL_PROFโSIGPROFSys::Virt::Domain::PROCESS_SIGNAL_WINCHโSIGWINCHSys::Virt::Domain::PROCESS_SIGNAL_POLLโSIGPOLLSys::Virt::Domain::PROCESS_SIGNAL_PWRโSIGPWRSys::Virt::Domain::PROCESS_SIGNAL_SYSโSIGSYSSys::Virt::Domain::PROCESS_SIGNAL_RT0โSIGRT0Sys::Virt::Domain::PROCESS_SIGNAL_RT1โSIGRT1Sys::Virt::Domain::PROCESS_SIGNAL_RT2โSIGRT2Sys::Virt::Domain::PROCESS_SIGNAL_RT3โSIGRT3Sys::Virt::Domain::PROCESS_SIGNAL_RT4โSIGRT4Sys::Virt::Domain::PROCESS_SIGNAL_RT5โSIGRT5Sys::Virt::Domain::PROCESS_SIGNAL_RT6โSIGRT6Sys::Virt::Domain::PROCESS_SIGNAL_RT7โSIGRT7Sys::Virt::Domain::PROCESS_SIGNAL_RT8โSIGRT8Sys::Virt::Domain::PROCESS_SIGNAL_RT9โSIGRT9Sys::Virt::Domain::PROCESS_SIGNAL_RT10โSIGRT10Sys::Virt::Domain::PROCESS_SIGNAL_RT11โSIGRT11Sys::Virt::Domain::PROCESS_SIGNAL_RT12โSIGRT12Sys::Virt::Domain::PROCESS_SIGNAL_RT13โSIGRT13Sys::Virt::Domain::PROCESS_SIGNAL_RT14โSIGRT14Sys::Virt::Domain::PROCESS_SIGNAL_RT15โSIGRT15Sys::Virt::Domain::PROCESS_SIGNAL_RT16โSIGRT16Sys::Virt::Domain::PROCESS_SIGNAL_RT17โSIGRT17Sys::Virt::Domain::PROCESS_SIGNAL_RT18โSIGRT18Sys::Virt::Domain::PROCESS_SIGNAL_RT19โSIGRT19Sys::Virt::Domain::PROCESS_SIGNAL_RT20โSIGRT20Sys::Virt::Domain::PROCESS_SIGNAL_RT21โSIGRT21Sys::Virt::Domain::PROCESS_SIGNAL_RT22โSIGRT22Sys::Virt::Domain::PROCESS_SIGNAL_RT23โSIGRT23Sys::Virt::Domain::PROCESS_SIGNAL_RT24โSIGRT24Sys::Virt::Domain::PROCESS_SIGNAL_RT25โSIGRT25Sys::Virt::Domain::PROCESS_SIGNAL_RT26โSIGRT26Sys::Virt::Domain::PROCESS_SIGNAL_RT27โSIGRT27Sys::Virt::Domain::PROCESS_SIGNAL_RT28โSIGRT28Sys::Virt::Domain::PROCESS_SIGNAL_RT29โSIGRT29Sys::Virt::Domain::PROCESS_SIGNAL_RT30โSIGRT30Sys::Virt::Domain::PROCESS_SIGNAL_RT31โSIGRT31Sys::Virt::Domain::PROCESS_SIGNAL_RT32โSIGRT32
๐ DOMAIN TUNABLE CONSTANTS ๐
These constants come in clutch when you're accessing domain tuning parameters in APIs and events. Obsessed with a well-named constant tbh. ๐ฅ
Sys::Virt::Domain::TUNABLE_CPU_CPU_SHARESโ proportional CPU weightSys::Virt::Domain::TUNABLE_CPU_EMULATORPINโ emulator thread CPU pinning maskSys::Virt::Domain::TUNABLE_CPU_EMULATOR_PERIODโ emulator thread CPU periodSys::Virt::Domain::TUNABLE_CPU_EMULATOR_QUOTAโ emulator thread CPU quotaSys::Virt::Domain::TUNABLE_CPU_IOTHREAD_PERIODโ Iothread thread CPU periodSys::Virt::Domain::TUNABLE_CPU_IOTHREAD_QUOTAโ Iothread thread CPU quotaSys::Virt::Domain::TUNABLE_CPU_VCPUPINโ VCPU thread pinning maskSys::Virt::Domain::TUNABLE_CPU_VCPU_PERIODโ VCPU thread periodSys::Virt::Domain::TUNABLE_CPU_VCPU_QUOTAโ VCPU thread quotaSys::Virt::Domain::TUNABLE_CPU_GLOBAL_PERIODโ VM global periodSys::Virt::Domain::TUNABLE_CPU_GLOBAL_QUOTAโ VM global quotaSys::Virt::Domain::TUNABLE_BLKDEV_DISKโ the name of guest disksSys::Virt::Domain::TUNABLE_BLKDEV_READ_BYTES_SECโ read throughput in bytes per secSys::Virt::Domain::TUNABLE_BLKDEV_READ_IOPS_SECโ read throughput in I/O operations per secSys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_BYTES_SECโ total throughput in bytes per secSys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_IOPS_SECโ total throughput in I/O operations per secSys::Virt::Domain::TUNABLE_BLKDEV_WRITE_BYTES_SECโ write throughput in bytes per secSys::Virt::Domain::TUNABLE_BLKDEV_WRITE_IOPS_SECโ write throughput in I/O operations per secSys::Virt::Domain::TUNABLE_BLKDEV_READ_BYTES_SEC_MAXโ maximum read throughput in bytes per secSys::Virt::Domain::TUNABLE_BLKDEV_READ_IOPS_SEC_MAXโ maximum read throughput in I/O operations per secSys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAXโ maximum total throughput in bytes per secSys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAXโ maximum total throughput in I/O operations per secSys::Virt::Domain::TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAXโ maximum write throughput in bytes per secSys::Virt::Domain::TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAXโ maximum write throughput in I/O operations per secSys::Virt::Domain::TUNABLE_BLKDEV_SIZE_IOPS_SECโ the maximum I/O operations per secondSys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum total bytes processed per second.Sys::Virt::Domain::TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum bytes read per second.Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum bytes written per second.Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum total I/O operations processed per second.Sys::Virt::Domain::TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum I/O operations read per second.Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTHโ the duration in seconds allowed for maximum I/O operations written per second.Sys::Virt::Domain::TUNABLE_BLKDEV_GROUP_NAMEโ the name of the blkdev groupSys::Virt::Domain::TUNABLE_IOTHREADSPINโ the I/O threads pinning
๐ฆ DOMAIN LIFECYCLE CONSTANTS ๐ฆ
These constants are the ones you want when you're setting the action for lifecycle events. ๐
Sys::Virt::Domain::LIFECYCLE_POWEROFFโ the poweroff lifecycle event typeSys::Virt::Domain::LIFECYCLE_REBOOTโ the reboot lifecycle event typeSys::Virt::Domain::LIFECYCLE_CRASHโ the crash lifecycle event type
๐ DOMAIN LIFECYCLE ACTION CONSTANTS ๐
Sys::Virt::Domain::LIFECYCLE_ACTION_DESTROYโ the destroy lifecycle actionSys::Virt::Domain::LIFECYCLE_ACTION_RESTARTโ the restart lifecycle actionSys::Virt::Domain::LIFECYCLE_ACTION_RESTART_RENAMEโ the restart-rename lifecycle actionSys::Virt::Domain::LIFECYCLE_ACTION_PRESERVEโ the preserve lifecycle actionSys::Virt::Domain::LIFECYCLE_ACTION_COREDUMP_DESTROYโ the coredump-destroy lifecycle actionSys::Virt::Domain::LIFECYCLE_ACTION_COREDUMP_RESTARTโ the coredump-restart lifecycle action
๐ MEMORY FAILURE ACTION CONSTANTS ๐
Sys::Virt::Domain::EVENT_MEMORY_FAILURE_ACTION_IGNOREโ the failure could be ignoredSys::Virt::Domain::EVENT_MEMORY_FAILURE_ACTION_INJECTโ an MCE was injected to the guestSys::Virt::Domain::EVENT_MEMORY_FAILURE_ACTION_FATALโ the failure is non-recoverable and the hypervisor was not able to handle it ๐ญSys::Virt::Domain::EVENT_MEMORY_FAILURE_ACTION_RESETโ the failure is non-recoverable and the guest was not able to handle it.
๐ MEMORY FAILURE RECIPIENT CONSTANTS ๐
Sys::Virt::Domain::EVENT_MEMORY_FAILURE_RECIPIENT_HYPERVISORโ the memory failure was in hypervisor address space ๐Sys::Virt::Domain::EVENT_MEMORY_FAILURE_RECIPIENT_GUESTโ the memory failure was in guest address space ๐ง
๐ฉ MEMORY FAILURE FLAG CONSTANTS ๐ฉ
Sys::Virt::Domain::MEMORY_FAILURE_ACTION_REQUIREDโ whether the flag is action-required or action-optional โญSys::Virt::Domain::MEMORY_FAILURE_RECURSIVEโ the failure occurred while the previous fault was being handled. ๐
๐งผ MEMORY DIRTY RATE STATUS CONSTANTS ๐งผ
Sys::Virt::Domain::DIRTYRATE_UNSTARTEDโ the dirty rate is not being measured currently. ๐ดSys::Virt::Domain::DIRTYRATE_MEASURINGโ the dity rate is in the process of being measured ๐ซถSys::Virt::Domain::DIRTYRATE_MEASUREDโ the dirty rate has been measured ๐
๐ AUTHORS ๐
Daniel P. Berrange <berrange@redhat.com> โ that's the icon behind this page, bestie. ๐
๐ COPYRIGHT ๐
Copyright (C) 2006 Red Hat Copyright (C) 2006-2007 Daniel P. Berrange
๐ LICENSE ๐
Okay so the legal vibe is: This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file. ๐
๐ SEE ALSO ๐
Sys::VirtSys::Virt::Error"http://libvirt.org"
Go check these out, iykyk. โจ
and that's a wrap, bestie! ๐ This page's footer energy is perl v5.40.2 and 2026-06-08 under the Sys::V...:Domain(3pm) label โ iconic, no cap. ๐
๐ฆ where this page comes from
- epel 10: perl-Sys-Virt 12.4.0-1.el10_3 ยท GPL-2.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms