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".
The branch, master has been updated
via 8170e8d76373ffa1d7e2beaffd5b86a120a14de6 (commit)
from 0083f20653ffa93bbbfc107d4a4f5d56bfae0252 (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.
${TARGET}: ${OBJS}
$(CC) -o $@ $^ $(LDFLAGS)
diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c
index 2d193ea..72c262e 100644
--- a/fence/fence_tool/fence_tool.c
+++ b/fence/fence_tool/fence_tool.c
@@ -2,7 +2,7 @@
************************************************** *****************************
**
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
-** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
@@ -32,25 +32,15 @@
#include "copyright.cf"
#include "libcman.h"
#include "libgroup.h"
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
+#include "libfenced.h"
-/* needs to match the same in cluster/group/daemon/gd_internal.h and
- cluster/group/gfs_controld/lock_dlm.h and cluster/fence/fenced/fd.h */
-#define DUMP_SIZE (1024 * 1024)
-
#define die(fmt, args...)
do
{
@@ -62,8 +52,8 @@ while (0)
char *prog_name;
int operation;
-int child_wait = FALSE;
-int quorum_wait = TRUE;
+int child_wait = 0;
+int quorum_wait = 1;
int fenced_start_timeout = 300; /* five minutes */
int signalled = 0;
cman_handle_t ch;
@@ -87,6 +77,7 @@ static int do_write(int fd, void *buf, size_t count)
return 0;
}
+#if 0
static int do_read(int fd, void *buf, size_t count)
{
int rv, off = 0;
@@ -103,6 +94,7 @@ static int do_read(int fd, void *buf, size_t count)
}
return 0;
}
+#endif
/* Max name length for a group, pointless since we only ever create the
@@ -239,6 +239,10 @@ void send_victim_done(struct fd *fd, int victim, int how);
void process_fd_changes(void);
int fd_join(struct fd *fd);
int fd_leave(struct fd *fd);
+int set_node_info(struct fd *fd, int nodeid, struct fenced_node *node);
+int set_domain_info(struct fd *fd, struct fenced_domain *domain);
+int set_domain_members(struct fd *fd, int *member_count,
+ struct fenced_node **members);
/* group.c */
@@ -246,6 +250,10 @@ void process_groupd(int ci);
int setup_groupd(void);
int fd_join_group(struct fd *fd);
int fd_leave_group(struct fd *fd);
+int set_node_info_group(struct fd *fd, int nodeid, struct fenced_node *node);
+int set_domain_info_group(struct fd *fd, struct fenced_domain *domain);
+int set_domain_members_group(struct fd *fd, int *member_count,
+ struct fenced_node **members);
-#define FENCED_SOCK_PATH "fenced_socket"
-#define FENCED_MSGLEN 256
+/* This defines the interface between fenced and libfenced, and should
+ only be used by libfenced. */
+
+/* should match the same in fd.h */
+#define MAX_NODENAME_LEN 255
+
+#define FENCED_SOCK_PATH "fenced_socket"
+
+#define FENCED_MAGIC 0x0FE11CED
+#define FENCED_VERSION 0x00010001
+
+#define FENCED_CMD_JOIN 1
+#define FENCED_CMD_LEAVE 2
+#define FENCED_CMD_DUMP_DEBUG 3
+#define FENCED_CMD_EXTERNAL 4
+#define FENCED_CMD_NODE_INFO 5
+#define FENCED_CMD_DOMAIN_INFO 6
+#define FENCED_CMD_DOMAIN_MEMBERS 7
+
+struct fenced_header {
+ unsigned int magic;
+ unsigned int version;
+ unsigned int command;
+ unsigned int pad;
+ unsigned int len;
+ int data; /* embedded command-specific data, for convenience */
+};
-static void do_dump(int fd)
-{
- int len;
-
- if (dump_wrap) {
- len = DUMP_SIZE - dump_point;
- do_write(fd, dump_buf + dump_point, len);
- len = dump_point;
- } else
- len = dump_point;
-
- /* NUL terminate the debug string */
- dump_buf[dump_point] = ' ';
-
- do_write(fd, dump_buf, len);
-}
-
static void client_alloc(void)
{
int i;
@@ -261,65 +244,205 @@ static int do_leave(char *name)
return rv;
}
-#define MAXARGS 8
+static int do_external(char *name, int ci)
+{
+ struct fd *fd;
+ int nodeid = 0;
+
+ fd = find_fd(name);
+ if (!fd)
+ return -EINVAL;
+
+ if (group_mode == GROUP_LIBGROUP)
+ return -EINVAL;
+
+ /* FIXME: do_read(client[ci].fd, buf, MAX_NODENAME_LEN);
+ which gets the nodename, then translate the nodename to nodeid */
+
+ send_external(fd, nodeid);
+ return 0;
+}
+
+/* combines a header and the data and sends it back to the client in
+ a single do_write() call */
-static void make_args(char *buf, int *argc, char **argv, char sep)
+static void do_reply(int ci, int cmd, int result, char *buf, int len)
{
- char *p = buf;
- int i;
+ struct fenced_header *rh;
+ char *reply;
+ int reply_len;
+
+ reply_len = sizeof(struct fenced_header) + len;
+ reply = malloc(reply_len);
+ if (!reply)
+ return;
+ memset(reply, 0, reply_len);
- /* exit: cause fenced loop to exit */
+ switch (h.command) {
+ case FENCED_CMD_JOIN:
+ do_join("default");
+ break;
+ case FENCED_CMD_LEAVE:
+ do_leave("default");
+ break;
+ case FENCED_CMD_EXTERNAL:
+ do_external("default", ci);
+ break;
+ case FENCED_CMD_DUMP_DEBUG:
+ do_dump(ci);
+ break;
+ case FENCED_CMD_NODE_INFO:
+ do_node_info(ci, h.data);
+ break;
+ case FENCED_CMD_DOMAIN_INFO:
+ do_domain_info(ci);
+ break;
+ case FENCED_CMD_DOMAIN_MEMBERS:
+ do_domain_members(ci, h.data);
+ break;
+ default:
+ log_error("process_connection %d unknown command %d",
+ ci, h.command);
+ }
+ out:
+ client_dead(ci);
}
static void process_listener(int ci)
@@ -672,44 +795,3 @@ int dump_wrap;
int group_mode;
struct commandline comline;
-#if 0
- libfenced
-
- struct fenced_node:
- nodeid, name,
- given node is pending victim?,
- last time given node was successfully fenced, how, and by whom,
- last failed fence time (only master will know),
- last domain join time, last domain leave time
-
- struct fenced_domain
- name,
- current number of members,
- master nodeid
- current number of victims,
- current pending victim,
- state
-
- /* tell fenced that an external program has fenced a node, e.g. fence_node;
- fenced will try to suppress its own fencing of this node a second time */
- fenced_external(int nodeid);
-
- /* fenced gives info about a single node */
- fenced_node_info(int nodeid, char *name, struct fenced_node *info);
-
- /* fenced gives info about the domain */
- fenced_domain_info(struct fenced_domain *info);
-
- /* fenced copies a node struct for each member */
- fenced_domain_members(int num, struct fenced_node **info);
-
- fenced_debug_dump(char **buf, int len);
- fenced_join(void);
- fenced_leave(void);
-
- for all of these, libfenced connects to fenced, writes a structure that
- defines the type, then for some, reads back data, copies data into
- buffers provided by caller, disconnects from fenced
-
-#endif
-
diff --git a/fence/lib/Makefile b/fence/libfenced/Makefile
similarity index 92%
copy from fence/lib/Makefile
copy to fence/libfenced/Makefile
index 94a5064..0d500f5 100644
--- a/fence/lib/Makefile
+++ b/fence/libfenced/Makefile
@@ -10,7 +10,7 @@
################################################## #############################
################################################## #############################
-TARGET= libfence
+TARGET= libfenced
LIBDIRT=$(TARGET).a
$(TARGET).so.$(SOMAJOR).$(SOMINOR)
@@ -32,13 +32,10 @@ include $(OBJDIR)/make/clean.mk
include $(OBJDIR)/make/install.mk
include $(OBJDIR)/make/uninstall.mk