[PATCH 2/2] qemu: command: Use all vCPU properties when creating args for vCPU hotplug

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

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                       | 19 +++----------------
 .../x86-modern-bulk-monitor.json              |  8 ++++----
 .../x86-modern-individual-add-monitor.json    |  4 ++--
 3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 373ebd6d1a..1ca1ecd2f0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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);
diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json b/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json
index 4dcb6a2cf5..b1d02b8d43 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json
+++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json
@@ -141,9 +141,9 @@
     "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"
 }
@@ -303,9 +303,9 @@
     "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"
 }
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
index 294198b270..df05e5e3a9 100644
--- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
@@ -141,9 +141,9 @@
     "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"
 }
-- 
2.21.0

--
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