On Tue, Apr 04, 2023 at 01:09:41PM +0200, Peter Krempa wrote: > On Mon, Mar 13, 2023 at 16:42:08 +0100, Pavel Hrdina wrote: > > Extract creation of qcow2 files for external snapshots to separate > > function as we will need it for external snapshot revert code. > > Hmm, I don't think I like where this is going. I presume you want to use > this code to create the new overlay images. Correct > If you want to use this also in cases where the VM was live you might > run into scenarios where the qemu-img code will not be able to handle > the overlay creation, specifically on networked storage. We always kill the qemu process when reverting so I figured that qemu-img should be good enough to create the new overlay because the qemu process is not running at that point. Did not think we allow snapshot creation for qcow2 images on networked storage as it would not work for offline VM where we also use this qemu-img approach. Looking at the code for running VM we are using QMP to create the overlay files and I did not manage to find any check to limit it only for local images. If that's the case we have IMHO really bad inconsistent behavior where we would allow creating new snapshots for non-local images if the VM is running but fail to do so if the VM is offline. > I think we'll need to create the overlay images as part of the startup > of the reverted VM via QMP exactly as we are creating overlays currently > for snapshots. > > Even when today's API will not allow reversion of non-local snapshots (I > didn't check further in this series yet) I don't think we should go the > way of using qemu-img at all. There is no check for that as I assumed (probably incorrectly) that we allow creating snapshot only for local images. If that's not the case then yes we need to use the QMP commands to create overlays. Pavel
Attachment:
signature.asc
Description: PGP signature