diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index d5c2b2cd44..d62d064a25 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -759,6 +759,9 @@ qemuValidateDomainVCpuTopology(const virDomainDef *def, virQEMUCaps *qemuCaps)
{
unsigned int maxCpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, def->virtType,
def->os.machine);
+ unsigned int topologycpus;
+ unsigned int granularity;
+ unsigned int numacpus;
if (virDomainDefGetVcpus(def) == 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -773,42 +776,31 @@ qemuValidateDomainVCpuTopology(const virDomainDef *def, virQEMUCaps *qemuCaps)
return -1;
}
- /* QEMU 2.7 (detected via the availability of query-hotpluggable-cpus)
- * enforces stricter rules than previous versions when it comes to guest
- * CPU topology. Verify known constraints are respected */
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS)) {
- unsigned int topologycpus;
- unsigned int granularity;
- unsigned int numacpus;
-
- /* Starting from QEMU 2.5, max vCPU count and overall vCPU topology
- * must agree. We only actually enforce this with QEMU 2.7+, due
- * to the capability check above */
- if (virDomainDefGetVcpusTopology(def, &topologycpus) == 0) {
- if (topologycpus != virDomainDefGetVcpusMax(def)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("CPU topology doesn't match maximum vcpu count"));
- return -1;
- }
-
- numacpus = virDomainNumaGetCPUCountTotal(def->numa);
- if ((numacpus != 0) && (topologycpus != numacpus)) {
- VIR_WARN("CPU topology doesn't match numa CPU count; "
- "partial NUMA mapping is obsoleted and will "
- "be removed in future");
- }
- }
-
- /* vCPU hotplug granularity must be respected */
- granularity = qemuValidateDefGetVcpuHotplugGranularity(def);
- if ((virDomainDefGetVcpus(def) % granularity) != 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("vCPUs count must be a multiple of the vCPU hotplug granularity (%1$u)"),
- granularity);
+ /* Starting from QEMU 2.5, max vCPU count and overall vCPU topology must agree. */
+ if (virDomainDefGetVcpusTopology(def, &topologycpus) == 0) {
+ if (topologycpus != virDomainDefGetVcpusMax(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("CPU topology doesn't match maximum vcpu count"));
return -1;
}
}
+ numacpus = virDomainNumaGetCPUCountTotal(def->numa);
+ if ((numacpus != 0) && (topologycpus != numacpus)) {
+ VIR_WARN("CPU topology doesn't match numa CPU count; "
+ "partial NUMA mapping is obsoleted and will "
+ "be removed in future");
+ }
+
+ /* vCPU hotplug granularity must be respected */
+ granularity = qemuValidateDefGetVcpuHotplugGranularity(def);
+ if ((virDomainDefGetVcpus(def) % granularity) != 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("vCPUs count must be a multiple of the vCPU hotplug granularity (%1$u)"),
+ granularity);
+ return -1;
+ }
+
if (ARCH_IS_X86(def->os.arch) &&
virDomainDefGetVcpusMax(def) > QEMU_MAX_VCPUS_WITHOUT_EIM) {
if (!qemuDomainIsQ35(def)) {
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.args b/tests/qemuxml2argvdata/fd-memory-numa-topology2.args
index eb88b27e16..7313dabf78 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-accel kvm \
-m size=29360128k \
-overcommit mem-lock=off \
--smp 20,sockets=1,cores=8,threads=1 \
+-smp 20,sockets=1,cores=20,threads=1 \
-object memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0,share=off,prealloc=on,size=15032385536 \
-numa node,nodeid=0,cpus=0-7,cpus=16-19,memdev=ram-node0 \
-object memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node1,share=on,prealloc=on,size=15032385536 \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
index 5b84a49796..1572010ad8 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
@@ -14,7 +14,7 @@
-
+
|
|
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.args b/tests/qemuxml2argvdata/fd-memory-numa-topology3.args
index c10140a55d..f5d2aaf91b 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-instance-00000092/.config \
-accel kvm \
-m size=44040192k \
-overcommit mem-lock=off \
--smp 32,sockets=1,cores=24,threads=1 \
+-smp 32,sockets=1,cores=32,threads=1 \
-object memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0,share=on,prealloc=on,size=15032385536 \
-numa node,nodeid=0,cpus=0-1,cpus=6-31,memdev=ram-node0 \
-object memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node1,share=on,prealloc=on,size=15032385536 \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
index 1b8fd7dfee..36a6b5c155 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
@@ -14,7 +14,7 @@
-
+
|
|