rpms/libvirt/devel libvirt-0.6.3-refresh-qemu-caps.patch, NONE, 1.1 libvirt.spec, 1.129, 1.130

Cole Robinson crobinso at fedoraproject.org
Wed May 6 16:33:46 UTC 2009


Author: crobinso

Update of /cvs/pkgs/rpms/libvirt/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9542

Modified Files:
	libvirt.spec 
Added Files:
	libvirt-0.6.3-refresh-qemu-caps.patch 
Log Message:
Refresh qemu caps when getCapabilities is called (bug #460649)


libvirt-0.6.3-refresh-qemu-caps.patch:

--- NEW FILE libvirt-0.6.3-refresh-qemu-caps.patch ---
commit 0e51348cb9aeafe5e2fd6469a4bde0baa1eb8720
Author: Cole Robinson <crobinso at redhat.com>
Date:   Mon May 4 15:06:03 2009 -0400

    Refresh QEMU driver capabilities for each getCapabilities call.
    
    Also fix up a couple issues where caps are accessed without locking
    the driver structure.

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 23ea961..790dac6 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -1885,10 +1885,12 @@ static int qemudGetNodeInfo(virConnectPtr conn,
 
 static char *qemudGetCapabilities(virConnectPtr conn) {
     struct qemud_driver *driver = conn->privateData;
-    char *xml;
+    char *xml = NULL;
 
     qemuDriverLock(driver);
-    if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
+    virCapabilitiesFree(qemu_driver->caps);
+    if ((qemu_driver->caps = qemudCapsInit()) == NULL ||
+        (xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
         virReportOOMError(conn);
     qemuDriverUnlock(driver);
 
@@ -3169,20 +3171,26 @@ cleanup:
     return ret;
 }
 
-static int qemudNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
+static int qemudNodeGetSecurityModel(virConnectPtr conn,
+                                     virSecurityModelPtr secmodel)
 {
     struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
     char *p;
+    int ret = 0;
 
-    if (!driver->securityDriver)
-        return -2;
+    qemuDriverLock(driver);
+    if (!driver->securityDriver) {
+        ret = -2;
+        goto cleanup;
+    }
 
     p = driver->caps->host.secModel.model;
     if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          _("security model string exceeds max %d bytes"),
                          VIR_SECURITY_MODEL_BUFLEN-1);
-        return -1;
+        ret = -1;
+        goto cleanup;
     }
     strcpy(secmodel->model, p);
 
@@ -3191,10 +3199,14 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr sec
         qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          _("security DOI string exceeds max %d bytes"),
                          VIR_SECURITY_DOI_BUFLEN-1);
-        return -1;
+        ret = -1;
+        goto cleanup;
     }
     strcpy(secmodel->doi, p);
-    return 0;
+
+cleanup:
+    qemuDriverUnlock(driver);
+    return ret;
 }
 
 /* TODO: check seclabel restore */


Index: libvirt.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libvirt/devel/libvirt.spec,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -p -r1.129 -r1.130
--- libvirt.spec	6 May 2009 15:45:57 -0000	1.129
+++ libvirt.spec	6 May 2009 16:33:16 -0000	1.130
@@ -55,7 +55,7 @@
 Summary: Library providing a simple API virtualization
 Name: libvirt
 Version: 0.6.3
-Release: 5%{?dist}%{?extra_release}
+Release: 6%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 Source: libvirt-%{version}.tar.gz
@@ -63,6 +63,8 @@ Source: libvirt-%{version}.tar.gz
 # Patches cherry-picked from upstream
 Patch1: libvirt-0.6.3-shared-readonly-label.patch
 Patch2: libvirt-0.6.3-hostdev-managed.patch
+# Refresh qemu caps when getCapabilities is called (bz 460649)
+Patch3: libvirt-0.6.3-refresh-qemu-caps.patch
 
 # Not for upstream. Temporary hack till PulseAudio autostart
 # problems are sorted out when SELinux enforcing
@@ -218,6 +220,7 @@ of recent versions of Linux (and other O
 %setup -q
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %patch200 -p0
 
@@ -548,6 +551,9 @@ fi
 %endif
 
 %changelog
+* Wed May  6 2009 Cole Robinson <crobinso at redhat.com> - 0.6.3-6.fc12
+- Refresh qemu caps when getCapabilities is called (bug #460649)
+
 * Wed May  6 2009 Mark McLoughlin <markmc at redhat.com> - 0.6.3-5.fc12
 - Fix handling of <hostdev managed='yes'> (bug #499386)
 




More information about the scm-commits mailing list