]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_capabilities: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 20 Apr 2018 08:25:49 +0000 (10:25 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 14 May 2018 07:42:20 +0000 (09:42 +0200)
This capability tracks if memory-backend-file has discard-data
attribute or not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml

index 16a8aa92abe371bbe492d9cc2f2abdd678d41a06..2e2190e80fe10d5d2d00ccc51edd3dfde508d195 100644 (file)
@@ -479,6 +479,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
               /* 295 */
               "qom-list-properties",
+              "memory-backend-file.discard-data",
     );
 
 
@@ -1375,6 +1376,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,
@@ -2132,6 +2142,14 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
                                         qemuMonitorGetDeviceProps) < 0)
         return -1;
 
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES) &&
+        virQEMUCapsProbeQMPGenericProps(qemuCaps,
+                                        mon,
+                                        virQEMUCapsObjectProps,
+                                        ARRAY_CARDINALITY(virQEMUCapsObjectProps),
+                                        qemuMonitorGetObjectProps) < 0)
+        return -1;
+
     return 0;
 }
 
index 4a25fbb6f2ff77c00d7b6e6e1d2f1d991bbff00f..adac3b63cf9a2f8442589627b6d3345643a1b4a7 100644 (file)
@@ -463,6 +463,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
 
     /* 295 */
     QEMU_CAPS_QOM_LIST_PROPERTIES, /* qom-list-properties monitor command */
+    QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD, /* -object memory-backend-file,discard-data */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
index 3512d88b67ddc7b41a04a85fae1949a04005b041..3ca0ea13fa1337edc5d41b80c8f5d3742eaaabb7 100644 (file)
   "id": "libvirt-35"
 }
 
+{
+  "return": [
+    {
+      "name": "policy",
+      "type": "HostMemPolicy"
+    },
+    {
+      "name": "dump",
+      "type": "bool"
+    },
+    {
+      "name": "share",
+      "type": "bool"
+    },
+    {
+      "name": "prealloc",
+      "type": "bool"
+    },
+    {
+      "name": "size",
+      "type": "int"
+    },
+    {
+      "name": "host-nodes",
+      "type": "int"
+    },
+    {
+      "name": "id",
+      "type": "string"
+    },
+    {
+      "name": "merge",
+      "type": "bool"
+    },
+    {
+      "name": "align",
+      "type": "int"
+    },
+    {
+      "name": "mem-path",
+      "type": "string"
+    },
+    {
+      "name": "discard-data",
+      "type": "bool"
+    },
+    {
+      "name": "type",
+      "type": "string"
+    }
+  ],
+  "id": "libvirt-36"
+}
+
 {
   "return": [
     {
       "cpu-max": 1
     }
   ],
-  "id": "libvirt-36"
+  "id": "libvirt-37"
 }
 
 {
       "static": false
     }
   ],
-  "id": "libvirt-37"
+  "id": "libvirt-38"
 }
 
 {
   "return": [
   ],
-  "id": "libvirt-38"
+  "id": "libvirt-39"
 }
 
 {
   "return": [
     "emulator"
   ],
-  "id": "libvirt-39"
+  "id": "libvirt-40"
 }
 
 {
       "option": "drive"
     }
   ],
-  "id": "libvirt-40"
+  "id": "libvirt-41"
 }
 
 {
       "capability": "dirty-bitmaps"
     }
   ],
-  "id": "libvirt-41"
+  "id": "libvirt-42"
 }
 
 {
       "meta-type": "object"
     }
   ],
-  "id": "libvirt-42"
+  "id": "libvirt-43"
 }
 
 {
       "kernel": false
     }
   ],
-  "id": "libvirt-43"
+  "id": "libvirt-44"
 }
 
 {
index 9aa913c9ecec1c1fbe65311e9206c12a420df79a..362f6f20b5e5ce41a71d01d441b95f1f460c86a2 100644 (file)
   <flag name='nbd-tls'/>
   <flag name='pr-manager-helper'/>
   <flag name='qom-list-properties'/>
+  <flag name='memory-backend-file.discard-data'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
-  <microcodeVersion>342346</microcodeVersion>
+  <microcodeVersion>343099</microcodeVersion>
   <package>v2.12.0-rc0</package>
   <arch>aarch64</arch>
   <cpu type='kvm' name='pxa262'/>
index 2166b34973d35515204fa9f1da7432c70c57f5ad..1e93cd6dca5ab95796118e9d0926e9b17e0d4da3 100644 (file)
   "id": "libvirt-36"
 }
 
