diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c53ab97b9c..3fe291863b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10508,6 +10508,10 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL) < 0) goto error; + if (vcpupriv->node_id != -1 && + virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) < 0) + goto error; + return ret; error: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9a8ae26aca..d9c4ec6279 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6986,6 +6986,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, vcpupriv->socket_id = info[i].socket_id; vcpupriv->core_id = info[i].core_id; vcpupriv->thread_id = info[i].thread_id; + vcpupriv->node_id = info[i].node_id; vcpupriv->vcpus = info[i].vcpus; VIR_FREE(vcpupriv->type); VIR_STEAL_PTR(vcpupriv->type, info[i].type); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index aae322473b..365b23c961 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -359,6 +359,7 @@ struct _qemuDomainVcpuPrivate { int socket_id; int core_id; int thread_id; + int node_id; int vcpus; }; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5c29b3763a..2b0afcc21c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1750,6 +1750,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus, cpus[i].socket_id = -1; cpus[i].core_id = -1; cpus[i].thread_id = -1; + cpus[i].node_id = -1; cpus[i].vcpus = 0; cpus[i].tid = 0; cpus[i].halted = false; @@ -1902,6 +1903,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl vcpus[mastervcpu].socket_id = hotplugvcpus[i].socket_id; vcpus[mastervcpu].core_id = hotplugvcpus[i].core_id; vcpus[mastervcpu].thread_id = hotplugvcpus[i].thread_id; + vcpus[mastervcpu].node_id = hotplugvcpus[i].node_id; vcpus[mastervcpu].vcpus = hotplugvcpus[i].vcpus; VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path); VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 8956bf929a..1697db55cd 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -483,6 +483,7 @@ struct _qemuMonitorCPUInfo { int socket_id; int core_id; int thread_id; + int node_id; unsigned int vcpus; /* number of vcpus added if given entry is hotplugged */ /* name of the qemu type to add in case of hotplug */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d669dfb32d..b04da77fc1 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5219,7 +5219,7 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def) if (vcpu->online && vcpu->hotpluggable == VIR_TRISTATE_BOOL_YES) { if ((vcpupriv->socket_id == -1 && vcpupriv->core_id == -1 && - vcpupriv->thread_id == -1) || + vcpupriv->thread_id == -1 && vcpupriv->node_id == -1) || !vcpupriv->type) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vcpu '%zu' is missing hotplug data"), i); diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json new file mode 100644 index 0000000000..6b39efa69c --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json @@ -0,0 +1,35 @@ +{ + "return": [ + { + "arch": "x86", + "current": true, + "props": { + "core-id": 0, + "thread-id": 0, + "node-id": 0, + "socket-id": 0 + }, + "CPU": 0, + "qom_path": "/machine/unattached/device[0]", + "pc": 1048956, + "halted": true, + "thread_id": 2033724 + }, + { + "arch": "x86", + "current": false, + "props": { + "core-id": 0, + "thread-id": 1, + "node-id": 1, + "socket-id": 0 + }, + "CPU": 1, + "qom_path": "/machine/unattached/device[2]", + "pc": 1037318, + "halted": true, + "thread_id": 2033725 + } + ], + "id": "libvirt-21" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json new file mode 100644 index 0000000000..dfddd96323 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json @@ -0,0 +1,87 @@ +{ + "return": [ + { + "props": { + "core-id": 1, + "thread-id": 1, + "node-id": 1, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 0, + "node-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 1, + "node-id": 1, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "node-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 1, + "node-id": 1, + "socket-id": 0 + }, + "vcpus-count": 1, + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 0, + "node-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 1, + "node-id": 1, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[2]", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "node-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]", + "type": "Broadwell-x86_64-cpu" + } + ], + "id": "libvirt-20" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data new file mode 100644 index 0000000000..070ea084e7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data @@ -0,0 +1,48 @@ +[vcpu libvirt-id='0'] + online=yes + hotpluggable=no + thread-id='2033724' + enable-id='1' + query-cpus-id='0' + type='Broadwell-x86_64-cpu' + qom_path='/machine/unattached/device[0]' + topology: socket='0' core='0' thread='0' node='0' vcpus='1' +[vcpu libvirt-id='1'] + online=yes + hotpluggable=no + thread-id='2033725' + enable-id='2' + query-cpus-id='1' + type='Broadwell-x86_64-cpu' + qom_path='/machine/unattached/device[2]' + topology: socket='0' core='0' thread='1' node='1' vcpus='1' +[vcpu libvirt-id='2'] + online=no + hotpluggable=yes + type='Broadwell-x86_64-cpu' + topology: socket='0' core='1' thread='0' node='0' vcpus='1' +[vcpu libvirt-id='3'] + online=no + hotpluggable=yes + type='Broadwell-x86_64-cpu' + topology: socket='0' core='1' thread='1' node='1' vcpus='1' +[vcpu libvirt-id='4'] + online=no + hotpluggable=yes + type='Broadwell-x86_64-cpu' + topology: socket='1' core='0' thread='0' node='0' vcpus='1' +[vcpu libvirt-id='5'] + online=no + hotpluggable=yes + type='Broadwell-x86_64-cpu' + topology: socket='1' core='0' thread='1' node='1' vcpus='1' +[vcpu libvirt-id='6'] + online=no + hotpluggable=yes + type='Broadwell-x86_64-cpu' + topology: socket='1' core='1' thread='0' node='0' vcpus='1' +[vcpu libvirt-id='7'] + online=no + hotpluggable=yes + type='Broadwell-x86_64-cpu' + topology: socket='1' core='1' thread='1' node='1' vcpus='1' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e9f9d47b51..6da27f7839 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2604,6 +2604,8 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus, virBufferAsprintf(&buf, " core='%d'", vcpu->core_id); if (vcpu->thread_id != -1) virBufferAsprintf(&buf, " thread='%d'", vcpu->thread_id); + if (vcpu->node_id != -1) + virBufferAsprintf(&buf, " node='%d'", vcpu->node_id); if (vcpu->vcpus != 0) virBufferAsprintf(&buf, " vcpus='%u'", vcpu->vcpus); virBufferAddLit(&buf, "\n"); @@ -2913,6 +2915,7 @@ mymain(void) DO_TEST_CPU_INFO("x86-basic-pluggable", 8); DO_TEST_CPU_INFO("x86-full", 11); + DO_TEST_CPU_INFO("x86-node-full", 8); DO_TEST_CPU_INFO("ppc64-basic", 24); DO_TEST_CPU_INFO("ppc64-hotplug-1", 24);