[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] Improve fence_* -o metadata output for schema generation



Hi Marek,

This patch helps allow applications which rely on resource-agent
metadata to parse the output of fence_X -o metadata.

The <resource-agent> tag may not be needed, but is useful for assisting
in schema generation.  We can use <fence-agent> if this works better for
you, but the name (e.g. fence_ilo) is needed for the schema, so the
metadata output should include it.

-- Lon

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index b0b22a7..584b2e7 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -263,6 +263,8 @@ def metadata(avail_opt):
 	sorted_list = [ (key, all_opt[key]) for key in avail_opt ]
 	sorted_list.sort(lambda x, y: cmp(x[1]["order"], y[1]["order"]))
 
+	print "<?xml version=\"1.0\" ?>"
+	print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + "\" >"
 	print "<parameters>"
 	for option, value in sorted_list:
 		if all_opt[option].has_key("shortdesc"):
@@ -279,6 +281,7 @@ def metadata(avail_opt):
 			print "\t\t<shortdesc lang=\"en\">" + all_opt[option]["shortdesc"] + "</shortdesc>"
 			print "\t</parameter>"
 	print "</parameters>"
+	print "</resource-agent>"
 
 def process_input(avail_opt):
 	global all_opt
diff --git a/fence/agents/xvm/options.c b/fence/agents/xvm/options.c
index 00a2f75..0d7aaf0 100644
--- a/fence/agents/xvm/options.c
+++ b/fence/agents/xvm/options.c
@@ -517,6 +517,8 @@ args_metadata(char *progname, char *optstr)
 	int x;
 	struct arg_info *arg;
 
+	printf("<?xml version=\"1.0\" ?>\n");
+	printf("<resource-agent name=\"%s\" >\n", basename(progname));
 	printf("<parameters>\n");
 
 	for (x = 0; x < strlen(optstr); x++) {
@@ -533,6 +535,7 @@ args_metadata(char *progname, char *optstr)
 	}
 
 	printf("</parameters>\n");
+	printf("</resource-agent>\n");
 }
 
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]