Chapter 9. Viewing information about virtual machines
When you need to adjust or troubleshoot any aspect of your virtualization deployment on RHEL 10, the first step you need to perform usually is to view information about the current state and configuration of your virtual machines (VMs).
To do so, you can use the command line or the web console. You can also view the information in the VM’s XML configuration.
9.1. Viewing virtual machine information by using the command line Copy linkLink copied to clipboard!
To retrieve information about virtual machines (VMs) on your host and their configurations, you can use the virsh command-line utility.
Procedure
To obtain a list of VMs on your host:
# virsh list --all Id Name State ---------------------------------- 1 testguest1 running - testguest2 shut off - testguest3 shut off - testguest4 shut offTo obtain basic information about a specific VM:
# virsh dominfo _testguest1 Id: 1 Name: testguest1 UUID: a973666f-2f6e-415a-8949-75a7a98569e1 OS Type: hvm State: running CPU(s): 2 CPU time: 188.3s Max memory: 4194304 KiB Used memory: 4194304 KiB Persistent: yes Autostart: disable Managed save: no Security model: selinux Security DOI: 0 Security label: system_u:system_r:svirt_t:s0:c486,c538 (enforcing)To obtain the complete XML configuration of a specific VM:
# virsh dumpxml testguest2 <domain type='kvm' id='1'> <name>testguest2</name> <uuid>a973434f-2f6e-4ěša-8949-76a7a98569e1</uuid> <metadata> [...]For an annotated example of a VM’s XML configuration, see Sample virtual machine XML configuration
For information about a VM’s disks and other block devices:
# virsh domblklist testguest3 Target Source --------------------------------------------------------------- vda /var/lib/libvirt/images/testguest3.qcow2 sda - sdb /home/username/Downloads/virt-p2v-1.36.10-1.el7.isoFor instructions on managing a VM’s storage, see Managing storage for virtual machines.
To obtain information about a VM’s file systems and their mountpoints:
# virsh domfsinfo testguest3 Mountpoint Name Type Target ------------------------------------ / dm-0 xfs vda /boot vda2 xfs vda /boot/efi vda1 vfat vda
To obtain more details about the vCPUs of a specific VM:
# virsh vcpuinfo testguest4 VCPU: 0 CPU: 3 State: running CPU time: 103.1s CPU Affinity: yyyy VCPU: 1 CPU: 0 State: running CPU time: 88.6s CPU Affinity: yyyyTo configure and optimize the vCPUs in your VM, see Optimizing virtual machine CPU performance.
To list all network interfaces of a specific VM:
# virsh domiflist testguest5 Interface Type Source Model MAC ------------------------------------------------------------- vnet0 network default virtio 52:54:00:ad:23:fd vnet1 bridge br0 virtio 52:54:00:40:d4:9dFor details about network interfaces, VM networks, and instructions for configuring them, see Configuring virtual machine network connections.
- For instructions on viewing information about storage pools and storage volumes on your host, see Viewing virtual machine storage information by using the CLI.
9.2. Viewing virtual machine information by using the web console Copy linkLink copied to clipboard!
To access a virtualization overview that contains summarized information about available virtual machines (VMs), disks, storage pools, and networks, you can use the web console.
Prerequisites
- The web console VM plug-in is installed on your system.
Procedure
Click in the web console’s side menu.
A dialog box appears with information about the available storage pools, available networks, and the VMs to which the web console is connected.
The information includes the following:
- Storage Pools - The number of storage pools, active or inactive, that can be accessed by the web console and their state.
- Networks - The number of networks, active or inactive, that can be accessed by the web console and their state.
- Name - The name of the VM.
- Connection - The type of libvirt connection, system or session.
- State - The state of the VM.
- Resource usage - Memory and virtual CPU usage of the VM.
Disks - Detailed information about disks assigned to the VM.
NoteChanges to the virtual network interface settings take effect only after restarting the VM.
Additionally, MAC address can only be modified when the VM is shut off.
9.3. Sample virtual machine XML configuration Copy linkLink copied to clipboard!
The XML configuration of a virtual machine (VM), also referred to as a domain XML, determines the VM’s settings and components. The following table shows a sample XML configuration of a VM and explains the contents.
To obtain the XML configuration of a VM, you can use the virsh dumpxml command followed by the VM’s name.
# virsh dumpxml testguest1
| Domain XML Section | Description |
|---|---|
| This is a KVM virtual machine called Testguest1, with 1024 MiB allocated RAM. |
| The VM is allocated with a single virtual CPU (vCPU). For information about configuring vCPUs, see Optimizing virtual machine CPU performance. |
| The machine architecture is set to the AMD64 and Intel 64 architecture, and uses the Intel Q35 machine type to determine feature compatibility. The OS is set to be booted from the hard disk drive. |
| The acpi and apic hypervisor features are enabled. |
|
The host CPU definitions from capabilities XML (obtainable with |
| The VM’s virtual hardware clock uses the UTC time zone. In addition, three different timers are set up for synchronization with the QEMU hypervisor. |
|
When the VM powers off, or its OS terminates unexpectedly, |
| The S3 and S4 ACPI sleep states are disabled for this VM. |
|
The VM uses the
The first disk is a virtualized hard-drive based on the
The second disk is a virtualized CD-ROM and its logical device name is set to |
|
The VM uses a single controller for attaching USB devices, and a root controller for PCI-Express (PCIe) devices. In addition, a For more information about virtual devices, see Types of virtual devices. |
|
A network interface is set up in the VM that uses the For information about configuring the network interface, see Optimizing virtual machine network //performance. |
|
A For more information about interacting with VMs, see Interacting with virtual machines by using the web console. |
| The VM uses a virtual usb port, which is set up to receive tablet input, and a virtual ps2 port set up to receive mouse and keyboard input. This is set up automatically and changing these settings is not recommended. |
|
The VM uses the |
|
The VM uses |