Red Hat Training

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

20.18. Converting QEMU Arguments to Domain XML

The virsh domxml-from-native command provides a way to convert an existing set of QEMU arguments into a Domain XML configuration file that can then be used by libvirt. Note that this command is intended to be used only to convert existing QEMU guests previously started from the command line, in order to enable them to be managed through libvirt. Therefore, the method described here should not be used to create new guests from scratch. New guests should be created using either virsh, virt-install, or virt-manager. Additional information can be found on the libvirt upstream website.

Procedure 20.3. How to convert a QEMU guest to libvirt

  1. Start with a QEMU guest with a arguments file (file type *.args), named demo.args in this example:
    $ cat demo.args
    LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
  2. To convert this file into a domain XML file so that the guest can be managed by libvirt, enter the following command. Remember to replace qemu-guest1 with the name of your guest virtual machine and demo.args with the filename of your QEMU args file.
    virsh domxml-from-native qemu-guest1 demo.args
    This command turns the demo.args file into the following domain XML file:
    <domain type='qemu'>
        <type arch='i686' machine='pc'>hvm</type>
        <boot dev='hd'/>
      <clock offset='utc'/>
        <disk type='block' device='disk'>
          <source dev='/dev/HostVG/QEMUGuest1'/>
          <target dev='hda' bus='ide'/>

    Figure 20.1. Guest virtual machine new configuration file