21.17. Guest Virtual Machine Retrieval Commands
21.17.1. Displaying the Host Physical Machine Name
virsh domhostname domaincommand displays the specified guest virtual machine's physical host name provided the hypervisor can publish it.
Example 21.39. How to display the host physical machine name
virsh domhostname guest1
21.17.2. Displaying General Information about a Virtual Machine
virsh dominfo domaincommand displays basic information about a specified guest virtual machine. This command may also be used with the option
Example 21.40. How to display general information about the guest virtual machine
virsh dominfo guest1Id: 8 Name: guest1 UUID: 90e0d63e-d5c1-4735-91f6-20a32ca22c40 OS Type: hvm State: running CPU(s): 1 CPU time: 271.9s Max memory: 1048576 KiB Used memory: 1048576 KiB Persistent: yes Autostart: disable Managed save: no Security model: selinux Security DOI: 0 Security label: system_u:system_r:svirt_t:s0:c422,c469 (enforcing)
21.17.3. Displaying a Virtual Machine's ID Number
virsh listincludes the ID in its output, the
virsh domid domain>|<IDdisplays the ID for the guest virtual machine, provided it is running. An ID will change each time you run the virtual machine. If guest virtual machine is shut off, the machine name will be displayed as a series of dashes ('-----'). This command may also be used with the
Example 21.41. How to display a virtual machine's ID number
virsh domid guest18
21.17.4. Aborting Running Jobs on a Guest Virtual Machine
virsh domjobabort domaincommand aborts the currently running job on the specified guest virtual machine. This command may also be used with the
Example 21.42. How to abort a running job on a guest virtual machine
virsh domjobabort guest1
21.17.5. Displaying Information about Jobs Running on the Guest Virtual Machine
virsh domjobinfo domaincommand displays information about jobs running on the specified guest virtual machine, including migration statistics. This command may also be used with the
[--domain guestname]option, or with the
--completedoption to return information on the statistics of a recently completed job.
Example 21.43. How to display statistical feedback
virsh domjobinfo guest1Job type: Unbounded Time elapsed: 1603 ms Data processed: 47.004 MiB Data remaining: 658.633 MiB Data total: 1.125 GiB Memory processed: 47.004 MiB Memory remaining: 658.633 MiB Memory total: 1.125 GiB Constant pages: 114382 Normal pages: 12005 Normal data: 46.895 MiB Expected downtime: 0 ms Compression cache: 64.000 MiB Compressed data: 0.000 B Compressed pages: 0 Compression cache misses: 12005 Compression overflows: 0
21.17.6. Displaying the Guest Virtual Machine's Name
virsh domname domainIDcommand displays the name guest virtual machine name, given its ID or UUID. Although the
virsh list --allcommand will also display the guest virtual machine's name, this command only lists the guest's name.
Example 21.44. How to display the name of the guest virtual machine
virsh domname 8guest1
21.17.7. Displaying the Virtual Machine's State
virsh domstate domaincommand displays the state of the given guest virtual machine. Using the
--reasonargument will also display the reason for the displayed state. This command may also be used with the
[--domain guestname]option, as well as the
--reasonoption, which displays the reason for the state. If the command reveals an error, you should run the command
virsh domblkerror. Refer to Section 21.12.7, “Displaying Errors on Block Devices” for more details.
Example 21.45. How to display the guest virtual machine's current state
virsh domstate guest1running
21.17.8. Displaying the Connection State to the Virtual Machine
virsh domcontrol domaindisplays the state of an interface to the hypervisor that is used to control a specified guest virtual machine. For states that are not OK or Error, it will also print the number of seconds that have elapsed since the control interface entered the displayed state.
Example 21.46. How to display the guest virtual machine's interface state
virsh domcontrol guest1ok