Skip to contentSkip to conversation

Cluster Project branch, master, updated. cluster-2.99.05-30-gc9af976

Cluster-devel [email protected] 1 participant 1 message Jun 27, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c9af976d32188297a8279f36665b191f0b50aa70

The branch, master has been updated

       via  c9af976d32188297a8279f36665b191f0b50aa70 (commit)
      from  ad8767058241f405583b446ee9f86a61fa1be273 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit c9af976d32188297a8279f36665b191f0b50aa70

Author: Lon Hohberger <[email protected]>
Date:   Fri Jun 27 11:14:22 2008 -0400

[fence] Port XVM to logsys

* For full debugging,
* Intentionally does not use LOG_DEBUG (yet) because of the amount of noise generated in doing so; but full "debugging" is available:
* use debug="10" in cluster.conf, or
* -dddddddddd on the command line.

-----------------------------------------------------------------------

Summary of changes:

 fence/agents/xvm/Makefile      |    4 +-
 fence/agents/xvm/debug.c       |    3 +
 fence/agents/xvm/debug.h       |   12 ++-
 fence/agents/xvm/fence_xvm.c   |   41 +++--
 fence/agents/xvm/fence_xvmd.c  |  371 +++++++++++++++++++++++++++++++---------
 fence/agents/xvm/ip_lookup.c   |    2 +
 fence/agents/xvm/mcast.c       |    2 +
 fence/agents/xvm/options.c     |   40 +++--
 fence/agents/xvm/simple_auth.c |    1 +
 fence/agents/xvm/tcp.c         |    2 +
 fence/agents/xvm/virt.c        |   11 +-
 fence/agents/xvm/xml.c         |    5 +-
 12 files changed, 375 insertions(+), 119 deletions(-)
fence/agents/xvm/Makefile +2 -2
index 837ecd6..6a2d31b 100644
@@ -39,10 +39,10 @@ CFLAGS += -I${incdir}
 EXTRA_CFLAGS += -DSTANDALONE
 
 LDFLAGS += -L${nsslibdir} -L${libdir}
-LDFLAGS += -lnss3
+LDFLAGS += -lnss3 -L${openaislibdir} -llogsys
 
 EXTRA_LDFLAGS += -L${ccslibdir} -lccs -L${cmanlibdir} -lcman
-EXTRA_LDFLAGS += -L${virtlibdir} -lvirt -L${openaislibdir} -lSaCkpt
+EXTRA_LDFLAGS += -L${virtlibdir} -lvirt -lSaCkpt
 XML_LDFLAGS += `xml2-config --libs`
 
 
fence/agents/xvm/debug.c +3 -0
index 8eeefda..0867490 100644
@@ -1,6 +1,8 @@
 #include <stdio.h>
 #include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_INFO);
+
 static int _debug = 0;
 
 inline void
@@ -15,3 +17,4 @@ dget(void)
 {
 	return _debug;
 }
+
fence/agents/xvm/debug.h +11 -1
index c83f048..0a1f99b 100644
@@ -1,13 +1,23 @@
 #ifndef _DBG_H
 #define _DBG_H
 
+#include <openais/service/logsys.h>
+
 inline void dset(int);
 inline int dget(void);
 
