]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: command: Use all vCPU properties when creating args for vCPU hotplug
authorPeter Krempa <pkrempa@redhat.com>
Thu, 29 Aug 2019 13:15:23 +0000 (15:15 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 29 Aug 2019 14:36:26 +0000 (16:36 +0200)
As qemu documents we should use everything in the 'props' sub-object of
the data returned by query-hotpluggable-cpus. Until now we only used
everything we recognized, but that may break in cases when qemu
introduces new fields.

This change requires a fix to the test data as some fields were
reordered.

https://bugzilla.redhat.com/show_bug.cgi?id=1741658

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_command.c
tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json
tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json

index 373ebd6d1a9244f83c0c0b6d34f780fe78f83d79..1ca1ecd2f045fd4ce12d7b230b13f239320e27e6 100644 (file)
@@ -10609,24 +10609,11 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
     qemuDomainVcpuPrivatePtr vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
     VIR_AUTOPTR(virJSONValue) ret = NULL;
 
-    if (virJSONValueObjectCreate(&ret, "s:driver", vcpupriv->type,
-                                       "s:id", vcpupriv->alias, NULL) < 0)
+    if (!(ret = virJSONValueCopy(vcpupriv->props)))
         return NULL;
 
-    if (vcpupriv->socket_id != -1 &&
-        virJSONValueObjectAdd(ret, "i:socket-id", vcpupriv->socket_id, NULL) < 0)
-        return NULL;
-
-    if (vcpupriv->core_id != -1 &&
-        virJSONValueObjectAdd(ret, "i:core-id", vcpupriv->core_id, NULL) < 0)
-        return NULL;
-
-    if (vcpupriv->thread_id != -1 &&
-        virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL) < 0)
-        return NULL;
-
-    if (vcpupriv->node_id != -1 &&
-        virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) < 0)
+    if (virJSONValueObjectPrependString(ret, "id", vcpupriv->alias) < 0 ||
+        virJSONValueObjectPrependString(ret, "driver", vcpupriv->type) < 0)
         return NULL;
 
     VIR_RETURN_PTR(ret);
index 4dcb6a2cf5e57a7cf5cd7a174326cbaee3cd21bf..b1d02b8d430e58c465f46ef6d2fc443f1f5d4052 100644 (file)
     "arguments": {
         "driver": "qemu64-x86_64-cpu",
         "id": "vcpu5",
-        "socket-id": 1,
         "core-id": 0,
-        "thread-id": 1
+        "thread-id": 1,
+        "socket-id": 1
     },
     "id": "libvirt-3"
 }
     "arguments": {
         "driver": "qemu64-x86_64-cpu",
         "id": "vcpu6",
-        "socket-id": 1,
         "core-id": 1,
-        "thread-id": 0
+        "thread-id": 0,
+        "socket-id": 1
     },
     "id": "libvirt-6"
 }
index 294198b2708969f192a383ebef0ca1028ff1f8f8..df05e5e3a95843530d4c7e0adcb243be1fce8a27 100644 (file)
     "arguments": {
         "driver": "qemu64-x86_64-cpu",
         "id": "vcpu7",
-        "socket-id": 1,
         "core-id": 1,
-        "thread-id": 1
+        "thread-id": 1,
+        "socket-id": 1
     },
     "id": "libvirt-3"
 }