Red Hat Training

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

20.20. Creating a Virtual Machine XML Dump (Configuration File)

The virsh dumpxml command will return the guest virtual machine's XML configuration file which you can then use, save, or change as needed.
The XML file (guest.xml) can then be used to recreate the guest virtual machine (refer to Section 20.22, “Editing a Guest Virtual Machine's XML Configuration Settings”. You can edit this XML configuration file to configure additional devices or to deploy additional guest virtual machines.

Example 20.48. How to retrieve the XML file for a guest virtual machine

The following example retrieves the XML configuration of the guest1 virtual machine, writes it into the guest1.xml file, and then verifies that the process has been completed successfully.
# virsh dumpxml guest1 > guest1.xml
# cat guest1.xml
<domain type='kvm'>
  <name>guest1-rhel6-64</name>
  <uuid>b8d7388a-bbf2-db3a-e962-b97ca6e514bd</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.2.0'>hvm</type>
    <boot dev='hd'/>
  </os>
[...]