[libvirt] How to keep VM definitions in sync across hosts?

Matthias Bolte matthias.bolte at googlemail.com
Sat Nov 14 17:07:48 UTC 2009

2009/11/14 Thomas Treutner <thomas at scripty.at>:
> Hi,
> is there any best-practice how to keep VM definitions in sync across a couple
> of hosts? Is it reasonable to put /etc/libvirt/qemu/ on a NFS share? Or are
> there better ways? How does oVirt solve that?

There was a similar question some weeks ago. The short answer is: No,
it's not safe to share /etc/libvirt/qemu/.


> I'm asking because I'm currently setting up a four node "cluster" with KVM and
> libvirt. Previously, with Xen, I used libvirt only for changing currently
> running VMs (setmem, migrate etc.), but with KVM, I'd like to use libvirt the
> way it is intented to ;-)
> So I assume that VM definitions are required to be available and in sync among
> all nodes for doing live migration. I don't want to rsync them or wrap the
> virsh URI edit inside a for-loop, as I assume there are better ways? I'd like
> to do virsh URI edit once and have the changes propagated automagically.

Why do you think the domain configs have to be available to all nodes?

The default migration semantic of libvirt is to "blame" here. A
migrated domain stays defined on the source node and is transient on
the destination node. A transient domain has no persistent config on
its node and is lost when destroyed.

Chris Lalancette committed a patch a month ago that adds two new
migration flags. This commit was applied after the release of 0.7.2,
it will be part of release 0.7.3.


VIR_MIGRATE_PERSIST_DEST makes a domain persistent on the destination
node, libvirt writes a config to disk.

VIR_MIGRATE_UNDEFINE_SOURCE removes the domain config on the source node.

If you migrate a domain using this two flags then the domain takes its
config with it. So there is no need to have the domain configs
available on all nodes.


More information about the libvir-list mailing list