How do I customize the virtual machine configuration XML for an HVM instance in a persistent way?

So, I’d like to tweak the XML config being used for a HVM. I’m well aware that any changes I make to it risk reducing my overall security and/or bricking my HVM entirely; this is all in the name of experimentation and personal development.

Here’s what I’ve tried:

  • I’ve tried virsh edit from dom0; and while this works, the edits are lost after I next restart the HVM.
  • I’ve also tried creating a file in /etc/qubes/templates/libvirt/xen/by-name/my-domain.xml and then restarting the Qube to regenerate the config.
  • I’ve even tried updating /usr/share/qubes/templates/libvirt/xen.xml directly and restarting the Qube. But not even this worked.

I based these attempts off of reading this documentation: https://dev.qubes-os.org/projects/core-admin/en/latest/libvirt.html

None of these have worked - which makes me suspect I’m missing something? (Like, is libvirt or some other component somehow caching these configs?)

So, I’ve answered my own question. (Posting for anyone in the future with a similar issue.)

It turns out that these configuration files absolutely 100% work - but that if you’re looking at the results via virsh dumpxml or virsh edit you’ll find anything libvirtd didn’t understand stripped out silently.

1 Like