mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
Report errors in virCapabilitiesFormatXML
So far, we only report an error if formatting the siblings bitmap in NUMA topology fails. Be consistent and always report error in virCapabilitiesFormatXML.
This commit is contained in:
parent
058d89b9df
commit
28b9be2481
@ -150,10 +150,8 @@ bhyveConnectGetCapabilities(virConnectPtr conn)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(xml = virCapabilitiesFormatXML(caps))) {
|
||||
virReportOOMError();
|
||||
if (!(xml = virCapabilitiesFormatXML(caps)))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(caps);
|
||||
|
@ -1025,10 +1025,8 @@ virCapabilitiesFormatXML(virCapsPtr caps)
|
||||
virBufferAdjustIndent(&buf, -2);
|
||||
virBufferAddLit(&buf, "</capabilities>\n");
|
||||
|
||||
if (virBufferError(&buf)) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
if (virBufferCheckError(&buf) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
@ -1420,14 +1420,8 @@ static char *
|
||||
esxConnectGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
esxPrivate *priv = conn->privateData;
|
||||
char *xml = virCapabilitiesFormatXML(priv->caps);
|
||||
|
||||
if (!xml) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return xml;
|
||||
return virCapabilitiesFormatXML(priv->caps);
|
||||
}
|
||||
|
||||
|
||||
|
@ -594,8 +594,7 @@ libxlConnectGetCapabilities(virConnectPtr conn)
|
||||
return NULL;
|
||||
|
||||
cfg = libxlDriverConfigGet(driver);
|
||||
if ((xml = virCapabilitiesFormatXML(cfg->caps)) == NULL)
|
||||
virReportOOMError();
|
||||
xml = virCapabilitiesFormatXML(cfg->caps);
|
||||
|
||||
virObjectUnref(cfg);
|
||||
return xml;
|
||||
|
@ -232,8 +232,7 @@ static char *lxcConnectGetCapabilities(virConnectPtr conn) {
|
||||
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
||||
return NULL;
|
||||
|
||||
if ((xml = virCapabilitiesFormatXML(caps)) == NULL)
|
||||
virReportOOMError();
|
||||
xml = virCapabilitiesFormatXML(caps);
|
||||
|
||||
virObjectUnref(caps);
|
||||
return xml;
|
||||
|
@ -186,8 +186,7 @@ parallelsConnectGetCapabilities(virConnectPtr conn)
|
||||
char *xml;
|
||||
|
||||
parallelsDriverLock(privconn);
|
||||
if ((xml = virCapabilitiesFormatXML(privconn->caps)) == NULL)
|
||||
virReportOOMError();
|
||||
xml = virCapabilitiesFormatXML(privconn->caps);
|
||||
parallelsDriverUnlock(privconn);
|
||||
return xml;
|
||||
}
|
||||
|
@ -3582,12 +3582,8 @@ static char *
|
||||
phypConnectGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
phyp_driverPtr phyp_driver = conn->privateData;
|
||||
char *xml;
|
||||
|
||||
if ((xml = virCapabilitiesFormatXML(phyp_driver->caps)) == NULL)
|
||||
virReportOOMError();
|
||||
|
||||
return xml;
|
||||
return virCapabilitiesFormatXML(phyp_driver->caps);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1245,8 +1245,7 @@ static char *qemuConnectGetCapabilities(virConnectPtr conn) {
|
||||
if (!(caps = virQEMUDriverGetCapabilities(driver, true)))
|
||||
goto cleanup;
|
||||
|
||||
if ((xml = virCapabilitiesFormatXML(caps)) == NULL)
|
||||
virReportOOMError();
|
||||
xml = virCapabilitiesFormatXML(caps);
|
||||
virObjectUnref(caps);
|
||||
|
||||
cleanup:
|
||||
|
@ -1677,8 +1677,7 @@ static char *testConnectGetCapabilities(virConnectPtr conn)
|
||||
testConnPtr privconn = conn->privateData;
|
||||
char *xml;
|
||||
testDriverLock(privconn);
|
||||
if ((xml = virCapabilitiesFormatXML(privconn->caps)) == NULL)
|
||||
virReportOOMError();
|
||||
xml = virCapabilitiesFormatXML(privconn->caps);
|
||||
testDriverUnlock(privconn);
|
||||
return xml;
|
||||
}
|
||||
|
@ -1310,8 +1310,7 @@ static char *umlConnectGetCapabilities(virConnectPtr conn) {
|
||||
return NULL;
|
||||
|
||||
umlDriverLock(driver);
|
||||
if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
|
||||
virReportOOMError();
|
||||
xml = virCapabilitiesFormatXML(driver->caps);
|
||||
umlDriverUnlock(driver);
|
||||
|
||||
return xml;
|
||||
|
@ -720,17 +720,11 @@ static char *
|
||||
xenUnifiedConnectGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||
char *xml;
|
||||
|
||||
if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(xml = virCapabilitiesFormatXML(priv->caps))) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return xml;
|
||||
return virCapabilitiesFormatXML(priv->caps);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -2557,14 +2557,8 @@ char *
|
||||
xenHypervisorGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||
char *xml;
|
||||
|
||||
if (!(xml = virCapabilitiesFormatXML(priv->caps))) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return xml;
|
||||
return virCapabilitiesFormatXML(priv->caps);
|
||||
}
|
||||
|
||||
|
||||
|
@ -445,12 +445,8 @@ xenapiConnectGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
|
||||
virCapsPtr caps = ((struct _xenapiPrivate *)(conn->privateData))->caps;
|
||||
if (caps) {
|
||||
char *xml = virCapabilitiesFormatXML(caps);
|
||||
if (!xml)
|
||||
goto cleanup;
|
||||
return xml;
|
||||
}
|
||||
if (caps)
|
||||
return virCapabilitiesFormatXML(caps);
|
||||
cleanup:
|
||||
xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("Capabilities not available"));
|
||||
|
@ -114,10 +114,8 @@ test_virCapabilitiesFormat(const void *opaque)
|
||||
data->max_mem_in_cell)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(capsXML = virCapabilitiesFormatXML(caps))) {
|
||||
fprintf(stderr, "Unable to format capabilities XML");
|
||||
if (!(capsXML = virCapabilitiesFormatXML(caps)))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virAsprintf(&path, "%s/vircaps2xmldata/vircaps-%s.xml",
|
||||
abs_srcdir, data->filename) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user