mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +00:00
Refresh QEMU driver capabilities for each getCapabilities call.
Also fix up a couple issues where caps are accessed without locking the driver structure.
This commit is contained in:
parent
5432ec8ded
commit
4f10759024
@ -1,3 +1,8 @@
|
|||||||
|
Wed May 6 10:19:36 EDT 2009 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
|
* src/qemu_driver.c : Refresh QEMU driver capabilities for each
|
||||||
|
getCapabilities call.
|
||||||
|
|
||||||
Wed May 6 15:42:08 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
Wed May 6 15:42:08 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/vbox/vbox_driver.c src/vbox/vbox_tmpl.c: changes in
|
* src/vbox/vbox_driver.c src/vbox/vbox_tmpl.c: changes in
|
||||||
|
@ -1872,10 +1872,12 @@ static int qemudGetNodeInfo(virConnectPtr conn,
|
|||||||
|
|
||||||
static char *qemudGetCapabilities(virConnectPtr conn) {
|
static char *qemudGetCapabilities(virConnectPtr conn) {
|
||||||
struct qemud_driver *driver = conn->privateData;
|
struct qemud_driver *driver = conn->privateData;
|
||||||
char *xml;
|
char *xml = NULL;
|
||||||
|
|
||||||
qemuDriverLock(driver);
|
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);
|
virReportOOMError(conn);
|
||||||
qemuDriverUnlock(driver);
|
qemuDriverUnlock(driver);
|
||||||
|
|
||||||
@ -3156,20 +3158,26 @@ cleanup:
|
|||||||
return ret;
|
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;
|
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
|
||||||
char *p;
|
char *p;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (!driver->securityDriver)
|
qemuDriverLock(driver);
|
||||||
return -2;
|
if (!driver->securityDriver) {
|
||||||
|
ret = -2;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
p = driver->caps->host.secModel.model;
|
p = driver->caps->host.secModel.model;
|
||||||
if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
|
if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("security model string exceeds max %d bytes"),
|
_("security model string exceeds max %d bytes"),
|
||||||
VIR_SECURITY_MODEL_BUFLEN-1);
|
VIR_SECURITY_MODEL_BUFLEN-1);
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
strcpy(secmodel->model, p);
|
strcpy(secmodel->model, p);
|
||||||
|
|
||||||
@ -3178,10 +3186,14 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr sec
|
|||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("security DOI string exceeds max %d bytes"),
|
_("security DOI string exceeds max %d bytes"),
|
||||||
VIR_SECURITY_DOI_BUFLEN-1);
|
VIR_SECURITY_DOI_BUFLEN-1);
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
strcpy(secmodel->doi, p);
|
strcpy(secmodel->doi, p);
|
||||||
return 0;
|
|
||||||
|
cleanup:
|
||||||
|
qemuDriverUnlock(driver);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: check seclabel restore */
|
/* TODO: check seclabel restore */
|
||||||
|
Loading…
Reference in New Issue
Block a user