The function is marked as unused and breaks compilation on RHEL4. Remove
it from the tree until a new use case can be found.
---
tools/virsh-domain.c | 128 ---------------------------------------------------
1 file changed, 128 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 96dd4fa..7caa364 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9374,134 +9374,6 @@ cleanup:
return ret;
}
-/**
- * vshCompleteXMLFromDomain:
- * @ctl vshControl for error messages printing
- * @dom domain
- * @oldXML device XML before
- * @newXML and after completion
- *
- * For given domain and (probably incomplete) device XML specification try to
- * find such device in domain and complete missing parts. This is however
- * possible only when given device XML is sufficiently precise so it addresses
- * only one device.
- *
- * Returns -2 when no such device exists in domain, -3 when given XML selects many
- * (is too ambiguous), 0 in case of success. Otherwise returns -1. @newXML
- * is touched only in case of success.
- */
-ATTRIBUTE_UNUSED
-static int
-vshCompleteXMLFromDomain(vshControl *ctl, virDomainPtr dom, char *oldXML,
- char **newXML)
-{
- int funcRet = -1;
- char *domXML = NULL;
- xmlDocPtr domDoc = NULL, devDoc = NULL;
- xmlNodePtr node = NULL;
- xmlXPathContextPtr domCtxt = NULL, devCtxt = NULL;
- xmlNodePtr *devices = NULL;
- xmlSaveCtxtPtr sctxt = NULL;
- int devices_size;
- char *xpath = NULL;
- xmlBufferPtr buf = NULL;
- int i = 0;
- int indx = -1;
-
- if (!(domXML = virDomainGetXMLDesc(dom, 0))) {
- vshError(ctl, _("couldn't get XML description of domain %s"),
- virDomainGetName(dom));
- goto cleanup;
- }
-
- domDoc = virXMLParseStringCtxt(domXML, _("(domain_definition)"),
&domCtxt);
- if (!domDoc) {
- vshError(ctl, _("Failed to parse domain definition xml"));
- goto cleanup;
- }
-
- devDoc = virXMLParseStringCtxt(oldXML, _("(device_definition)"),
&devCtxt);
- if (!devDoc) {
- vshError(ctl, _("Failed to parse device definition xml"));
- goto cleanup;
- }
-
- node = xmlDocGetRootElement(devDoc);
-
- buf = xmlBufferCreate();
- if (!buf) {
- vshError(ctl, "%s", _("out of memory"));
- goto cleanup;
- }
-
- /* Get all possible devices */
- if (virAsprintf(&xpath, "/domain/devices/%s", node->name) < 0) {
- virReportOOMError();
- goto cleanup;
- }
- devices_size = virXPathNodeSet(xpath, domCtxt, &devices);
-
- if (devices_size < 0) {
- /* error */
- vshError(ctl, "%s", _("error when selecting nodes"));
- goto cleanup;
- } else if (devices_size == 0) {
- /* no such device */
- funcRet = -2;
- goto cleanup;
- }
-
- /* and refine */
- for (i = 0; i < devices_size; i++) {
- if (vshNodeIsSuperset(devices[i], node)) {
- if (indx >= 0) {
- funcRet = -3; /* ambiguous */
- goto cleanup;
- }
- indx = i;
- }
- }
-
- if (indx < 0) {
- funcRet = -2; /* no such device */
- goto cleanup;
- }
-
- vshDebug(ctl, VSH_ERR_DEBUG, "Found device at pos %d\n", indx);
-
- if (newXML) {
- sctxt = xmlSaveToBuffer(buf, NULL, 0);
- if (!sctxt) {
- vshError(ctl, "%s", _("failed to create document saving
context"));
- goto cleanup;
- }
-
- xmlSaveTree(sctxt, devices[indx]);
- xmlSaveClose(sctxt);
- *newXML = (char *) xmlBufferContent(buf);
- if (!*newXML) {
- virReportOOMError();
- goto cleanup;
- }
- buf->content = NULL;
- }
-
- vshDebug(ctl, VSH_ERR_DEBUG, "Old xml:\n%s\nNew xml:\n%s\n", oldXML,
- newXML ? NULLSTR(*newXML) : "(null)");
-
- funcRet = 0;
-
-cleanup:
- xmlBufferFree(buf);
- VIR_FREE(devices);
- xmlXPathFreeContext(devCtxt);
- xmlXPathFreeContext(domCtxt);
- xmlFreeDoc(devDoc);
- xmlFreeDoc(domDoc);
- VIR_FREE(domXML);
- VIR_FREE(xpath);
- return funcRet;
-}
/*
* "detach-device" command
--
1.8.1.1