20.12. Retrieving Information about Your Virtual Machine
20.12.1. Displaying Device Block Statistics Copy linkLink copied to clipboard!
virsh domblkstat
command displays the block statistics for the first block device defined for the domain. To view statistics of other block devices, use the virsh domblklist domain
command to list all block devices, and then select a specific block device and display it by specifying either the Target or Source name from the virsh domblklist
command output after the domain name. Note that not every hypervisor can display every field. To make sure that the output is presented in its most legible form use the --human
argument.
Example 20.21. How to display block statistics for a guest virtual machine
20.12.2. Retrieving Network Interface Statistics Copy linkLink copied to clipboard!
virsh domifstat domain interface-device
command displays the network interface statistics for the specified device running on a given guest virtual machine.
virsh domiflist
command and use the output in the Interface column.
Example 20.22. How to display networking statistics for a guest virtual machine
20.12.3. Modifying the Link State of a Guest Virtual Machine's Virtual Interface Copy linkLink copied to clipboard!
virsh domif-setlink domain interface-device state
command configures the status of the specified interface device link state as either up
or down
. To determine which interface devices are defined for the domain, use the virsh domiflist
command and use either the Interface
or MAC
column as the interface device option. By default, virsh domif-setlink
changes the link state for the running domain. To modify the domain's persistent configuration use the --config
argument.
Example 20.23. How to enable a guest virtual machine interface
20.12.4. Listing the Link State of a Guest Virtual Machine's Virtual Interface Copy linkLink copied to clipboard!
virsh domif-getlink domain interface-device
command retrieves the specified interface device link state. To determine which interface devices are defined for the domain, use the virsh domiflist
command and use either the Interface
or MAC
column as the interface device option. By default, virsh domif-getlink
retrieves the link state for the running domain. To retrieve the domain's persistent configuration use the --config option
.
Example 20.24. How to display the link state of a guest virtual machine's interface
20.12.5. Setting Network Interface Bandwidth Parameters Copy linkLink copied to clipboard!
virsh domiftune domain interface-device
command either retrieves or sets the specified domain's interface bandwidth parameters. To determine which interface devices are defined for the domain, use the virsh domiflist
command and use either the Interface
or MAC
column as the interface device option. The following format should be used:
virsh domiftune domain interface [--inbound] [--outbound] [--config] [--live] [--current]
# virsh domiftune domain interface [--inbound] [--outbound] [--config] [--live] [--current]virsh domiftune domain interface [--inbound] [--outbound] [--config] [--live] [--current]virsh domiftune domain interface [--inbound] [--outbound] [--config] [--live] [--current]virsh domiftune domain interface [--inbound] [--outbound] [--config] [--live] [--current]virsh domiftune domain interface [--inbound] [--outbound] [--config] [--live] [--current]
--config
, --live
, and --current
options are described in Section 20.43, “Setting Schedule Parameters”. If the --inbound
or the --outbound
option is not specified, virsh domiftune
queries the specified network interface and displays the bandwidth settings. By specifying --inbound
or --outbound
, or both, and the average, peak, and burst values, virsh domiftune
sets the bandwidth settings. At minimum the average value is required. In order to clear the bandwidth settings, provide 0 (zero). For a description of the average, peak, and burst values, see Section 20.27.6.2, “Attaching interface devices”.
Example 20.25. How to set the guest virtual machine network interface parameters
virsh domiftune guest1 eth0 outbound --live
# virsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --livevirsh domiftune guest1 eth0 outbound --live
20.12.6. Retrieving Memory Statistics Copy linkLink copied to clipboard!
virsh dommemstat domain [<period in seconds>] [--config] [--live] [--current]
command displays the memory statistics for a running guest virtual machine. Using the optional period
switch requires a time period in seconds. Setting this option to a value larger than 0 will allow the balloon driver to return additional statistics which will be displayed by running subsequent dommemstat
commands. Setting the period
option to 0, stops the balloon driver collection but does not clear the statistics already in the balloon driver. You cannot use the --live
, --config
, or --current
options without also setting the period
option. If the --live
option is specified, only the guest's running statistics will be collected. If the --config
option is used, it will collect the statistics for a persistent guest, but only after the next boot. If the --current
option is used, it will collect the current statistics.
--live
and --config
options may be used but --current
is exclusive. If no flag is specified, the guest's state will dictate the behavior of the statistics collection (running or not).
Example 20.26. How to collect memory statistics for a running guest virtual machine
20.12.7. Displaying Errors on Block Devices Copy linkLink copied to clipboard!
virsh domblkerror domain
command lists all the block devices in the error state and the error detected on each of them. This command is best used after a virsh domstate
command reports that a guest virtual machine is paused due to an I/O error.
Example 20.27. How to display the block device errors for a virtual machine
virsh domblkerror guest1
# virsh domblkerror guest1virsh domblkerror guest1
20.12.8. Displaying the Block Device Size Copy linkLink copied to clipboard!
virsh domblkinfo domain
command lists the capacity, allocation, and physical block sizes for a specific block device in the virtual machine. Use the virsh domblklist command to list all block devices and then choose to display a specific block device by specifying either the Target or Source name from the virsh domblklist
output after the domain name.
Example 20.28. How to display the block device size
20.12.9. Displaying the Block Devices Associated with a Guest Virtual Machine Copy linkLink copied to clipboard!
virsh domblklist domain [--inactive]
[--details]
command displays a table of all block devices that are associated with the specified guest virtual machine.
--inactive
is specified, the result will show the devices that are to be used at the next boot and will not show those that are currently running in use by the running guest virtual machine. If --details
is specified, the disk type and device value will be included in the table. The information displayed in this table can be used with other commands that require a block-device to be provided, such as virsh domblkinfo
and virsh snapshot-create
. The disk Target or Source contexts can also be used when generating the xmlfile context information for the virsh snapshot-create
command.
Example 20.29. How to display the block devices that are associated with a virtual machine
20.12.10. Displaying Virtual Interfaces Associated with a Guest Virtual Machine Copy linkLink copied to clipboard!
virsh domblklist domain
command displays a table of all the virtual interfaces that are associated with the specified domain. The virsh domiflist
command requires the name of the virtual machine (or domain), and optionally can take the --inactive
argument. The latter retrieves the inactive rather than the running configuration, which is retrieved with the default setting. If --inactive
is specified, the result shows devices that are to be used at the next boot, and does not show devices that are currently in use by the running guest. Virsh commands that require a MAC address of a virtual interface (such as detach-interface
, domif-setlink
, domif-getlink
, domifstat
, and domiftune
) accept the output displayed by this command.
Example 20.30. How to display the virtual interfaces associated with a guest virtual machine