Sample Header Ad - 728x90

Where are libvirt's VM definitions "originals" stored, and how to sync them across multiple nodes?

1 vote
1 answer
489 views
Migrating from Xen's xm to Xen's xl under control of libvirt, I wonder: Where does libvirt store the "originals" of VM configurations? I found that my PVM configurations are stored in /etc/libvirt/libxl/, but when viewing such files I see a comment saying that file has been created automatically and I should not be edited ("use virsh edit ..."). I also found XML and JSON files in /var/lib/xen, named after the Domain ID and UUID of the VM. As I'm configuring a HA cluster, I'd like to synchronize VM configurations across all cluster nodes (allowing live-migration). In the past syncing /etc/xen/vm was enough, but for libvirt it seems to be much more complicated: Sometimes I'll have to virsh define a VM from the XML file, virsh destroy does not only destroy the running VM, but also the configuration it seems, and virsh undefine also removed the XML file in /etc/libvirt/libxl/ it seems. I don't know how to synchronize the configuration across the cluster nodes. The major problem I see is this: After csync2-ing the XML files defining the VM configurations to the other cluster nodes, I see the changes in the /etc/libvirt/libxl/ files, saying "do not edit; use virsh edit instead". However when I use virsh edit for one of those files, the contents I see in the editor is not what I see in the XML files located in /etc/libvirt/libxl/. Maybe re-phrase the question to: *If I update the XML files in /etc/libvirt/libxl/ (like via csync2), how can I ensure that libvirt uses the updated configurations?* Update --- This question became more important after I had added a block device for paging using xl block-attach corresponding to the edited configuration. When the VM was live-migrated to another node in the cluster, the added disk was not transferred to the VM, so the VM froze when trying to access that disk. So obviously the configuration of the current machine was not used for live-migration, and the saved configuration in the XML files weren't used either.
Asked by U. Windl (1715 rep)
Feb 17, 2021, 12:08 PM
Last activity: Sep 8, 2022, 09:52 AM