On Bionic, Qemu complains that it cannot acquire write lock when commiting a snapshot if a read-only backing-store is opened by another qemu process. This behavior does not happen with version 2.12 in Cosmic.
Reproducer
==========
Create two QCOW2 containers sharing the same base file as a backing store :
Commit the snapshot
(QEMU) block-commit device=disk0 base=top-vm01.img
{"error": {"class": "GenericError", "desc": "Failed to get \"write\" lock"}}
Expected Behavior
=================
The commit should complete succesfully as the base.img backing store is opened read-only so no write lock is required
Current Behavior
================
The commit fails with "Failed to get "write" lock
On Bionic, Qemu complains that it cannot acquire write lock when commiting a snapshot if a read-only backing-store is opened by another qemu process. This behavior does not happen with version 2.12 in Cosmic.
Reproducer
==========
Create two QCOW2 containers sharing the same base file as a backing store :
|
+
| |
middle-vm02.img middle-vm02.img
| |
top-vm01.img top-vm02.img
# cat mkimage
#!/bin/bash
qemu-img create -f qcow2 base.qcow2 10G
qemu-img create -f qcow2 -b base.qcow2 middle-vm01.img 10G
qemu-img create -f qcow2 -b base.qcow2 middle-vm02.img 10G
qemu-img create -f qcow2 -b middle-vm01.img top-vm01.img 10G
qemu-img create -f qcow2 -b middle-vm01.img top-vm02.img 10G
Start two VM each using its own top-vm{id}.img
# cat runvm
#!/bin/bash
qemu-system-x86_64 -nographic -qmp unix:./ qmp-1.sock, server, nowait -enable-kvm -device virtio- scsi-pci, id=scsi -device sga -nodefaults -monitor none -m 256M -drive file=./ top-vm01. img,if= virtio, id=disk0 -smp 1 -smbios type=1, manufacturer= test& qmp-2.sock, server, nowait -enable-kvm -device virtio- scsi-pci, id=scsi -device sga -nodefaults -monitor none -m 256M -drive file=./ top-vm02. img,if= virtio, id=disk0 -smp 1 -smbios type=1, manufacturer= test&
qemu-system-x86_64 -nographic -qmp unix:./
Create a snapshot
./scripts/ qmp/qmp- shell ./qmp-1.sock
Welcome to the QMP low-level shell!
Connected to QEMU 2.11.1
(QEMU) blockdev- snapshot- sync device=disk0 snapshot- file=tmp. qcow2 format=qcow2 file=./ top-vm01. img backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16
Formatting 'tmp.qcow2', fmt=qcow2 size=10737418240 backing_
{"return": {}}
Commit the snapshot
(QEMU) block-commit device=disk0 base=top-vm01.img
{"error": {"class": "GenericError", "desc": "Failed to get \"write\" lock"}}
Expected Behavior
=================
The commit should complete succesfully as the base.img backing store is opened read-only so no write lock is required
Current Behavior
================
The commit fails with "Failed to get "write" lock