Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

3.3. Domain XML Configuration

The host-based configuration of each KVM guest virtual machine (also referred to as a domain) is stored in the guest's XML configuration (or domain XML). This includes the settings for virtual hardware, boot options, resource allocation, network interfaces, and more. Using an application or utility that persistently modifies a guest property, such as virsh setmem, writes this change into the guest's XML configuration, which the hypervisor then reads when booting the guest and modifies the virtual machine accordingly.
To display the XML configuration of a specific guest, use the virsh dumpxml guestname command.
To edit the XML configuration of a guest, use one of the following:
  • The virsh commands - Persistent changes made to a guest virtual machine using virsh commands are recorded in the domain XML.
  • The virt-xml command - This command configures the domain XML file of a specified guest according to the provided options.
  • The Virtual Machine Manager - Changes made to a guest virtual machine in the Virtual Machine Manager are recorded in the domain XML.

Note

For the rare cases in which the domain XML files must be edited directly, use the virsh edit guestname. This command opens the domain XML configuration of the specified guest in the text editor determined by root's bash configuration, by default vi.
To change the editor for virsh edit, set or modify the EDITOR variable in the .bashrc file of the intended user. For example, for the root user, this file is located in the /root/ directory.
For the modifications performed using virsh edit to take effect, save the edited XML configuration and restart the guest.

Warning

Do not edit the XML configuration of a guest by opening it as a file in a text editor, for example by using gedit /etc/libvirt/qemu/guestname.xml. Changes made this way do not take effect and are automatically overwritten.
For detailed information on domain XML configuration files, see the Virtualization Deployment and Administration Guide.