Sample virtual machine XML configuration
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 |
|---|---|
<domain type='kvm'>
<name>Testguest1</name>
<uuid>ec6fbaa1-3eb4-49da-bf61-bb02fbec4967</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
|
This is a KVM virtual machine called Testguest1, with 1024 MiB allocated RAM. |
<vcpu placement='static'>1</vcpu>
|
The VM is allocated with a single virtual CPU (vCPU). For information about configuring vCPUs, see Optimizing virtual machine CPU performance. |
<os>
<type arch='x86_64' machine='pc-q35-rhel10.0.0'>hvm</type>
<boot dev='hd'/>
</os>
|
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. |
<features>
<acpi/>
<apic/>
</features>
|
The acpi and apic hypervisor features are enabled. |
<cpu mode='host-model' check='partial'/>
|
The host CPU definitions from capabilities XML (obtainable with
|
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
|
The VM’s virtual hardware clock uses the UTC time zone. In addition, three different timers are configured for synchronization with the QEMU hypervisor. |
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
|
When the VM powers off, or its OS terminates unexpectedly, |
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
|
The S3 and S4 ACPI sleep states are disabled for this VM. |
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/Testguest.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='sdb' bus='sata'/>
<readonly/>
</disk>
|
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 |
<controller type='usb' index='0' model='qemu-xhci' ports='15'/>
<controller type='sata' index='0'/>
<controller type='pci' index='0' model='pcie-root'/>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='1' port='0x10'/>
</controller>
<controller type='pci' index='2' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='2' port='0x11'/>
</controller>
<controller type='pci' index='3' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='3' port='0x12'/>
</controller>
<controller type='pci' index='4' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='4' port='0x13'/>
</controller>
<controller type='pci' index='5' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='5' port='0x14'/>
</controller>
<controller type='pci' index='6' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='6' port='0x15'/>
</controller>
<controller type='pci' index='7' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='7' port='0x16'/>
</controller>
<controller type='virtio-serial' index='0'/>
|
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. |
<interface type='network'>
<mac address='52:54:00:65:29:21'/>
<source network='default'/>
<model type='virtio'/>
</interface>
|
A network interface is configured in the VM that uses the For information about configuring the network interface, see Optimizing virtual machine network //performance. |
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<channel type='unix'>
<target type='virtio' name='org.qemu.guest_agent.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
|
A For more information about interacting with VMs, see Interacting with virtual machines by using the web console. |
<input type='tablet' bus='usb'>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
|
The VM uses a virtual usb port, which is configured to receive tablet input, and a virtual ps2 port configured to receive mouse and keyboard input. This is configured automatically and changing these settings is not recommended. |
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
|
The VM uses the |
<redirdev bus='usb' type='tcp'>
<source mode='connect' host='localhost' service='4000'/>
<protocol type='raw'/>
</redirdev>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
</devices>
</domain>
|
The VM uses |