+{
+  "return": [
+    {
+      "name": "policy",
+      "type": "HostMemPolicy"
+    },
+    {
+      "name": "dump",
+      "type": "bool"
+    },
+    {
+      "name": "share",
+      "type": "bool"
+    },
+    {
+      "name": "prealloc",
+      "type": "bool"
+    },
+    {
+      "name": "size",
+      "type": "int"
+    },
+    {
+      "name": "host-nodes",
+      "type": "int"
+    },
+    {
+      "name": "id",
+      "type": "string"
+    },
+    {
+      "name": "merge",
+      "type": "bool"
+    },
+    {
+      "name": "align",
+      "type": "int"
+    },
+    {
+      "name": "mem-path",
+      "type": "string"
+    },
+    {
+      "name": "discard-data",
+      "type": "bool"
+    },
+    {
+      "name": "type",
+      "type": "string"
+    }
+  ],
+  "id": "libvirt-37"
+}
+
 {
   "return": [
     {
       "cpu-max": 1
     }
   ],
-  "id": "libvirt-37"
+  "id": "libvirt-38"
 }
 
 {
       "static": false
     }
   ],
-  "id": "libvirt-38"
+  "id": "libvirt-39"
 }
 
 {
   "return": [
   ],
-  "id": "libvirt-39"
+  "id": "libvirt-40"
 }
 
 {
   "return": [
     "emulator"
   ],
-  "id": "libvirt-40"
+  "id": "libvirt-41"
 }
 
 {
       "option": "drive"
     }
   ],
-  "id": "libvirt-41"
+  "id": "libvirt-42"
 }
 
 {
       "capability": "dirty-bitmaps"
     }
   ],
-  "id": "libvirt-42"
+  "id": "libvirt-43"
 }
 
 {
       "meta-type": "object"
     }
   ],
-  "id": "libvirt-43"
+  "id": "libvirt-44"
 }
 
 {
index 5bee534353a9516c9b949629b377ec913e3ba0bc..340d668d295d8270efa8dbb034faffb89bb4f696 100644 (file)
   <flag name='nbd-tls'/>
   <flag name='pr-manager-helper'/>
   <flag name='qom-list-properties'/>
+  <flag name='memory-backend-file.discard-data'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
-  <microcodeVersion>419215</microcodeVersion>
+  <microcodeVersion>419968</microcodeVersion>
   <package>v2.12.0-rc0</package>
   <arch>ppc64</arch>
   <cpu type='kvm' name='default'/>
index c4e44c6d0ff5ea324106dd3fdbb3109b30c871f3..726a5fb2c8ecbb3b486393ccdf2064340bb98a4d 100644 (file)
   "id": "libvirt-34"
 }
 
+{
+  "return": [
+    {
+      "name": "policy",
+      "type": "HostMemPolicy"
+    },
+    {
+      "name": "dump",
+      "type": "bool"
+    },
+    {
+      "name": "share",
+      "type": "bool"
+    },
+    {
+      "name": "prealloc",
+      "type": "bool"
+    },
+    {
+      "name": "size",
+      "type": "int"
+    },
+    {
+      "name": "host-nodes",
+      "type": "int"
+    },
+    {
+      "name": "id",
+      "type": "string"
+    },
+    {
+      "name": "merge",
+      "type": "bool"
+    },
+    {
+      "name": "align",
+      "type": "int"
+    },
+    {
+      "name": "mem-path",
+      "type": "string"
+    },
+    {
+      "name": "discard-data",
+      "type": "bool"
+    },
+    {
+      "name": "type",
+      "type": "string"
+    }
+  ],
+  "id": "libvirt-35"
+}
+
 {
   "return": [
     {
       "alias": "s390-ccw-virtio"
     }
   ],
-  "id": "libvirt-35"
+  "id": "libvirt-36"
 }
 
 {
       "migration-safe": true
     }
   ],
-  "id": "libvirt-36"
+  "id": "libvirt-37"
 }
 
 {
   "return": [
   ],
-  "id": "libvirt-37"
+  "id": "libvirt-38"
 }
 
 {
   "return": [
     "emulator"
   ],
-  "id": "libvirt-38"
+  "id": "libvirt-39"
 }
 
 {
       "option": "drive"
     }
   ],
