On Tue, Sep 07, 2021 at 15:12:10 +0800, yuxiating@xxxxxxxxxx wrote: > From: yuxiating <yuxiating@xxxxxxxxxx> > > This patch introduces a new attribute "discard". An example of > the XML: > > <disk type='file' device='disk'> > <driver name='qemu' type='qcow2' discard_enable='4'/> > > The corresponding QEMU command line: > > -device virtio-blk-pci,scsi=off,discard=off,id=virtio-disk0 > > Signed-off-by: yuxiating <yuxiating@xxxxxxxxxx> > --- > src/qemu/qemu_command.c | 5 +++ > .../qemuxml2argvdata/disk-virtio-discard.args | 29 +++++++++++++++ > .../qemuxml2argvdata/disk-virtio-discard.xml | 35 +++++++++++++++++++ > tests/qemuxml2argvtest.c | 2 ++ > 4 files changed, 71 insertions(+) > create mode 100644 tests/qemuxml2argvdata/disk-virtio-discard.args > create mode 100644 tests/qemuxml2argvdata/disk-virtio-discard.xml [...] > diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c > index 3b331d5fd4..4375b06d40 100644 > --- a/tests/qemuxml2argvtest.c > +++ b/tests/qemuxml2argvtest.c > @@ -1341,6 +1341,8 @@ mymain(void) > DO_TEST("disk-order", QEMU_CAPS_VIRTIO_BLK_SCSI); > DO_TEST("disk-virtio-queues", > QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES); > + DO_TEST("disk-virtio-discard", > + QEMU_CAPS_DEVICE_DISCARD); Please always use DO_TEST_CAPS_LATEST with new test cases as it covers real qemu capabilities. > DO_TEST_NOCAPS("disk-boot-disk"); > DO_TEST_NOCAPS("disk-boot-cdrom"); > DO_TEST_NOCAPS("floppy-drive-fat"); > -- > 2.27.0 >