1

I created a VM using virt-manager and I can edit that xml using virsh edit, but I would like to ask you if there is way of converting libvirt xml into qemu command line. I've found that someone else made the same question sime time ago :

https://www.reddit.com/r/VFIO/comments/dh9iyo/convert_libvirt_xml_into_qemu_command_line_and/

and the user jkhsjdhjs says :

For converting libvirt xml to qemu command line you can just start the vm with libvirt. libvirt will start a qemu process with a whole lot of command line arguments which you can then save. Since libvirt just starts a qemu process they should perform exactly the same.

ok,but how ? I would like to understand how to start the vm with libvirt,so that I can see every options included in the qemu command.

I tried with :

virsh dumpxml win10

virsh domxml-to-native qemu-argv win10.xml

error: internal error: invalid PCI passthrough type 'default'
0

Take a look in the QEMU log-file for that guest. These log-files are located on the host in the folder /var/log/libvirt/qemu/DomainName

You can see the executed /usr/bin/qemu-system-x86_64... command in the log.

0

Since the question asks how to generate the qemu command line from virsh, one might just look at the process run once the VM(domain) has started. However to answer the question more correctly, this might be the prober command

virsh domxml-to-native

This is because domxml-to-native qemu-argv --domain [name_of_vm] will not even start the VM, but only create a command line that would do that. As says its docu man virsh

domxml-to-native
Syntax:

domxml-to-native format { [--xml] xml | --domain domain-name-or-id-or-uuid }

Convert the file xml into domain XML  format  or  convert  an  existing
--domain to the native guest configuration format named by format.  The
xml and --domain arguments are mutually exclusive.  For  the  types  of
format argument, refer to domxml-from-native.
0

One way is to get your machine running in VirtManager and then go to a terminal window and list all the processes with the ps command: ps -fA or ps -fA | cat. (cat will make the long strings wrap in the a console). Then you can find the qemu process and extract the text of the command issued by VirtManager, since it merely calls qemu to run the machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.