Virtlockd shouldwork out of the box on 14.10 but it doesn't!
I turned on locking in /etc/libvirt/qemu.conf by uncommenting the line:
lock_manager = "lockd"
Set auto_disk_leases = 1 in /etc/libvirt/qemu-lockd.conf and uncommented all of the default lockspace_dir entries.
I restarted libvirt with sudo service libvirt-bin restart and attempted to start a machine.
I was met with the error:
Failed to connect socket to '/var/run/libvirt/virtlockd-sock': No such file or directory
After searching in various config files I found that virtlockd needs to start as a daemon and there was no auto way for this to happen so I wrote an upstart config...
description "virtlockd Daemon"
author "Guy Thouret <guy@thouret.uk>"
start on stopped rc RUNLEVEL=[2345]
stop on starting rc RUNLEVEL=[016]
expect daemon
respawn
exec /usr/sbin/virtlockd -d
...saved it as /etc/init/virtlockd.conf and I was then able to start virtlockd with service virtlockd start
I confirmed the lockfile had indeed been created:
guy@cyclopes:/gluster/vmlocks$ sudo ls -l /var/lib/libvirt/lockd/*
-rw-r--r-- 1 root root 0 Oct 30 14:02 /var/lib/libvirt/lockd/tsting
/var/lib/libvirt/lockd/files:
total 0
/var/lib/libvirt/lockd/lvmvolumes:
total 0
/var/lib/libvirt/lockd/scsivolumes:
total 0
-rw------- 1 root root 0 Oct 30 16:33 3600c0ff0001587169836e15201000000
Attempting to start the running VM on another node gave the error:
Error starting domain: resource busy Lockspace resource '3600c0ff000158716ec34b05201000000' is locked
Virtlockd has saved the day and prevented the VM from potentially being trashed.
Virtlockd has saved the day and prevented the VM from potentially being trashed.
No comments:
Post a Comment