[PATCH 5/6] qemu: driver: Validate configuration when setting maximum vcpu count

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

 



Setting vcpu count when cpu topology is specified may result into an
invalid configuration. Since the topology can't be modified, reject the
setting if it doesn't match the requested topology. This will allow
fixing the topology in case it was broken.

Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1370066
---
 src/qemu/qemu_driver.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 671d1ff..5f8c11c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4730,6 +4730,17 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
         goto cleanup;
     }

+    if (persistentDef && persistentDef->cpu && persistentDef->cpu->sockets) {
+        /* explicitly allow correcting invalid vcpu count */
+        if (nvcpus != persistentDef->cpu->sockets *
+                      persistentDef->cpu->cores *
+                      persistentDef->cpu->threads) {
+            virReportError(VIR_ERR_INVALID_ARG, "%s",
+                           _("CPU topology doesn't match the desired vcpu count"));
+            goto cleanup;
+        }
+    }
+
     if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
         goto cleanup;

-- 
2.8.2

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