Qemu 8.1.0 will have a new qcow2 option named discard-no-unref. https://gitlab.com/qemu-project/qemu/-/commit/42a2890a76f4783cd1c212f27856edcf2b5e8a75 Enabling this option wil change the way qemu handles guest discards inside the qcow2 image and will highly improve the fragmentation within the qcow2 image. We want to be able to enable this option (which is off by default) via libvirt, so this patch adds this option in libvirt. v2 fixes the remarks in the previous patchset Jean-Louis Dupond (2): Add discard_no_unref option for qcow2 images Update NEWS with new discard_no_unref option NEWS.rst | 2 + docs/formatdomain.rst | 7 ++++ src/conf/domain_conf.c | 8 ++++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 13 ++++++ src/conf/schemas/domaincommon.rng | 5 +++ src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 1 + src/qemu/qemu_block.c | 11 +++-- src/qemu/qemu_domain.c | 1 + src/qemu/qemu_driver.c | 4 +- src/vz/vz_utils.c | 6 +++ tests/qemusecuritytest.c | 1 + .../disk-discard_no_unref.x86_64-latest.args | 36 ++++++++++++++++ .../disk-discard_no_unref.xml | 32 ++++++++++++++ tests/qemuxml2argvtest.c | 1 + .../disk-discard_no_unref.x86_64-latest.xml | 42 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 18 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/disk-discard_no_unref.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/disk-discard_no_unref.xml create mode 100644 tests/qemuxml2xmloutdata/disk-discard_no_unref.x86_64-latest.xml -- 2.41.0