Ce contenu n'est pas disponible dans la langue sélectionnée.

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
    LC_ALL=C
    PATH=/bin
    HOME=/home/test
    USER=test
    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
    
    Copy to Clipboard Toggle word wrap
  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
    Copy to Clipboard Toggle word wrap
    This command turns the demo.args file into the following domain XML file:
    <domain type='qemu'>
      <uuid>00000000-0000-0000-0000-000000000000</uuid>
      <memory>219136</memory>
      <currentMemory>219136</currentMemory>
      <vcpu>1</vcpu>
      <os>
        <type arch='i686' machine='pc'>hvm</type>
        <boot dev='hd'/>
      </os>
      <clock offset='utc'/>
      <on_poweroff>destroy</on_poweroff>
      <on_reboot>restart</on_reboot>
      <on_crash>destroy</on_crash>
      <devices>
        <emulator>/usr/bin/qemu</emulator>
        <disk type='block' device='disk'>
          <source dev='/dev/HostVG/QEMUGuest1'/>
          <target dev='hda' bus='ide'/>
        </disk>
      </devices>
    </domain>
    Copy to Clipboard Toggle word wrap

    Figure 20.1. Guest virtual machine new configuration file

Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat