Re: [Bug 1860759] Re: [REGRESSION] option `-snapshot` ignored with blockdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/24/20 4:41 AM, Ildar wrote:
Max, thanks a lot for the explanation.
Do you mean that snapshot-ing isn't possible totally for blockdev? Then I
guess some libvirt users are in trouble :((
Actually I didn't quite caught the reason why a blockdev supports backing
but not {backing to a file on /tmp then promptly deleted} ? What's the
technical difference?


On 1/24/20 4:05 AM, Max Reitz wrote:


I don’t know much about libvirt, but I would have thought that any
manual modification of the qemu command line isn’t supported and might
always break.

Anyway, from a QEMU POV, -snapshot only works with -drive (this includes
-hda, etc.).  It doesn’t work with -blockdev.  I can see that this isn’t
documented for -snapshot, but basically whenever -blockdev is used, the
user assumes full responsibility for the block graph (or at least that
particular subgraph).  We cannot enable snapshot functionality then.

Libvirt has never produced a qemu command line containing '-snapshot'. Part of this is that libvirt wants to control SELinux settings, and letting qemu create a temporary overlay in /tmp in order to implement -snapshot does not play nicely with libvirt pre-creating all files that qemu is allowed to access.

The fact that you were able to manually add -snapshot to your qemu command line with older libvirt using -drive (I'm assuming you were also not using libvirt's SELinux support, because if you were, qemu would have been unable to create/access the temporary wrapper in /tmp), is a nice hack. But since modern qemu has declared -snapshot to be unsupported with -blockdev, and modern libvirt has switched to -blockdev, I claim that this is not a qemu bug, but a libvirt feature request.

That said, libvirt has had a vision for a design for implementing the equivalent of -drive -snapshot: the <transient/> sub-element added to the domain/disk/source/driver element has been documented for a long time:

https://libvirt.org/formatdomain.html
"transient
If present, this indicates that changes to the device contents should be reverted automatically when the guest exits. With some hypervisors, marking a disk transient prevents the domain from participating in migration or snapshots. Since 0.9.5 "

However, no one has yet implemented it for libvirt's qemu driver. Part of our reluctance has been that we knew that implementing it would require libvirt to precreate the wrapper file on every guest start, and it is only very recently that we've even had enough functionality in libvirt's qemu driver coupled with new qemu commands to create qcow2 images using QMP rather than having to shell out to qemu-img. And part of it is that there was no point in implementing something to work with -drive, when we knew we had to rework everything for -blockdev anyways. But now that the work in libvirt to switch to -blockdev is done, it should be a lot easier to implement PROPER support for the <transient/> tag, at least for -blockdev usage.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux