|
|
6ae9ed |
From 0cf2ad925d4c4258d08e85e80700d6b1163fff2c Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <0cf2ad925d4c4258d08e85e80700d6b1163fff2c@dist-git>
|
|
|
6ae9ed |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
6ae9ed |
Date: Fri, 26 Aug 2016 15:45:27 -0400
|
|
|
6ae9ed |
Subject: [PATCH] qemu: driver: Validate configuration when setting maximum
|
|
|
6ae9ed |
vcpu count
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1370066
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Setting vcpu count when cpu topology is specified may result into an
|
|
|
6ae9ed |
invalid configuration. Since the topology can't be modified, reject the
|
|
|
6ae9ed |
setting if it doesn't match the requested topology. This will allow
|
|
|
6ae9ed |
fixing the topology in case it was broken.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
(cherry picked from commit 802fac97ec8c8bd5438ec5bcd4d13edb03b00fc2)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_driver.c | 12 ++++++++++++
|
|
|
6ae9ed |
1 file changed, 12 insertions(+)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
6ae9ed |
index c8c7aee..8081417 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_driver.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_driver.c
|
|
|
6ae9ed |
@@ -4736,6 +4736,18 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
+ if (persistentDef && persistentDef->cpu && persistentDef->cpu->sockets) {
|
|
|
6ae9ed |
+ /* allow setting a valid vcpu count for the topology so an invalid
|
|
|
6ae9ed |
+ * setting may be corrected via this API */
|
|
|
6ae9ed |
+ if (nvcpus != persistentDef->cpu->sockets *
|
|
|
6ae9ed |
+ persistentDef->cpu->cores *
|
|
|
6ae9ed |
+ persistentDef->cpu->threads) {
|
|
|
6ae9ed |
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
|
|
|
6ae9ed |
+ _("CPU topology doesn't match the desired vcpu count"));
|
|
|
6ae9ed |
+ goto cleanup;
|
|
|
6ae9ed |
+ }
|
|
|
6ae9ed |
+ }
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|