]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Extract and store vCPU properties as qemu returned them
authorPeter Krempa <pkrempa@redhat.com>
Thu, 29 Aug 2019 12:47:10 +0000 (14:47 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 29 Aug 2019 14:36:26 +0000 (16:36 +0200)
In addition to the data that libvirt needs and extracts internally,
copy and store the whole 'props' JSON sub-object of the data returned by
query-hotpluggable-cpus for future use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c

index 4998474dc91a955bb06ebc5a1d611d642a2c181a..657f3ecfe44a6fd77a2fc24a28722e93535683d7 100644 (file)
@@ -1144,6 +1144,7 @@ qemuDomainVcpuPrivateDispose(void *obj)
 
     VIR_FREE(priv->type);
     VIR_FREE(priv->alias);
+    virJSONValueFree(priv->props);
     return;
 }
 
@@ -11920,6 +11921,8 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
         VIR_STEAL_PTR(vcpupriv->type, info[i].type);
         VIR_FREE(vcpupriv->alias);
         VIR_STEAL_PTR(vcpupriv->alias, info[i].alias);
+        virJSONValueFree(vcpupriv->props);
+        VIR_STEAL_PTR(vcpupriv->props, info[i].props);
         vcpupriv->enable_id = info[i].id;
         vcpupriv->qemu_id = info[i].qemu_id;
 
index 37a00323a74388e71726c9abcdae588c080b3fdd..d097f233428c2e3588b322e247433b9855b41b09 100644 (file)
@@ -449,6 +449,9 @@ struct _qemuDomainVcpuPrivate {
     char *alias;
     virTristateBool halted;
 
+    /* copy of the data that qemu returned */
+    virJSONValuePtr props;
+
     /* information for hotpluggable cpus */
     char *type;
     int socket_id;
index a880da3ab69f3d90599f869062d6bf6c8a3472e1..58ad109680d81297b99d481a1a881f802461e49c 100644 (file)
@@ -1780,6 +1780,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus,
         VIR_FREE(cpus[i].qom_path);
         VIR_FREE(cpus[i].alias);
         VIR_FREE(cpus[i].type);
+        virJSONValueFree(cpus[i].props);
     }
 }
 
@@ -1931,6 +1932,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
         VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path);
         VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias);
         VIR_STEAL_PTR(vcpus[mastervcpu].type, hotplugvcpus[i].type);
+        VIR_STEAL_PTR(vcpus[mastervcpu].props, hotplugvcpus[i].props);
         vcpus[mastervcpu].id = hotplugvcpus[i].enable_id;
 
         /* copy state information to slave vcpus */
index 88c9702530bdf4be6188abb20e405a1a15a09cd3..de85a3ba0d3f398b9e9100694ed3ce0aa503f406 100644 (file)
@@ -570,6 +570,9 @@ struct qemuMonitorQueryHotpluggableCpusEntry {
     char *qom_path; /* full device qom path only present for online cpus */
     char *alias; /* device alias, may be NULL for non-hotpluggable entities */
 
+    /* verbatim copy of the JSON data representing the CPU which must be used for hotplug */
+    virJSONValuePtr props;
+
     /* topology information -1 if qemu didn't report given parameter */
     int node_id;
     int socket_id;
@@ -603,6 +606,9 @@ struct _qemuMonitorCPUInfo {
     /* name of the qemu type to add in case of hotplug */
     char *type;
 
+    /* verbatim copy of the returned data from qemu which should be used when plugging */
+    virJSONValuePtr props;
+
     /* alias of an hotpluggable entry. Entries with alias can be hot-unplugged */
     char *alias;
 
index d38b2f2cbe0364ebf99b10b7f5b99c7cd535bd22..da1e89ddeda1dcaa43e4c7f5a7ea822fc0fea454 100644 (file)
@@ -8378,6 +8378,7 @@ qemuMonitorQueryHotpluggableCpusFree(struct qemuMonitorQueryHotpluggableCpusEntr
         VIR_FREE(entry->type);
         VIR_FREE(entry->qom_path);
         VIR_FREE(entry->alias);
+        virJSONValueFree(entry->props);
     }
 
     VIR_FREE(entries);
@@ -8426,6 +8427,9 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONValuePtr vcpu,
         return -1;
     }
 
+    if (!(entry->props = virJSONValueCopy(props)))
+        return -1;
+
     entry->node_id = -1;
     entry->socket_id = -1;
     entry->core_id = -1;