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 <[email protected]>
Resistance is futile, you will be garbage collected.

Attachment: signature.asc
Description: PGP signature

Reply via email to