qemu: command: Use all vCPU properties when creating args for vCPU hotplug

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>
This commit is contained in:
Peter Krempa 2019-08-29 15:15:23 +02:00
parent a0b61591f2
commit c87c42f0eb
3 changed files with 9 additions and 22 deletions

View 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);

View File

@ -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"
}

View File

@ -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"
}