The trouble I would expect is when you have a front end that allows external users to create snapshots as long as they're not exceeding a quota, at which point they would have to delete some in order to create more. Then 1000 snapshots of 10MB each (10GB total) might be well within the quota, meanwhile deletion is permitted when over quota because it's the expected means to free up space. Which makes it a concern if deletion can turn each pair of 10MB existing snapshots into 1TB of zeroes. But I'm after getting it fixed rather than classifying it.

There might also be two bugs here. I put them together because they're related and could potentially be fixed together, but at least the lesser one might still be in libvirt.

The main one is in the interaction between libvirt and qemu. In trixie, qemu doesn't do detect_zeroes during blockcommit unless libvirt tells it to and libvirt frequently doesn't tell it to even when detect_zeroes='unmap' is set in the XML. That could be fixed in either place by either having libvirt tell it to or having qemu do it without needing to be told. I don't know of any reason not to fix it in qemu instead and if that's what others did then fair enough. I'll see if I can find what's different in qemu in sid.

Here's the other one:

# 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",

This one isn't an issue for snapshot deletion or blockcommit. But if you actually wanted detect_zeroes='unmap' in the active top image, creating a snapshot turns it off until you shut down the VM because qemuDomainPrepareDiskSourceData() isn't properly copying the detect_zeroes property to the new top image during snapshot creation. In theory qemu could also deduce that one without being told if it gets a new top image when detect_zeroes was enabled for the previous one, but it isn't doing that even in sid and even if it was that would still leave the "detect_zeroes" field in "struct _virStorageSource" set to the wrong value for the new top image in libvirt.

I suppose that one wants to be a separate bug at this point, doesn't it?

Reply via email to