-  "id": "libvirt-39"
+  "id": "libvirt-40"
 }
 
 {
       "capability": "dirty-bitmaps"
     }
   ],
-  "id": "libvirt-40"
+  "id": "libvirt-41"
 }
 
 {
       "meta-type": "object"
     }
   ],
-  "id": "libvirt-41"
+  "id": "libvirt-42"
 }
 
 {
-  "id": "libvirt-42",
+  "id": "libvirt-43",
   "error": {
     "class": "GenericError",
     "desc": "The CPU definition 'max' is unknown."
index 3dc65d77aeb8a47eeccd3e1c292c964283bc0749..255387e3494366c50cbc3cfecbecef85f651a8a7 100644 (file)
   <flag name='nbd-tls'/>
   <flag name='pr-manager-helper'/>
   <flag name='qom-list-properties'/>
+  <flag name='memory-backend-file.discard-data'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>0</microcodeVersion>
index c086e04afdab18adc0b355be7e5505a71a8614ad..c40046beef6ba67f75669b41043b88e5bc53d544 100644 (file)
   "id": "libvirt-39"
 }
 
+{
+  "return": [
+    {
+      "name": "policy",
+      "type": "HostMemPolicy"
+    },
+    {
+      "name": "dump",
+      "type": "bool"
+    },
+    {
+      "name": "share",
+      "type": "bool"
+    },
+    {
+      "name": "prealloc",
+      "type": "bool"
+    },
+    {
+      "name": "size",
+      "type": "int"
+    },
+    {
+      "name": "host-nodes",
+      "type": "int"
+    },
+    {
+      "name": "id",
+      "type": "string"
+    },
+    {
+      "name": "merge",
+      "type": "bool"
+    },
+    {
+      "name": "align",
+      "type": "int"
+    },
+    {
+      "name": "mem-path",
+      "type": "string"
+    },
+    {
+      "name": "discard-data",
+      "type": "bool"
+    },
+    {
+      "name": "type",
+      "type": "string"
+    }
+  ],
+  "id": "libvirt-40"
+}
+
 {
   "return": [
     {
       "cpu-max": 255
     }
   ],
-  "id": "libvirt-40"
+  "id": "libvirt-41"
 }
 
 {
       "migration-safe": true
     }
   ],
-  "id": "libvirt-41"
+  "id": "libvirt-42"
 }
 
 {
     "tpm-crb",
     "tpm-tis"
   ],
-  "id": "libvirt-42"
+  "id": "libvirt-43"
 }
 
 {
     "passthrough",
     "emulator"
   ],
-  "id": "libvirt-43"
+  "id": "libvirt-44"
 }
 
 {
       "option": "drive"
     }
   ],
-  "id": "libvirt-44"
+  "id": "libvirt-45"
 }
 
 {
       "capability": "dirty-bitmaps"
     }
   ],
-  "id": "libvirt-45"
+  "id": "libvirt-46"
 }
 
 {
       "meta-type": "object"
     }
   ],
-  "id": "libvirt-46"
+  "id": "libvirt-47"
 }
 
 {
       }
     }
   },
-  "id": "libvirt-47"
+  "id": "libvirt-48"
 }
 
 {
       }
     }
   },
-  "id": "libvirt-48"
+  "id": "libvirt-49"
 }
 
 {
       }
     }
   },
-  "id": "libvirt-49"
+  "id": "libvirt-50"
 }
 
 {
       }
     }
   },
-  "id": "libvirt-50"
+  "id": "libvirt-51"
 }
 
 {
index 66fc7782b877e3c74337b0eefdc655e6539645f6..a70370ba5391db2d562b65711c561ffa182b0548 100644 (file)
   <flag name='tpm-crb'/>
   <flag name='pr-manager-helper'/>
   <flag name='qom-list-properties'/>
+  <flag name='memory-backend-file.discard-data'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
-  <microcodeVersion>390060</microcodeVersion>
+  <microcodeVersion>390813</microcodeVersion>
   <package>v2.12.0-rc0</package>
   <arch>x86_64</arch>
   <hostCPU type='kvm' model='base' migratability='yes'>