0

Libvirt is cool, but I need to port a VM from it's configuration to bare QEMU or Xen. To reproduce the setup, I need the commands send to the specific Hypervisors in order reproduce the VM in the targetsystem.

So I basically need the interpretation of the libvirt xml-configuration for Xen and QEMU. The best way would be to look for the commands in Libvirt itselfe. There has to be made this step, because otherwise it wouldn't be possible to start even a single machine.

In theory the evaluation of XML-Configurations can change between different versions of Libvirt. So tracking an error down because of this, might be hard also it is not reproduce able in scientific scenes.

A workaround would be to ask the running QEMU oder Xen instance for their configuration. But I'm not sure how to do it.

Do you have any ideas?

EDIT: I'm not going to retrieve all the network setup libvirt is providing in background. Just the simpel machine. So there is e.g. an option for optimizing the libvirt client for a specific OS. I would like to know which influence it has on the basic command to QEMU or Xen.

I'm looking only for the commandlineoptiones

# commands of creating machines withe the Hypervisors:
qemu-system-... [kvm / cpu / basics]
xl create [Myconfigfile.conf]

*[desired arguments]
Cutton Eye
  • 343
  • 4
  • 14

1 Answers1

1

The answer depends entirely on how the hypervisor in question works, so there's no single way to achieve that. For QEMU, libvirt simply spawns a QEMU binary with a particular set of arguments. You can see these by running the virsh domxml-to-native command, or looking at /var/log/libvirt/qemu/$GUESTNAME.log. Note there is much more to managing a QEMU guest than just running QEMU - libvirt also sets up cgroups, firewall rules, SELinux/AppArmor, and passes in pre-opened file descriptors for some things. So replicating this outside libvirt is alot of work, and would recommend against trying todo so. For the Xen hypervisor, libvirt calls into various library APIs, so there's no way you can replicate that without writing code todo the same.

DanielB
  • 1,618
  • 7
  • 7
  • thx a lot. the QEMU way sounds good. But the Xen thing, you saying, I can't retrieve the configuration file? (I added an edit below the original question, to make sure I got you right) – Cutton Eye Feb 27 '18 at 13:17
  • There's no concept of a configuration file - the configuration is only ever in memory and passed to Xen libraries on the fly – DanielB Feb 27 '18 at 16:35