20.17. Guest Virtual Machine Retrieval Commands 20.17.1. Displaying the Host Physical Machine Name The virsh domhostname domain command displays the specified guest virtual machine's physical host name provided the hypervisor can publish it. Example 20.39. How to display the host physical machine name The following example displays the host physical machine name for the guest1 virtual machine, if the hypervisor makes it available: # virsh domhostname guest1 20.17.2. Displaying General Information about a Virtual Machine The virsh dominfo domain command displays basic information about a specified guest virtual machine. This command may also be used with the option [--domain] guestname . Example 20.40. How to display general information about the guest virtual machine The following example displays general information about the guest virtual machine named guest1 : 20.17.3. Displaying a Virtual Machine's ID Number Although virsh list includes the ID in its output, the virsh domid domain>|<ID displays 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 [--domain guestname ] option. Example 20.41. How to display a virtual machine's ID number In order to run this command and receive any usable output, the virtual machine should be running. The following example produces the ID number of the guest1 virtual machine: 20.17.4. Aborting Running Jobs on a Guest Virtual Machine The virsh domjobabort domain command aborts the currently running job on the specified guest virtual machine. This command may also be used with the [--domain guestname ] option. Example 20.42. How to abort a running job on a guest virtual machine In this example, there is a job running on the guest1 virtual machine that you want to abort. When running the command, change guest1 to the name of your virtual machine: # virsh domjobabort guest1 20.17.5. Displaying Information about Jobs Running on the Guest Virtual Machine The virsh domjobinfo domain command 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 --completed option to return information on the statistics of a recently completed job. Example 20.43. How to display statistical feedback The following example lists statistical information about the guest1 virtual machine: 20.17.6. Displaying the Guest Virtual Machine's Name The virsh domname domainID command displays the name guest virtual machine name, given its ID or UUID. Although the virsh list --all command will also display the guest virtual machine's name, this command only lists the guest's name. Example 20.44. How to display the name of the guest virtual machine The following example displays the name of the guest virtual machine with domain ID 8 : 20.17.7. Displaying the Virtual Machine's State The virsh domstate domain command displays the state of the given guest virtual machine. Using the --reason argument will also display the reason for the displayed state. This command may also be used with the [--domain guestname ] option, as well as the --reason option, which displays the reason for the state. If the command reveals an error, you should run the command virsh domblkerror . See Section 20.12.7, "Displaying Errors on Block Devices" for more details. Example 20.45. How to display the guest virtual machine's current state The following example displays the current state of the guest1 virtual machine: 20.17.8. Displaying the Connection State to the Virtual Machine virsh domcontrol domain displays 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 20.46. How to display the guest virtual machine's interface state The following example displays the current state of the guest1 virtual machine's interface.

Commands:
virsh dominfo guest1 Id: 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)
virsh domid guest1 8
virsh domjobinfo guest1 Job 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
virsh domname 8 guest1
virsh domstate guest1 running
virsh domcontrol guest1 ok