[Pkg-libvirt-maintainers] Bug#1121280: Bug#1121280: libvirt0: libvirt snapshot creation disables detect_zeroes

Andrea Bolognani eof at kiyuko.org
Wed Nov 26 00:09:21 GMT 2025


Control: found -1 libvirt/11.3.0-1

On Sun, Nov 23, 2025 at 08:30:20PM -0500, zrm wrote:
> During snapshot creation in libvirt with qemu/kvm, the function
> qemuDomainPrepareDiskSourceData() is called to copy properties into the
> new top image for the snapshot. The function only copies the detect_zeroes property if the image is already the top image:
> 
>     /* transfer properties valid only for the top level image */
>     if (src == disk->src || src == disk->src->dataFileStore)
>         src->detect_zeroes = disk->detect_zeroes;
> 
> The new image is about to be the top image, but it isn't yet at the time of
> this function call, with the result that detect_zeroes remains as its default (off) and creating a snapshot causes it to be disabled in the running VM:
> 
> # grep -A3 "device='disk'" trogdor.xml
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2' discard='unmap' detect_zeroes='unmap'/>
>       <source file='/var/lib/libvirt/images/trogdor.qcow2'/>
>       <target dev='vda' bus='virtio'/>
> # virsh define trogdor.xml
> Domain 'trogdor' defined from trogdor.xml
> # virsh start trogdor
> Domain 'trogdor' started
> 
> # virsh qemu-monitor-command trogdor --pretty
> '{"execute":"query-block"}'|grep detect_zeroes
>         "detect_zeroes": "unmap",
> 
> # virsh snapshot-create-as --domain trogdor snap42 --diskspec
> vda,file=/var/lib/libvirt/images/trogdor-snap42.qcow2 --disk-only
> 
> Domain snapshot snap42 created
> 
> # virsh qemu-monitor-command trogdor --pretty
> '{"execute":"query-block"}'|grep detect_zeroes
>         "detect_zeroes": "off",

Thanks. Draft MR here:

  https://salsa.debian.org/libvirt-team/libvirt/-/merge_requests/283

-- 
Andrea Bolognani <eof at kiyuko.org>
Resistance is futile, you will be garbage collected.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-maintainers/attachments/20251126/68c537a1/attachment.sig>


More information about the Pkg-libvirt-maintainers mailing list