|
Cole Robinson |
750aec |
commit 0e51348cb9aeafe5e2fd6469a4bde0baa1eb8720
|
|
Cole Robinson |
750aec |
Author: Cole Robinson <crobinso@redhat.com>
|
|
Cole Robinson |
750aec |
Date: Mon May 4 15:06:03 2009 -0400
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
Refresh QEMU driver capabilities for each getCapabilities call.
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
Also fix up a couple issues where caps are accessed without locking
|
|
Cole Robinson |
750aec |
the driver structure.
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
|
|
Cole Robinson |
750aec |
index 23ea961..790dac6 100644
|
|
Cole Robinson |
750aec |
--- a/src/qemu_driver.c
|
|
Cole Robinson |
750aec |
+++ b/src/qemu_driver.c
|
|
Cole Robinson |
750aec |
@@ -1885,10 +1885,12 @@ static int qemudGetNodeInfo(virConnectPtr conn,
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
static char *qemudGetCapabilities(virConnectPtr conn) {
|
|
Cole Robinson |
750aec |
struct qemud_driver *driver = conn->privateData;
|
|
Cole Robinson |
750aec |
- char *xml;
|
|
Cole Robinson |
750aec |
+ char *xml = NULL;
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
qemuDriverLock(driver);
|
|
Cole Robinson |
750aec |
- if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
|
|
Cole Robinson |
750aec |
+ virCapabilitiesFree(qemu_driver->caps);
|
|
Cole Robinson |
750aec |
+ if ((qemu_driver->caps = qemudCapsInit()) == NULL ||
|
|
Cole Robinson |
750aec |
+ (xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
|
|
Cole Robinson |
750aec |
virReportOOMError(conn);
|
|
Cole Robinson |
750aec |
qemuDriverUnlock(driver);
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
@@ -3169,20 +3171,26 @@ cleanup:
|
|
Cole Robinson |
750aec |
return ret;
|
|
Cole Robinson |
750aec |
}
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
-static int qemudNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
|
|
Cole Robinson |
750aec |
+static int qemudNodeGetSecurityModel(virConnectPtr conn,
|
|
Cole Robinson |
750aec |
+ virSecurityModelPtr secmodel)
|
|
Cole Robinson |
750aec |
{
|
|
Cole Robinson |
750aec |
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
|
|
Cole Robinson |
750aec |
char *p;
|
|
Cole Robinson |
750aec |
+ int ret = 0;
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
- if (!driver->securityDriver)
|
|
Cole Robinson |
750aec |
- return -2;
|
|
Cole Robinson |
750aec |
+ qemuDriverLock(driver);
|
|
Cole Robinson |
750aec |
+ if (!driver->securityDriver) {
|
|
Cole Robinson |
750aec |
+ ret = -2;
|
|
Cole Robinson |
750aec |
+ goto cleanup;
|
|
Cole Robinson |
750aec |
+ }
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
p = driver->caps->host.secModel.model;
|
|
Cole Robinson |
750aec |
if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
|
|
Cole Robinson |
750aec |
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
Cole Robinson |
750aec |
_("security model string exceeds max %d bytes"),
|
|
Cole Robinson |
750aec |
VIR_SECURITY_MODEL_BUFLEN-1);
|
|
Cole Robinson |
750aec |
- return -1;
|
|
Cole Robinson |
750aec |
+ ret = -1;
|
|
Cole Robinson |
750aec |
+ goto cleanup;
|
|
Cole Robinson |
750aec |
}
|
|
Cole Robinson |
750aec |
strcpy(secmodel->model, p);
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
@@ -3191,10 +3199,14 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr sec
|
|
Cole Robinson |
750aec |
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
Cole Robinson |
750aec |
_("security DOI string exceeds max %d bytes"),
|
|
Cole Robinson |
750aec |
VIR_SECURITY_DOI_BUFLEN-1);
|
|
Cole Robinson |
750aec |
- return -1;
|
|
Cole Robinson |
750aec |
+ ret = -1;
|
|
Cole Robinson |
750aec |
+ goto cleanup;
|
|
Cole Robinson |
750aec |
}
|
|
Cole Robinson |
750aec |
strcpy(secmodel->doi, p);
|
|
Cole Robinson |
750aec |
- return 0;
|
|
Cole Robinson |
750aec |
+
|
|
Cole Robinson |
750aec |
+cleanup:
|
|
Cole Robinson |
750aec |
+ qemuDriverUnlock(driver);
|
|
Cole Robinson |
750aec |
+ return ret;
|
|
Cole Robinson |
750aec |
}
|
|
Cole Robinson |
750aec |
|
|
Cole Robinson |
750aec |
/* TODO: check seclabel restore */
|