So far, we only report an error if formatting the siblings bitmap
in NUMA topology fails.
Be consistent and always report error in virCapabilitiesFormatXML.
---
src/bhyve/bhyve_driver.c | 4 +---
src/conf/capabilities.c | 2 +-
src/esx/esx_driver.c | 8 +-------
src/libxl/libxl_driver.c | 3 +--
src/lxc/lxc_driver.c | 3 +--
src/parallels/parallels_driver.c | 3 +--
src/phyp/phyp_driver.c | 6 +-----
src/qemu/qemu_driver.c | 3 +--
src/test/test_driver.c | 3 +--
src/uml/uml_driver.c | 3 +--
src/xen/xen_driver.c | 8 +-------
src/xen/xen_hypervisor.c | 8 +-------
src/xenapi/xenapi_driver.c | 8 ++------
tests/vircaps2xmltest.c | 4 +---
14 files changed, 15 insertions(+), 51 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index eb5fc95..6c0c8b1 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -150,10 +150,8 @@ bhyveConnectGetCapabilities(virConnectPtr conn)
goto cleanup;
}
- if (!(xml = virCapabilitiesFormatXML(caps))) {
- virReportOOMError();
+ if (!(xml = virCapabilitiesFormatXML(caps)))
goto cleanup;
- }
cleanup:
virObjectUnref(caps);
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 19359a5..fca461a 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1025,7 +1025,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</capabilities>\n");
- if (virBufferError(&buf)) {
+ if (virBufferCheckError(&buf) < 0) {
virBufferFreeAndReset(&buf);
return NULL;
}
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 5dd0a63..48e0cd9 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -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);
}
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 646c9b9..08faa19 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -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;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3875bf3..f2bbd5e 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -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;
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 411527c..b388e2d 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -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;
}
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 508e4c0..659f8db 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -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
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d45a161..fd91d15 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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:
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 0bf710a..7bfc88d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -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;
}
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index f14cfaa..62d1afe 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -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;
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 8c0050a..9355a4e 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -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
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 2e35edf..524b21f 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -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);
}
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 500b78a..e3bb77e 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -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"));
diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index 7166c98..d8b61aa 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -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)
--
1.8.5.5