21.28. Retrieving Guest Virtual Machine Information

21.28.1. Getting the Domain ID of a Guest Virtual Machine

The virsh domid command returns the guest virtual machine's ID. Note that this changes each time the guest starts or restarts. This command requires either the name of the virtual machine or the virtual machine's UUID.

Example 21.68. How to retrieve the domain ID for a guest virtual machine

The following example retrieves the domain ID of a guest virtual machine named guest1:
virsh domid guest1
8
Note, domid returns - for guest virtual machines that are in shut off state. To confirm that the virtual machine is shutoff, you can run the virsh list --all command.

21.28.2. Getting the Domain Name of a Guest Virtual Machine

The virsh domname command returns the name of the guest virtual machine given its ID or UUID. Note that the ID changes each time the guest starts.

Example 21.69. How to retrieve a virtual machine's ID

The following example retrieves the name for the guest virtual machine whose ID is 8:
virsh domname 8
guest1

21.28.3. Getting the UUID of a Guest Virtual Machine

The virsh domuuid command returns the UUID or the Universally Unique Identifier for a given guest virtual machine or ID.

Example 21.70. How to display the UUID for a guest virtual machine

The following example retrieves the UUID for the guest virtual machine named guest1:
virsh domuuid guest1
r5b2-mySQL01 4a4c59a7-ee3f-c781-96e4-288f2862f011

21.28.4. Displaying Guest Virtual Machine Information

The virsh dominfo command displays information on that guest virtual machine given a virtual machine's name, ID, or UUID. Note that the ID changes each time the virtual machine starts.

Example 21.71. How to display guest virtual machine general details

The following example displays the general details about the guest virtual machine named guest1:
virsh dominfo guest1
Id:             8
Name:           guest1
UUID:           90e0d63e-d5c1-4735-91f6-20a32ca22c48
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       32.6s
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:c552,c818 (enforcing)