Convert qemu syntax to virt-install or virsh xml
Solution 1:
It's a great question, I don't understand why there are only 4 votes and no answers. I'm in the same boat, so this is what I see: I think at some time, this was working: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_administration_guide/sub-sect-domain_commands-converting_qemu_arguments_to_domain_xml - however, I just tried it and it doesn't work because it'll say: error: this function is not supported by the connection driver: virConnectDomainXMLFromNative. The explanation for that error is (https://libvirt.org/drvqemu.html#import-and-export-of-libvirt-domain-xml-configs):
The virsh domxml-from-native provides a way to convert an existing set of QEMU args into a guest description using libvirt Domain XML...
Note: this operation is deleted as of 5.5.0 and will return an error.
In the release notes for 5.5.0 they write:
qemu: Remove support for virDomainQemuAttach and virConnectDomainXMLFromNative APIs
The qemu implementations for the APIs mentioned above were removed and the APIs now return an error. The implementation was stale for a long time and did not work with modern QEMU command lines, generated from libvirt or otherwise.
Based on this I think it's pretty much impossible to do an "automatic conversion" without downgrading to libvirt v5.4.0 (2019-06-03). So that must be the answer. If that isn't an acceptable solution, you might want to do as I did: I ended up manually running the virt-manager 5-step "Create a new virtual machine", "Import existing disk image" and selecting some values I thought was similar to the parameters passed as commandline arguments to qemu-system-x86_64. Neither are good solutions, but I don't see other methods, unfortunately (because I also want that functionality with recent releases, if possible).