Daniel P. Berrange 511f6c
From: Daniel P. Berrange <berrange@redhat.com>
Daniel P. Berrange 511f6c
Date: Mon, 16 Mar 2009 11:44:46 +0000 (+0000)
Daniel P. Berrange 511f6c
Subject: Avoid deadlock setting vcpus in QEMU driver
Daniel P. Berrange 511f6c
X-Git-Url: http://git.et.redhat.com/?p=libvirt.git;a=commitdiff_plain;h=4d7ecd146ce4de847256ae0887963719f214f62f
Daniel P. Berrange 511f6c
Daniel P. Berrange 511f6c
Avoid deadlock setting vcpus in QEMU driver
Daniel P. Berrange 511f6c
---
Daniel P. Berrange 511f6c
Daniel P. Berrange 511f6c
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
Daniel P. Berrange 511f6c
index dad7098..51442d6 100644
Daniel P. Berrange 511f6c
--- a/src/qemu_driver.c
Daniel P. Berrange 511f6c
+++ b/src/qemu_driver.c
Daniel P. Berrange 511f6c
@@ -2725,6 +2725,7 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
Daniel P. Berrange 511f6c
     virDomainObjPtr vm;
Daniel P. Berrange 511f6c
     int max;
Daniel P. Berrange 511f6c
     int ret = -1;
Daniel P. Berrange 511f6c
+    const char *type;
Daniel P. Berrange 511f6c
 
Daniel P. Berrange 511f6c
     qemuDriverLock(driver);
Daniel P. Berrange 511f6c
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
Daniel P. Berrange 511f6c
@@ -2745,7 +2746,14 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
Daniel P. Berrange 511f6c
         goto cleanup;
Daniel P. Berrange 511f6c
     }
Daniel P. Berrange 511f6c
 
Daniel P. Berrange 511f6c
-    if ((max = qemudDomainGetMaxVcpus(dom)) < 0) {
Daniel P. Berrange 511f6c
+    if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
Daniel P. Berrange 511f6c
+        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
Daniel P. Berrange 511f6c
+                         _("unknown virt type in domain definition '%d'"),
Daniel P. Berrange 511f6c
+                         vm->def->virtType);
Daniel P. Berrange 511f6c
+        goto cleanup;
Daniel P. Berrange 511f6c
+    }
Daniel P. Berrange 511f6c
+
Daniel P. Berrange 511f6c
+    if ((max = qemudGetMaxVCPUs(dom->conn, type)) < 0) {
Daniel P. Berrange 511f6c
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
Daniel P. Berrange 511f6c
                          _("could not determine max vcpus for the domain"));
Daniel P. Berrange 511f6c
         goto cleanup;