[Cluster-devel] cluster/fence/agents/xvm xml.c
lhh at sourceware.org
lhh at sourceware.org
Tue Jun 26 17:31:33 UTC 2007
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2007-06-26 17:31:33
Modified files:
fence/agents/xvm: xml.c
Log message:
Ancillary patch to fix debug output
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xml.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
--- cluster/fence/agents/xvm/xml.c 2007/06/26 17:23:41 1.2
+++ cluster/fence/agents/xvm/xml.c 2007/06/26 17:31:32 1.3
@@ -9,6 +9,12 @@
#include <ctype.h>
+#ifdef STANDALONE
+#define dprintf(x, fmt, args...) printf("<%d> " fmt, x, ##args)
+#else
+#include "xvm.h"
+#endif
+
xmlNodePtr
get_os_node(xmlDocPtr doc)
{
@@ -52,7 +58,7 @@
}
if (xmlGetProp(curr, (xmlChar *)"port")) {
- printf("Zapping the port spec\n");
+ dprintf(5,"Zapping the graphics port\n");
xmlSetProp(curr, (xmlChar *)"port", (xmlChar *)"-1");
}
@@ -69,7 +75,7 @@
curr = xmlDocGetRootElement(doc);
if (xmlStrcmp(curr->name, (xmlChar *)"domain")) {
- printf("Invalid XML\n");
+ dprintf(1, "Invalid XML\n");
return -1;
}
@@ -84,7 +90,7 @@
curr = curr->next;
}
if (!curr) {
- printf("Unable to determine the domain type\n");
+ dprintf(1, "Unable to determine the domain type\n");
return -1;
}
@@ -93,15 +99,15 @@
if (!strcasecmp(val, "hvm")) {
type = 1;
- printf("Virtual machine is HVM\n");
+ dprintf(2, "Virtual machine is HVM\n");
} else if (!strcasecmp(val, "linux")) {
type = 2;
- printf("Virtual machine is Linux\n");
+ dprintf(2, "Virtual machine is Linux\n");
}
/* Node is still pointing to the <os> block */
if (type == 2) {
- printf("Unlinkiking %s block\n", (char *)os_node->name);
+ dprintf(3, "Unlinkiking %s block\n", (char *)os_node->name);
xmlUnlinkNode(os_node);
xmlFreeNode(os_node);
}
@@ -144,12 +150,12 @@
*xtreep = xmlParseMemory(buffer, size);
if (!*xtreep) {
- printf("parse failure %p %d\n", buffer, (int)size);
+ dprintf(1, "parse failure %p %d\n", buffer, (int)size);
return -1;
}
if (!((cur = xmlDocGetRootElement(*xtreep)))) {
- printf("root element failure\n");
+ dprintf(1, "root element failure\n");
xmlFreeDoc(*xtreep);
*xtreep = NULL;
return -1;
More information about the Cluster-devel
mailing list