DISCARD and WRITE_ZEROES commands has been implemented in virtio-blk protocol since qemu >= 4.2.0, may be it's time to introduce discard and write-zeroes options for virtio-blk device in libvirt so that the upper layer can enable this feature at disk granularity. To distinguish the discard option in block drive layer, use the 'virtio' prefix to indicate that these attributes are specific for virtio-blk disk. To try this out, three things has done in this patchset: 1. introduce capabilities of discard and write-zeroes for virtio-blk 2. add virtio_discard and virtio_write_zeroes attributes of driver in disk xml element 3. generate cmd line when launching vm
Please review, any comments and suggestions are very appreciated, thanks! Yong Hyman Huang(黄勇) (3): qemu_capabilities: Introduce virtio-blk DISCARD and WRITE_ZEROES capabilities conf: Add 'virtio_discard' and 'virtio_write_zeroes' attributes qemu_command: Generate cmd line for discard and write-zeroes properties docs/formatdomain.rst | 8 +++ src/conf/domain_conf.c | 16 ++++++ src/conf/domain_conf.h | 2 + src/conf/schemas/domaincommon.rng | 10 ++++ src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 2 + src/qemu/qemu_command.c | 2 + src/qemu/qemu_validate.c | 14 +++++ .../caps_4.2.0_aarch64.xml | 2 + .../qemucapabilitiesdata/caps_4.2.0_ppc64.xml | 2 + .../qemucapabilitiesdata/caps_4.2.0_s390x.xml | 2 + .../caps_4.2.0_x86_64.xml | 2 + .../caps_5.0.0_aarch64.xml | 2 + .../qemucapabilitiesdata/caps_5.0.0_ppc64.xml | 2 + .../caps_5.0.0_riscv64.xml | 2 + .../caps_5.0.0_x86_64.xml | 2 + .../caps_5.1.0_x86_64.xml | 2 + .../caps_5.2.0_aarch64.xml | 2 + .../qemucapabilitiesdata/caps_5.2.0_ppc64.xml | 2 + .../caps_5.2.0_riscv64.xml | 2 + .../qemucapabilitiesdata/caps_5.2.0_s390x.xml | 2 + .../caps_5.2.0_x86_64.xml | 2 + .../caps_6.0.0_aarch64.xml | 2 + .../qemucapabilitiesdata/caps_6.0.0_s390x.xml | 2 + .../caps_6.0.0_x86_64.xml | 2 + .../caps_6.1.0_x86_64.xml | 2 + .../caps_6.2.0_aarch64.xml | 2 + .../qemucapabilitiesdata/caps_6.2.0_ppc64.xml | 2 + .../caps_6.2.0_x86_64.xml | 2 + .../caps_7.0.0_aarch64+hvf.xml | 2 + .../caps_7.0.0_aarch64.xml | 2 + .../qemucapabilitiesdata/caps_7.0.0_ppc64.xml | 2 + .../caps_7.0.0_x86_64.xml | 2 + .../qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 2 + .../caps_7.1.0_x86_64.xml | 2 + tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml | 2 + .../caps_7.2.0_x86_64+hvf.xml | 2 + .../caps_7.2.0_x86_64.xml | 2 + .../caps_8.0.0_riscv64.xml | 2 + .../caps_8.0.0_x86_64.xml | 2 + .../qemucapabilitiesdata/caps_8.1.0_s390x.xml | 2 + .../caps_8.1.0_x86_64.xml | 2 + .../disk-virtio-discard.x86_64-latest.args | 44 +++++++++++++++ .../qemuxml2argvdata/disk-virtio-discard.xml | 56 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 45 files changed, 227 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-virtio-discard.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/disk-virtio-discard.xml -- 2.38.5