[libvirt] PATCH: Fix hang setting QEMU vcpu count

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

 



In the QEMu driver, the qemudDomainSetVcpus() entry point is calling into
another entry point qemudDomainGetMaxVcpus(), this causes a deadlock due
to recursive mutex locking. The qemudDomainSetVcpus() method should in fact
be calling the internal method qemudGetMaxVCPUs(). This patch makes it do
that, thus avoiding the recursive mutex locking.

Daniel

diff -r 6d2500176f31 src/qemu_driver.c
--- a/src/qemu_driver.c	Tue Mar 10 11:05:49 2009 +0000
+++ b/src/qemu_driver.c	Tue Mar 10 12:09:41 2009 +0000
@@ -2725,6 +2725,7 @@ static int qemudDomainSetVcpus(virDomain
     virDomainObjPtr vm;
     int max;
     int ret = -1;
+    const char *type;
 
     qemuDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -2745,7 +2746,14 @@ static int qemudDomainSetVcpus(virDomain
         goto cleanup;
     }
 
-    if ((max = qemudDomainGetMaxVcpus(dom)) < 0) {
+    if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
+        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
+                         _("unknown virt type in domain definition '%d'"),
+                         vm->def->virtType);
+        goto cleanup;
+    }
+
+    if ((max = qemudGetMaxVCPUs(dom->conn, type)) < 0) {
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
                          _("could not determine max vcpus for the domain"));
         goto cleanup;

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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