[virt-tools-list] [PATCH 3 of 5] viewer: generalize extract_port() into viewer_extract_xpath_string()
Marc-André Lureau
marcandre.lureau at redhat.com
Tue Nov 30 15:08:31 UTC 2010
# HG changeset patch
# User Marc-André Lureau <marcandre.lureau at redhat.com>
# Date 1290186582 -3600
# Node ID 9f8a6e933516586fc82982cffb4721f5539c9d2f
# Parent c0b5667440d038394f1ad67d8d40580ec69a0051
viewer: generalize extract_port() into viewer_extract_xpath_string()
diff -r c0b5667440d0 -r 9f8a6e933516 src/viewer.c
--- a/src/viewer.c Fri Nov 19 18:07:48 2010 +0100
+++ b/src/viewer.c Fri Nov 19 18:09:42 2010 +0100
@@ -728,7 +728,7 @@
return 0;
}
-static char * viewer_extract_vnc_port(virDomainPtr dom)
+static char * viewer_extract_xpath_string(virDomainPtr dom, const gchar *xpath)
{
char *xmldesc = virDomainGetXMLDesc(dom, 0);
xmlDocPtr xml = NULL;
@@ -752,7 +752,7 @@
if (!ctxt)
goto error;
- obj = xmlXPathEval((const xmlChar *)"string(/domain/devices/graphics[@type='vnc']/@port)", ctxt);
+ obj = xmlXPathEval((const xmlChar *)xpath, ctxt);
if (!obj || obj->type != XPATH_STRING || !obj->stringval || !obj->stringval[0])
goto error;
if (!strcmp((const char*)obj->stringval, "-1"))
@@ -908,7 +908,7 @@
viewer_init_vnc_display(viewer);
- if ((vncport = viewer_extract_vnc_port(dom)) == NULL) {
+ if ((vncport = viewer_extract_xpath_string(dom, "string(/domain/devices/graphics[@type='vnc']/@port)")) == NULL) {
viewer_simple_message_dialog(viewer->window, _("Cannot determine the VNC port for the guest %s"),
viewer->domkey);
goto cleanup;
More information about the virt-tools-list
mailing list