[libvirt-users] qemu:///session and network-mounted home directories

Cole Robinson crobinso at redhat.com
Sat Oct 10 17:31:52 UTC 2015


On 10/10/2015 10:53 AM, Spencer Baugh wrote:
> 
> Dear libvirt-users,
> 
> Suppose my home directory is network mounted on to several different
> machines. And suppose I defined some VMs in qemu:///session. The
> configuration files and disk images for qemu:///session are stored in my
> home directory.
> 
> Now suppose I log in to some machine and use virsh. The qemu:///session
> VMs that are marked autostart are started. Now if I log into another
> machine and use virsh, it will presumably try to start my autostart VMs
> again, since the same configuration is present in both homedirs.
> 
> Is there anything libvirt does that might prevent it from starting the
> same VM multiple times on different machines? Or might allow
> machine-specific autostart configuration? Maybe something could be done
> with /etc/machine-id!
> 
> In terms of qemu:///system, this is like having /var/lib/libvirt/images/
> live on a network-mounted filesystem (fairly normal I assume) and also
> having /etc/libvirt/qemu live on a network-mounted filesystem (not as
> normal). Not sure how you would deal with the issue there either but I
> can see why you might want to have your same VM configuration available
> on all hosts, so it would be cool to figure out that problem as
> well.
> 
> The answer may be the VM configuration is host-specific, so sharing VM
> configuration between hosts is not a good idea. In that case, any other
> recommendations on how to deal with the networked homedir case?
> 

The proper way to make sure shared VMs aren't started across multiple machines
is libvirt's locking support: https://libvirt.org/locking.html

It requires running a separate daemon though so isn't trivial, and I have no
idea if it can be made to work with qemu:///session.

It's an interesting problem though, but not one that I can see libvirt adding
explicit autostart+machine-id support to handle since it's pretty niche. Maybe
you can disable autostart at the libvirt level, and add a custom ~/bin/virsh
wrapper to do the manually autostart VMs only for the machine-id you care
about, or something similarly crazy

- Cole




More information about the libvirt-users mailing list