On 7/7/20 2:12 AM, Peter Krempa wrote:
You can install a qcow2 overlay on top of a raw file too. IMO the
implications of using <transient/> allow that.
As said above I'd strongly prefer if the overlay is created in qemu
using the blockdev-create blockjob (there is already infrastructure in
libvirt to achieve that).
Agreed. At this point, any time we call out to qemu-img as a separate
process, we are probably doing it wrong.
Additionally there are corner cases which this patch doesn't deal with:
1) the virDomainBlockCopy operation flattens the backing chain into the
top level only. This means that <transient/> must be stripped or the
operation rejected, as otherwise shutting down the VM would end up
removing the disk image completely.
If you have marked a disk transient, does it still make sense to allow
copying that disk? Rejecting the operation is easiest, as permitting it
implies that even though you already said you don't care about changes
to your disk, you still want to be able to back up that disk.
2) the same as above is used also for non-shared-storage migration where
we use block-copy internally to transport the disks, same as above
applies. Here again it requires careful consideration of the semantics,
e.g whether to reject it or e.g. copy it into the original filename and
strip <transient/> (we can't currently copy multiple layers).
The easiest solution is to make a transient disk a migration-blocker.
Of course, this may annoy people, so migration properly creating a
transient destination on top of the original base, to preserve the fact
that when the migrated guest shuts down it reverts to original contents,
is a nicer (but more complex) goal.
3) active-layer virDomainBlockCommit moves the data from the transient
overlay into the original (now backing image). The <transient> flag is
stored in the disk struct though, so that would mean that the original
disk source would be removed after stopping the VM. block commit must
clear the <transient> flag.
Why should commit be permitted, when you declared that disk contents
shouldn't change? For that matter, external snapshots should be blocked
if there is a transient disk.
One nice-to-have but not required modification would be to allow
configuration of the transient disk's overlay path.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org