+/*
+ * Intentionally uses LOG_INFO for debugging if debugging is specified
+ * because logsys's debugging level dumps immense amounts of noise to 
+ * the log (such as the full path to the file at compile-time and line #)
+ *
+ * Specify >10 if you want this information.
+ */
+
 #define dbg_printf(level, fmt, args...) \
 do { \
 	if (dget()>=level) \
-		printf(fmt, ##args); \
+		log_printf(dget()>10?LOG_DEBUG:LOG_INFO, fmt, ##args); \
 } while(0)
 
 #endif
fence/agents/xvm/fence_xvm.c +28 -13

119 lines not on this page · raw message

fence/agents/xvm/fence_xvmd.c +289 -82

654 lines not on this page · raw message

fence/agents/xvm/ip_lookup.c +2 -0
index d42b7ab..51f8588 100644
@@ -22,6 +22,8 @@
 #include "ip_lookup.h"
 #include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_NOTICE);
+
 static int
 send_addr_dump(int fd, int family)
 {
fence/agents/xvm/mcast.c +2 -0
index c769166..30f19bd 100644
@@ -25,6 +25,8 @@
 #include "mcast.h"
 #include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS ("XVM", LOG_LEVEL_NOTICE);
+
 /** 
   Sets up a multicast receive socket
  */
fence/agents/xvm/options.c +23 -17
index f44a860..3f7f6eb 100644
@@ -23,7 +23,9 @@
 #include "simple_auth.h"
 #include "mcast.h"
 #include "options.h"
+#include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_NOTICE);
 
 
 /* Assignment functions */
@@ -64,7 +66,7 @@ assign_family(fence_xvm_args_t *args, struct arg_info *arg,
 	} else if (!strcasecmp(value, "auto")) {
 		args->family = 0;
 	} else {
-		printf("Unsupported family: '%s'\n", value);
+		log_printf(LOG_ERR, "Unsupported family: '%s'\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -95,7 +97,7 @@ assign_port(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 {
 	args->port = atoi(value);
 	if (args->port <= 0 || args->port >= 65500) {
-		printf("Invalid port: '%s'\n", value);
+		log_printf(LOG_ERR, "Invalid port: '%s'\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -106,7 +108,7 @@ assign_retrans(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 {
 	args->retr_time = atoi(value);
 	if (args->retr_time <= 0) {
-		printf("Invalid retransmit time: '%s'\n", value);
+		log_printf(LOG_ERR, "Invalid retransmit time: '%s'\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -123,7 +125,7 @@ assign_hash(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 	} else if (!strcasecmp(value, "sha512")) {
 		args->hash = HASH_SHA512;
 	} else {
-		printf("Unsupported hash: %s\n", value);
+		log_printf(LOG_ERR, "Unsupported hash: %s\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -141,7 +143,7 @@ assign_auth(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 	} else if (!strcasecmp(value, "sha512")) {
 		args->auth = AUTH_SHA512;
 	} else {
-		printf("Unsupported auth type: %s\n", value);
+		log_printf(LOG_ERR, "Unsupported auth type: %s\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -156,8 +158,8 @@ assign_key(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 	args->key_file = strdup(value);
 
 	if (stat(value, &st) == -1) {
-		printf("Invalid key file: '%s' (%s)\n", value,
-		       strerror(errno));
+ 		log_printf(LOG_ERR, "Invalid key file: '%s' (%s)\n", value,
+  		       strerror(errno));
 		args->flags |= F_ERR;
 	}
 }
@@ -173,7 +175,7 @@ assign_op(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 	} else if (!strcasecmp(value, "reboot")) {
 		args->op = FENCE_REBOOT;
 	} else {
-		printf("Unsupported operation: %s\n", value);
+		log_printf(LOG_ERR, "Unsupported operation: %s\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -183,21 +185,24 @@ static inline void
 assign_domain(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 {
 	if (args->domain) {
-		printf("Domain/UUID may not be specified more than once\n");
+		log_printf(LOG_ERR,
+		   "Domain/UUID may not be specified more than once\n");
 		args->flags |= F_ERR;
 		return;
 	}
 
+	if (args->domain)
+		free(args->domain);
 	args->domain = strdup(value);
 
 	if (strlen(value) <= 0) {
-		printf("Invalid domain name\n");
+		log_printf(LOG_ERR, "Invalid domain name\n");
 		args->flags |= F_ERR;
 	}
 
 	if (strlen(value) >= MAX_DOMAINNAME_LENGTH) {
 		errno = ENAMETOOLONG;
-		printf("Invalid domain name: '%s' (%s)\n",
+		log_printf(LOG_ERR, "Invalid domain name: '%s' (%s)\n",
 		       value, strerror(errno));
 		args->flags |= F_ERR;
 	}
@@ -223,7 +228,7 @@ assign_timeout(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 {
 	args->timeout = atoi(value);
 	if (args->timeout <= 0) {
-		printf("Invalid timeout: '%s'\n", value);
+		log_printf(LOG_ERR, "Invalid timeout: '%s'\n", value);
 		args->flags |= F_ERR;
 	}
 }
@@ -268,7 +273,6 @@ assign_uri(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 }
 
 
-
 /** ALL valid command line and stdin arguments for this fencing agent */
 static struct arg_info _arg_info[] = {
 	{ '\xff', NULL, "agent",
@@ -421,8 +425,8 @@ args_init(fence_xvm_args_t *args)
 }
 
 
-#define _pr_int(piece) printf("  %s = %d\n", #piece, piece)
-#define _pr_str(piece) printf("  %s = %s\n", #piece, piece)
+#define _pr_int(piece) dbg_printf(1, "  %s = %d\n", #piece, piece)
+#define _pr_str(piece) dbg_printf(1, "  %s = %s\n", #piece, piece)
 
 
 /**
@@ -433,7 +437,7 @@ args_init(fence_xvm_args_t *args)
 void
 args_print(fence_xvm_args_t *args)
 {
-	printf("-- args @ %p --\n", args);
+	dbg_printf(1, "-- args @ %p --\n", args);
 	_pr_str(args->addr);
 	_pr_str(args->domain);
 	_pr_str(args->key_file);
@@ -446,7 +450,7 @@ args_print(fence_xvm_args_t *args)
 	_pr_int(args->retr_time);
 	_pr_int(args->flags);
 	_pr_int(args->debug);
-	printf("-- end args --\n");
+	dbg_printf(1, "-- end args --\n");
 }
 
 
@@ -454,6 +458,8 @@ args_print(fence_xvm_args_t *args)
   Print out arguments and help information based on what is allowed in
   the getopt string optstr.
 
+  TODO use log_printf instead of printf 
+
   @param progname	Program name.
   @param optstr		Getopt(3) style options string
   @param print_stdin	0 = print command line options + description,
fence/agents/xvm/simple_auth.c +1 -0
index 82ab204..cfa96cd 100644
@@ -13,6 +13,7 @@
 #include "simple_auth.h"
 #include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_NOTICE);
 
 void
 print_hash(unsigned char *hash, size_t hashlen)
fence/agents/xvm/tcp.c +2 -0
index a09ebd2..92bb8b1 100644
@@ -16,6 +16,8 @@
 
 #include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_NOTICE);
+
 static int connect_nb(int fd, struct sockaddr *dest, socklen_t len, int timeout);
 
 /**
fence/agents/xvm/virt.c +8 -3
index 67e946e..7aed0a3 100644
@@ -7,7 +7,9 @@
 #include <stdint.h>
 #include <errno.h>
 #include "virt.h"
+#include "debug.h"
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_NOTICE);
 
 static int
 _compare_virt(const void *_left, const void *_right)
@@ -140,16 +142,19 @@ vl_print(virt_list_t *vl)
 {
 	int x;
 
-	printf("%-24.24s %-36.36s %-5.5s %-5.5s\n", "Domain", "UUID",
+	/* XXX Once the logsys stderr "tag" goes away, the 21s should go back
+	   to 24s. */
+
+	dbg_printf(1, "%-21.21s %-36.36s %-5.5s %-5.5s\n", "Domain", "UUID",
 	       "Owner", "State");
-	printf("%-24.24s %-36.36s %-5.5s %-5.5s\n", "------", "----",
+	dbg_printf(1, "%-21.21s %-36.36s %-5.5s %-5.5s\n", "------", "----",
 	       "-----", "-----");
 
 	if (!vl || !vl->vm_count)
 		return;
 
 	for (x = 0; x < vl->vm_count; x++) {
-		printf("%-24.24s %-36.36s %-5.5d %-5.5d\n",
+		dbg_printf(1, "%-21.21s %-36.36s %-5.5d %-5.5d\n",
 		       vl->vm_states[x].v_name,
 		       vl->vm_states[x].v_uuid,
 		       vl->vm_states[x].v_state.s_owner,
fence/agents/xvm/xml.c +4 -1
index b3f8e53..7977dfa 100644
@@ -15,6 +15,9 @@
 #include "debug.h"
 #endif
 
+LOGSYS_DECLARE_SUBSYS("XVM", LOG_LEVEL_NOTICE);
+
+
 xmlNodePtr
 get_os_node(xmlDocPtr doc)
 {
@@ -109,7 +112,7 @@ cleanup_xml_doc(xmlDocPtr doc)
 
 	/* Node is still pointing to the <os> block */
 	if (type == 2) {
-		dbg_printf(3, "Unlinkiking %s block\n", (char *)os_node->name);
+		dbg_printf(3, "Unlinking %s block\n", (char *)os_node->name);
 		xmlUnlinkNode(os_node);
 		xmlFreeNode(os_node);
 	}

hooks/post-receive
--
Cluster Project