This is how I tested the feature:
Create couple of disks:
qemu-img create -f qcow2 /var/lib/libvirt/images/test1.qcow2 1G
qemu-img create -f qcow2 /var/lib/libvirt/images/test2.qcow2 -b
/var/lib/libvirt/images/test1.qcow2
qemu-img create -f qcow2 /var/lib/libvirt/images/test3.qcow2 -b
/var/lib/libvirt/images/test1.qcow2
Then adjust configuration of two domains:
virsh # domblklist gentoo
Target Source
------------------------------------------------
fda /var/lib/libvirt/images/fd.img
vda /var/lib/libvirt/images/gentoo.qcow2
vdb /var/lib/libvirt/images/test1.qcow2
hdc /home/zippy/tmp/install-amd64-minimal-20150402.iso
virsh # domblklist fedora
Target Source
------------------------------------------------
sda /var/lib/libvirt/images/fedora.qcow2
sdb /var/lib/libvirt/images/test2.qcow2
hda -
With this configuration, fedora and gentoo should not be able to run at the same time:
virsh # start fedora
Domain fedora started
virsh # start gentoo
error: Failed to start domain gentoo
error: resource busy: Lockspace resource '/var/lib/libvirt/images/test1.qcow2' is
locked
Cool!
But with slight change, gentoo should be able to run:
virsh # domblklist gentoo
Target Source
------------------------------------------------
fda /var/lib/libvirt/images/fd.img
vda /var/lib/libvirt/images/gentoo.qcow2
vdb /var/lib/libvirt/images/test3.qcow2
hdc /home/zippy/tmp/install-amd64-minimal-20150402.iso
virsh # start gentoo
Domain gentoo started
virsh # list
Id Name State
----------------------------------------------------
10 fedora running
11 gentoo running
Awesome!
Michal Privoznik (2):
qemuProcessStart: Parse backingStore for all disks
virDomainLockManagerAddImage: Recursively lock backing chain
src/locking/domain_lock.c | 53 +++++++++++++++++++++++++++++------------------
src/qemu/qemu_domain.c | 11 +++-------
src/qemu/qemu_process.c | 6 +++++-
3 files changed, 41 insertions(+), 29 deletions(-)
--
2.4.6