[Cluster-devel] cluster/group daemon/main.c tool/main.c
rpeterso at sourceware.org
rpeterso at sourceware.org
Thu Nov 9 15:51:02 UTC 2006
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rpeterso at sourceware.org 2006-11-09 15:51:01
Modified files:
group/daemon : main.c
group/tool : main.c
Log message:
This is the fix for Bugzilla Bug 214625: Add group_tool log function
to group_tool and groupd.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.51&r2=1.51.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21&r2=1.21.2.1
--- cluster/group/daemon/main.c 2006/10/24 17:08:06 1.51
+++ cluster/group/daemon/main.c 2006/11/09 15:51:01 1.51.2.1
@@ -318,6 +318,7 @@
DO_GET_GROUPS,
DO_GET_GROUP,
DO_DUMP,
+ DO_LOG,
};
int get_action(char *buf)
@@ -365,6 +366,9 @@
if (!strncmp(act, "dump", 16))
return DO_DUMP;
+ if (!strncmp(act, "log", 16))
+ return DO_LOG;
+
return -1;
}
@@ -559,6 +563,13 @@
return 0;
}
+static int do_log(int fd, const char *comment)
+{
+
+ log_print("%s", comment);
+ return 0;
+}
+
static void do_send(char *name, int level, int len, char *data)
{
group_t *g;
@@ -653,6 +664,10 @@
do_dump(client[ci].fd);
break;
+ case DO_LOG:
+ do_log(client[ci].fd, &buf[4]);
+ break;
+
default:
log_print("unknown action %d client %d bytes %d", act, ci, rv);
log_print("invalid message: \"%s\"", buf);
--- cluster/group/tool/main.c 2006/10/21 17:15:12 1.21
+++ cluster/group/tool/main.c 2006/11/09 15:51:01 1.21.2.1
@@ -45,6 +45,7 @@
#define OP_LS 1
#define OP_DUMP 2
+#define OP_LOG 3
static char *prog_name;
static int operation;
@@ -72,6 +73,8 @@
printf("dump gfs Show debug log from gfs_controld\n");
printf("dump plocks <name> Show posix locks for gfs with given name\n");
printf("\n");
+ printf("log <comments> Add information to the groupd log.\n");
+ printf("\n");
}
static void decode_arguments(int argc, char **argv)
@@ -126,6 +129,10 @@
operation = OP_LS;
opt_ind = optind + 1;
break;
+ } else if (strcmp(argv[optind], "log") == 0) {
+ operation = OP_LOG;
+ opt_ind = optind + 1;
+ break;
}
optind++;
}
@@ -406,6 +413,21 @@
return 0;
}
+int do_log(char *comment)
+{
+ char buf[GROUPD_MSGLEN];
+ int fd, rv;
+
+ fd = connect_daemon(GROUPD_SOCK_PATH);
+ if (fd < 0)
+ return fd;
+ memset(buf, 0, sizeof(buf));
+ snprintf(buf, sizeof(buf), "log %s", comment);
+ rv = write(fd, &buf, GROUPD_MSGLEN);
+ close(fd);
+ return rv;
+}
+
int main(int argc, char **argv)
{
int fd;
@@ -445,6 +467,11 @@
if (fd < 0)
break;
return do_dump(argc, argv, fd);
+
+ case OP_LOG:
+ if (opt_ind && opt_ind < argc) {
+ return do_log(argv[opt_ind]);
+ }
}
return 0;
More information about the Cluster-devel
mailing list