[PATCH v1 5/7] qemu_capabilities: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This capability tracks if memory-backend-file has discard-data
attribute or not.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 17 +++++++++++++++++
 src/qemu/qemu_capabilities.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2d36aeaa54..8117252789 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -468,6 +468,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "virtio-tablet-ccw",
               "qcow2-luks",
               "pcie-pci-bridge",
+              "memory-backend-file.discard-data",
     );
 
 
@@ -1367,6 +1368,15 @@ static virQEMUCapsObjectTypeProps virQEMUCapsDeviceProps[] = {
       QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW },
 };
 
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendFile[] = {
+    { "discard-data", QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD },
+};
+
+static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
+    { "memory-backend-file", virQEMUCapsObjectPropsMemoryBackendFile,
+      ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendFile),
+      QEMU_CAPS_OBJECT_MEMORY_FILE },
+};
 
 static void
 virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
@@ -2128,6 +2138,13 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC))
         virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC);
 
+    if (virQEMUCapsProbeQMPGenericProps(qemuCaps,
+                                        mon,
+                                        virQEMUCapsObjectProps,
+                                        ARRAY_CARDINALITY(virQEMUCapsObjectProps),
+                                        qemuMonitorGetObjectProps) < 0)
+        return -1;
+
     return 0;
 }
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 3a8ffcd0e7..189ed45de3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -452,6 +452,7 @@ typedef enum {
     QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW, /* -device virtio-tablet-ccw */
     QEMU_CAPS_QCOW2_LUKS, /* qcow2 format support LUKS encryption */
     QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, /* -device pcie-pci-bridge */
+    QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD, /* -object memory-backend-dile,discard-data= */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
2.16.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux