On Fri, Dec 11, 2020 at 20:58:48 -0500, Masayoshi Mizuma wrote:
Hello,
I would like to start multiple KVM guests from one qcow2 image, and
discard the changes which the KVM guests done.
transient disk option is useful for discarding the changes, however,
we cannot start multiple KVM guest from one qcow2 image because the
image is write-locked by the first guest to be started.
I suppose the disk which transient option is enabled don't need to
get the write lock because any changes go to the overlay image, and
the overlay image is removed when the guest shutdown.
qemu has 'locking' option and the write lock is disabled when locking=off.
To implement that, I have two ideas. I would appreciate it if you could
give me the ideas which way is better (or another way).
There are two aspects of this.
1) Controlling the locking property of qemu may be worth in many cases,
so by itself this would be a worthwhile patchset to add control of
qemu locking for a per-backing store basis.
2) Disabling locking to achieve this is wrong though. The qemu image
locking infrastructure is justified and prevents many problems which
users might get into by wrong configuration.
For <transient/> disks, we should rather instantiate the top level
format node as 'readonly' and then put a read-write overlay on top of
it. This still prevents from using the file which became a backing file
in read-write mode in another VM.
You are welcome to propose the locking control as a proper patchset
(with proper splitting of patches) but it can't be described as a way to
share the backing image of <transient/> disks since that needs a
systemic fix.