[DRBD-cvs] svn commit by rasto - r2617 - trunk/tools - implemented
reading of DRBD_PEER env variable and check
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Wed Dec 6 12:01:31 CET 2006
Author: rasto
Date: 2006-12-06 12:01:30 +0100 (Wed, 06 Dec 2006)
New Revision: 2617
Added:
trunk/tools/Makefile.am
Modified:
trunk/tools/dopd.c
trunk/tools/dopd.h
trunk/tools/drbd-peer-outdater.c
Log:
implemented reading of DRBD_PEER env variable and check if the peer
exists.
Added: trunk/tools/Makefile.am
===================================================================
--- trunk/tools/Makefile.am 2006-12-05 15:36:12 UTC (rev 2616)
+++ trunk/tools/Makefile.am 2006-12-06 11:01:30 UTC (rev 2617)
@@ -0,0 +1,110 @@
+#
+# heartbeat: Linux-HA heartbeat code
+#
+# Copyright (C) 2001 Michael Moerz
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+MAINTAINERCLEANFILES = Makefile.in ccdv
+
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_builddir)/linux-ha -I$(top_srcdir)/linux-ha \
+ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl
+
+EXTRA_DIST = ccdv.c attrd.h ocf-tester dopd.h
+
+apigid = @HA_APIGID@
+habindir = @bindir@
+halibdir = $(libdir)/@HB_PKG@
+gliblib = @GLIBLIB@
+
+habin_PROGRAMS = cl_status cl_respawn
+sbin_PROGRAMS = attrd_updater drbd-peer-outdater
+halib_SCRIPTS = haresources2cib.py
+halib_PROGRAMS = attrd pingd dopd
+sbin_SCRIPTS = ocf-tester
+
+## SOURCES
+ccdv: $(top_srcdir)/tools/ccdv.c
+ gcc -o ccdv $(top_srcdir)/tools/ccdv.c
+
+cl_status_SOURCES = cl_status.c
+# A little trick. Now ccdv can be auto-built but not auto-cleaned.
+cl_status_DEPENDENCIES = ccdv
+cl_status_LDADD = $(top_builddir)/lib/hbclient/libhbclient.la \
+ $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/pils/libpils.la \
+ $(gliblib) \
+ $(top_builddir)/replace/libreplace.la
+
+cl_respawn_SOURCES = cl_respawn.c
+cl_respawn_LDADD = $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/apphb/libapphb.la \
+ $(top_builddir)/lib/pils/libpils.la \
+ $(gliblib) \
+ $(top_builddir)/replace/libreplace.la
+
+
+attrd_SOURCES = attrd.c
+attrd_CFLAGS = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
+attrd_LDADD = $(CRM_DEBUG_LIBS) \
+ $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/crm/common/libcrmcommon.la \
+ $(top_builddir)/lib/hbclient/libhbclient.la \
+ $(top_builddir)/lib/crm/cib/libcib.la \
+ $(GLIBLIB) \
+ $(LIBRT)
+
+dopd_SOURCES = dopd.c
+dopd_CFLAGS = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
+dopd_LDADD = $(CRM_DEBUG_LIBS) \
+ $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/crm/common/libcrmcommon.la \
+ $(top_builddir)/lib/hbclient/libhbclient.la \
+ $(top_builddir)/lib/crm/cib/libcib.la \
+ $(GLIBLIB) \
+ $(LIBRT)
+
+pingd_SOURCES = pingd.c
+pingd_CFLAGS = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
+pingd_LDADD = $(CRM_DEBUG_LIBS) \
+ $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/crm/common/libcrmcommon.la \
+ $(top_builddir)/lib/hbclient/libhbclient.la \
+ $(GLIBLIB) \
+ $(LIBRT)
+
+attrd_updater_SOURCES = attrd_updater.c
+attrd_updater_CFLAGS = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
+attrd_updater_LDADD = $(CRM_DEBUG_LIBS) \
+ $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/crm/common/libcrmcommon.la \
+ $(GLIBLIB) \
+ $(LIBRT)
+
+drbd_peer_outdater_SOURCES = drbd-peer-outdater.c
+drbd_peer_outdater_CFLAGS = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
+drbd_peer_outdater_LDADD = $(CRM_DEBUG_LIBS) \
+ $(top_builddir)/lib/clplumbing/libplumb.la \
+ $(top_builddir)/lib/crm/common/libcrmcommon.la \
+ $(GLIBLIB) \
+ $(LIBRT)
+
+
+install-data-hook: # install-exec-hook doesn't work (!)
+ -chgrp $(apigid) $(DESTDIR)/$(habindir)/cl_status
+ -chmod g+s,a-w $(DESTDIR)/$(habindir)/cl_status
+
+.PHONY: install-exec-hook
Modified: trunk/tools/dopd.c
===================================================================
--- trunk/tools/dopd.c 2006-12-05 15:36:12 UTC (rev 2616)
+++ trunk/tools/dopd.c 2006-12-06 11:01:30 UTC (rev 2617)
@@ -47,12 +47,10 @@
#include <crm/common/ipc.h>
-const char *node_name; /* The node we are connected to */
-char other_node[SYS_NMLN]; /* The remote node in the pair */
-int node_stable; /* Other node stable? */
-int need_standby; /* Are we waiting for stability? */
-int quitnow = 0; /* Allows a signal to break us out of loop */
-GMainLoop *mainloop; /* Reference to the mainloop for events */
+const char *node_name; /* The node we are connected to */
+int node_stable; /* Other node stable? */
+int quitnow = 0; /* Allows a signal to break us out of loop */
+GMainLoop *mainloop; /* Reference to the mainloop for events */
ll_cluster_t *dopd_cluster_conn;
/* only one client can be connected at a time */
@@ -67,29 +65,28 @@
IPC_Channel *CURR_CLIENT_CHANNEL = NULL;
-/* send_message_to_other_node()
+/* send_message_to_the_peer()
* send message with drbd resource to other node.
*/
static gboolean
-send_message_to_other_node(const char *drbd_resource)
+send_message_to_the_peer(const char *drbd_peer, const char *drbd_resource)
{
- ll_cluster_t *hb = dopd_cluster_conn;
- HA_Message *msg = NULL;
+ HA_Message *msg = NULL;
- crm_info("sending start_outdate message to the other node %s -> %s",
- node_name, other_node);
+ crm_info("sending start_outdate message to the other node %s -> %s",
+ node_name, drbd_peer);
- msg = ha_msg_new(3);
- ha_msg_add(msg, F_TYPE, "start_outdate");
- ha_msg_add(msg, F_ORIG, node_name);
- ha_msg_add(msg, F_DOPD_RES, drbd_resource);
+ msg = ha_msg_new(3);
+ ha_msg_add(msg, F_TYPE, "start_outdate");
+ ha_msg_add(msg, F_ORIG, node_name);
+ ha_msg_add(msg, F_DOPD_RES, drbd_resource);
- crm_debug("sending [start_outdate res: %s] to other node",
- drbd_resource);
- hb->llc_ops->sendnodemsg(hb, msg, other_node);
+ crm_debug("sending [start_outdate res: %s] to node: %s",
+ drbd_resource, drbd_peer);
+ dopd_cluster_conn->llc_ops->sendnodemsg(dopd_cluster_conn, msg, drbd_peer);
ha_msg_del(msg);
- return TRUE;
+ return TRUE;
}
/* msg_start_outdate()
@@ -111,12 +108,12 @@
int command_ret;
char rc_string[4];
- HA_Message *msg2 = NULL;
+ HA_Message *msg2 = NULL;
const char *drbd_resource = ha_msg_value(msg, F_DOPD_RES);
char *command;
/* execute outdate command */
- crm_malloc0(command, strlen(OUTDATE_COMMAND) + 1 + strlen(drbd_resource) + 1);
+ crm_malloc0(command, strlen(OUTDATE_COMMAND) + 1 + strlen(drbd_resource) + 1);
strcpy(command, OUTDATE_COMMAND);
strcat(command, " ");
strcat(command, drbd_resource);
@@ -124,7 +121,6 @@
command_ret = system(command) >> 8;
/* convert return code */
- crm_free(command);
if (command_ret == 0)
rc = 4;
else if (command_ret == 5)
@@ -132,20 +128,23 @@
else if (command_ret == 17)
rc = 6;
else
- crm_info("unknown exit code from "OUTDATE_COMMAND": %i",
- command_ret);
+ crm_info("unknown exit code from %s: %i",
+ command, command_ret);
+ crm_free(command);
- crm_debug("msg_start_outdate: %s, command rc: %i, rc: %i",
+ crm_debug("msg_start_outdate: %s, command rc: %i, rc: %i",
ha_msg_value(msg, F_ORIG), command_ret, rc);
sprintf(rc_string, "%i", rc);
+ crm_info("sending return code: %s, %s -> %s\n",
+ rc_string, node_name, ha_msg_value(msg, F_ORIG));
/* send return code to oder node */
msg2 = ha_msg_new(3);
ha_msg_add(msg2, F_TYPE, "outdate_rc");
ha_msg_add(msg2, F_DOPD_VALUE, rc_string);
ha_msg_add(msg2, F_ORIG, node_name);
- hb->llc_ops->sendnodemsg(hb, msg2, other_node);
+ hb->llc_ops->sendnodemsg(hb, msg2, ha_msg_value(msg, F_ORIG));
ha_msg_del(msg2);
}
@@ -156,7 +155,7 @@
void
msg_outdate_rc(struct ha_msg *msg_in, void *private)
{
- HA_Message *msg_out = NULL;
+ HA_Message *msg_out;
const char *rc_string = ha_msg_value(msg_in, F_DOPD_VALUE);
if (CURR_CLIENT_CHANNEL == NULL)
@@ -173,6 +172,47 @@
CURR_CLIENT_CHANNEL = NULL;
}
+/* check_drbd_peer()
+ * walk the nodes and return TRUE if peer is not this node and it exists.
+ */
+gboolean
+check_drbd_peer(const char *drbd_peer)
+{
+ const char *node;
+ gboolean found = FALSE;
+ if (!strcmp(drbd_peer, node_name)) {
+ crm_warn("drbd peer node %s is me!\n", drbd_peer);
+ return FALSE;
+ }
+
+ crm_debug("Starting node walk");
+ if (dopd_cluster_conn->llc_ops->init_nodewalk(dopd_cluster_conn) != HA_OK) {
+ crm_warn("Cannot start node walk");
+ crm_warn("REASON: %s", dopd_cluster_conn->llc_ops->errmsg(dopd_cluster_conn));
+ return FALSE;
+ }
+ while((node = dopd_cluster_conn->llc_ops->nextnode(dopd_cluster_conn)) != NULL) {
+ crm_debug("Cluster node: %s: status: %s", node,
+ dopd_cluster_conn->llc_ops->node_status(dopd_cluster_conn, node));
+
+ /* Look for the peer */
+ if (!strcmp("normal", dopd_cluster_conn->llc_ops->node_type(dopd_cluster_conn, node))
+ && !strcmp(node, drbd_peer)) {
+ crm_debug("node %s found\n", node);
+ found = TRUE;
+ break;
+ }
+ }
+ if (dopd_cluster_conn->llc_ops->end_nodewalk(dopd_cluster_conn) != HA_OK) {
+ crm_info("Cannot end node walk");
+ crm_info("REASON: %s", dopd_cluster_conn->llc_ops->errmsg(dopd_cluster_conn));
+ }
+
+ if (found == FALSE)
+ crm_warn("drbd peer %s was not found\n", drbd_peer);
+ return found;
+}
+
/* outdater_callback()
* got message from outdater client with drbd resource, it will be sent
* to the other node.
@@ -182,6 +222,8 @@
{
int lpc = 0;
HA_Message *msg = NULL;
+ HA_Message *msg_client = NULL;
+ const char *drbd_peer = NULL;
const char *drbd_resource = NULL;
dopd_client_t *curr_client = (dopd_client_t*)user_data;
gboolean stay_connected = TRUE;
@@ -201,22 +243,34 @@
break;
}
- msg = msgfromIPC_noauth(client);
- if (msg == NULL) {
- crm_debug("%s: no message this time",
+ msg = msgfromIPC_noauth(client);
+ if (msg == NULL) {
+ crm_debug("%s: no message this time",
curr_client->id);
- continue;
+ continue;
}
lpc++;
crm_debug("Processing msg from %s", curr_client->id);
- crm_debug("Got message from (%s). (%s)",
+ crm_debug("Got message from (%s). (peer: %s, res :%s)",
ha_msg_value(msg, F_ORIG),
+ ha_msg_value(msg, F_OUTDATER_PEER),
ha_msg_value(msg, F_OUTDATER_RES));
drbd_resource = ha_msg_value(msg, F_OUTDATER_RES);
- send_message_to_other_node(drbd_resource);
+ drbd_peer = ha_msg_value(msg, F_OUTDATER_PEER);
+ if (check_drbd_peer(drbd_peer))
+ send_message_to_the_peer(drbd_peer, drbd_resource);
+ else {
+ /* wrong peer was specified,
+ send return code 5 to the client */
+ msg_client = ha_msg_new(3);
+ ha_msg_add(msg_client, F_TYPE, "outdate_rc");
+ ha_msg_add(msg_client, F_ORIG, node_name);
+ ha_msg_add(msg_client, F_DOPD_VALUE, "5");
+ msg_outdate_rc(msg_client, NULL);
+ }
crm_msg_del(msg);
msg = NULL;
@@ -232,7 +286,6 @@
return stay_connected;
}
-
/* outdater_ipc_connection_destroy()
* clean client struct
*/
@@ -265,31 +318,31 @@
static gboolean
outdater_client_connect(IPC_Channel *channel, gpointer user_data)
{
- dopd_client_t *new_client = NULL;
- crm_debug("Connecting channel");
- if(channel == NULL) {
- crm_err("Channel was NULL");
- return FALSE;
+ dopd_client_t *new_client = NULL;
+ crm_debug("Connecting channel");
+ if(channel == NULL) {
+ crm_err("Channel was NULL");
+ return FALSE;
- } else if(channel->ch_status != IPC_CONNECT) {
- crm_err("Channel was disconnected");
- return FALSE;
- }
+ } else if(channel->ch_status != IPC_CONNECT) {
+ crm_err("Channel was disconnected");
+ return FALSE;
+ }
- crm_malloc0(new_client, sizeof(dopd_client_t));
- new_client->channel = channel;
- crm_malloc0(new_client->id, 10);
- strcpy(new_client->id, "outdater");
+ crm_malloc0(new_client, sizeof(dopd_client_t));
+ new_client->channel = channel;
+ crm_malloc0(new_client->id, 10);
+ strcpy(new_client->id, "outdater");
- new_client->source = G_main_add_IPC_Channel(
- G_PRIORITY_DEFAULT, channel, FALSE, outdater_callback,
- new_client, outdater_ipc_connection_destroy);
+ new_client->source = G_main_add_IPC_Channel(
+ G_PRIORITY_DEFAULT, channel, FALSE, outdater_callback,
+ new_client, outdater_ipc_connection_destroy);
- crm_debug("Client %s (%p) connected",
+ crm_debug("Client %s (%p) connected",
new_client->id,
new_client->source);
- return TRUE;
+ return TRUE;
}
static void
@@ -304,7 +357,7 @@
const char *resources = hb->llc_ops->get_resources(hb);
if (!resources)
/* Heartbeat is not providing resource management */
- return -1;
+ return -1;
if (!strcmp(resources, "transition"))
return 0;
@@ -312,38 +365,6 @@
return 1;
}
-/* node_walk()
- * get name of other node and set other_node string
- */
-void
-node_walk(ll_cluster_t *hb)
-{
- const char *node;
-
- crm_debug("Starting node walk");
- if (hb->llc_ops->init_nodewalk(hb) != HA_OK) {
- crm_err("Cannot start node walk");
- crm_err("REASON: %s", hb->llc_ops->errmsg(hb));
- exit(9);
- }
- while((node = hb->llc_ops->nextnode(hb)) != NULL) {
- crm_debug("Cluster node: %s: status: %s", node,
- hb->llc_ops->node_status(hb, node));
-
- /* Look for our partner */
- if (!strcmp("normal", hb->llc_ops->node_type(hb, node))
- && strcmp(node, node_name)) {
- strcpy(other_node, node);
- crm_debug("[They are %s]", other_node);
- }
- }
- if (hb->llc_ops->end_nodewalk(hb) != HA_OK) {
- crm_err("Cannot end node walk");
- crm_err("REASON: %s", hb->llc_ops->errmsg(hb));
- exit(12);
- }
-}
-
/* set_callbacks()
* set callbacks for communication between two nodes
*/
@@ -461,7 +482,6 @@
main(int argc, char **argv)
{
unsigned fmask;
- ll_cluster_t *hb;
char pid[10];
char *bname, *parameter;
IPC_Channel *apiIPC;
@@ -471,35 +491,31 @@
bname = ha_strdup(argv[0]);
crm_log_init(bname);
- hb = ll_cluster_new("heartbeat");
- dopd_cluster_conn = hb;
+ dopd_cluster_conn = ll_cluster_new("heartbeat");
- memset(other_node, 0, sizeof(other_node));
- need_standby = 0;
-
memset(pid, 0, sizeof(pid));
snprintf(pid, sizeof(pid), "%ld", (long)getpid());
crm_debug("PID=%s", pid);
- open_api(hb);
+ open_api(dopd_cluster_conn);
- node_stable = is_stable(hb);
+ node_stable = is_stable(dopd_cluster_conn);
if (node_stable == -1) {
crm_err("No managed resources");
exit(100);
}
/* Obtain our local node name */
- node_name = hb->llc_ops->get_mynodeid(hb);
+ node_name = dopd_cluster_conn->llc_ops->get_mynodeid(dopd_cluster_conn);
if (node_name == NULL) {
crm_err("Cannot get my nodeid");
- crm_err("REASON: %s", hb->llc_ops->errmsg(hb));
+ crm_err("REASON: %s", dopd_cluster_conn->llc_ops->errmsg(dopd_cluster_conn));
exit(19);
}
crm_debug("[We are %s]", node_name);
/* See if we should drop cores somewhere odd... */
- parameter = hb->llc_ops->get_parameter(hb, KEY_COREROOTDIR);
+ parameter = dopd_cluster_conn->llc_ops->get_parameter(dopd_cluster_conn, KEY_COREROOTDIR);
if (parameter) {
cl_set_corerootdir(parameter);
cl_cdtocoredir();
@@ -507,36 +523,34 @@
cl_cdtocoredir();
- set_callbacks(hb);
+ set_callbacks(dopd_cluster_conn);
fmask = LLC_FILTER_DEFAULT;
crm_debug("Setting message filter mode");
- if (hb->llc_ops->setfmode(hb, fmask) != HA_OK) {
+ if (dopd_cluster_conn->llc_ops->setfmode(dopd_cluster_conn, fmask) != HA_OK) {
crm_err("Cannot set filter mode");
- crm_err("REASON: %s", hb->llc_ops->errmsg(hb));
+ crm_err("REASON: %s", dopd_cluster_conn->llc_ops->errmsg(dopd_cluster_conn));
exit(8);
}
- node_walk(hb);
+ set_signals(dopd_cluster_conn);
- set_signals(hb);
-
crm_debug("Waiting for messages...");
errno = 0;
mainloop = g_main_new(TRUE);
- apiIPC = hb->llc_ops->ipcchan(hb);
+ apiIPC = dopd_cluster_conn->llc_ops->ipcchan(dopd_cluster_conn);
/* Watch the API IPC for input */
- G_main_add_IPC_Channel(G_PRIORITY_HIGH, apiIPC, FALSE,
- dopd_dispatch, (gpointer)hb,
- dopd_dispatch_destroy);
+ G_main_add_IPC_Channel(G_PRIORITY_HIGH, apiIPC, FALSE,
+ dopd_dispatch, (gpointer)dopd_cluster_conn,
+ dopd_dispatch_destroy);
Gmain_timeout_add_full(G_PRIORITY_DEFAULT, 1000,
- dopd_timeout_dispatch, (gpointer)hb,
- dopd_dispatch_destroy);
+ dopd_timeout_dispatch, (gpointer)dopd_cluster_conn,
+ dopd_dispatch_destroy);
rc = init_server_ipc_comms(
ha_strdup(T_OUTDATER),
outdater_client_connect,
@@ -549,10 +563,10 @@
if (!quitnow && errno != EAGAIN && errno != EINTR) {
crm_err("read_hb_msg returned NULL");
- crm_err("REASON: %s", hb->llc_ops->errmsg(hb));
+ crm_err("REASON: %s", dopd_cluster_conn->llc_ops->errmsg(dopd_cluster_conn));
}
- close_api(hb);
+ close_api(dopd_cluster_conn);
return 0;
}
Modified: trunk/tools/dopd.h
===================================================================
--- trunk/tools/dopd.h 2006-12-05 15:36:12 UTC (rev 2616)
+++ trunk/tools/dopd.h 2006-12-06 11:01:30 UTC (rev 2617)
@@ -21,6 +21,7 @@
#define T_OUTDATER "outdater"
+#define F_OUTDATER_PEER "outdater_peer"
#define F_OUTDATER_RES "outdater_res"
#define F_DOPD_VALUE "dop_value"
#define F_DOPD_RES "dop_res"
@@ -30,6 +31,7 @@
/* Prototypes */
void node_walk(ll_cluster_t *);
+gboolean check_drbd_peer(const char *);
void set_signals(ll_cluster_t *);
void gotsig(int);
void set_callbacks(ll_cluster_t *);
Modified: trunk/tools/drbd-peer-outdater.c
===================================================================
--- trunk/tools/drbd-peer-outdater.c 2006-12-05 15:36:12 UTC (rev 2616)
+++ trunk/tools/drbd-peer-outdater.c 2006-12-06 11:01:30 UTC (rev 2617)
@@ -36,7 +36,7 @@
#include <clplumbing/Gmain_timeout.h>
#include <dopd.h>
-#define OPTARGS "hVt:r:"
+#define OPTARGS "hVt:p:r:"
#define DEFAULT_TIMEOUT 60 // timeout in seconds
typedef struct dop_client_s
@@ -133,6 +133,7 @@
IPC_Channel *ipc_server = NULL;
int argerr = 0;
int flag;
+ char *drbd_peer = NULL;
char *drbd_resource = NULL;
int timeout = DEFAULT_TIMEOUT;
@@ -150,12 +151,15 @@
case 'h': /* Help message */
usage(crm_system_name, LSB_EXIT_OK);
break;
- case 't':
- timeout = atoi(optarg);
+ case 'p':
+ drbd_peer = crm_strdup(optarg);
break;
case 'r':
drbd_resource = crm_strdup(optarg);
break;
+ case 't':
+ timeout = atoi(optarg);
+ break;
default:
++argerr;
break;
@@ -164,6 +168,12 @@
crm_debug_3("Option processing complete");
+ /* the caller drbdadm sets DRBD_PEER env variable, use it if
+ * -p option was not specified */
+ if ((drbd_peer == NULL) && !(drbd_peer = getenv("DRBD_PEER"))) {
+ ++argerr;
+ }
+
/* the caller drbdadm sets DRBD_RESOURCE env variable, use it if
* -r option was not specified */
if ((drbd_resource == NULL) && !(drbd_resource = getenv("DRBD_RESOURCE"))) {
@@ -178,6 +188,7 @@
usage(crm_system_name, LSB_EXIT_GENERIC);
}
+ crm_debug_2("drbd peer: %s\n", drbd_peer);
crm_debug_2("drbd resource: %s\n", drbd_resource);
crm_malloc0(new_client, sizeof(dop_client_t));
@@ -198,6 +209,7 @@
update = ha_msg_new(3);
ha_msg_add(update, F_TYPE, T_OUTDATER);
ha_msg_add(update, F_ORIG, crm_system_name);
+ ha_msg_add(update, F_OUTDATER_PEER, drbd_peer);
ha_msg_add(update, F_OUTDATER_RES, drbd_resource);
if (send_ipc_message(ipc_server, update) == FALSE) {
@@ -220,14 +232,15 @@
FILE* stream;
stream = exit_status ? stderr : stdout;
- fprintf(stream, "usage: %s -r <string> [-t <int>]\n", cmd);
- fprintf(stream, "\t-t <int>\ttimeout in seconds; default: %d\n",
+ fprintf(stream, "usage: %s -r <string> -p <string> [-t <int>]\n", cmd);
+ fprintf(stream, "\t-p <string>\tdrbd peer\n");
+ fprintf(stream, "\t-r <string>\tdrbd resource\n");
+ fprintf(stream, "\t-t <int>\ttimeout in seconds; default: %d\n\n",
DEFAULT_TIMEOUT);
- fprintf(stream, "\t-r <string>\tdrbd resource\n\n"
- "The drbd resource has to be specified \n"
- "either on the commandline using the -r option,\n"
- "or using the $DRBD_RESOURCE environment variable.\n"
- "$DRBD_RESOURCE will be ignored, if the -r option is used.\n");
+ fprintf(stream, "The drbd peer and drbd resource have to be specified either on the\n"
+ "commandline using the -p and -r options, or using the $DRBD_PEER and\n"
+ "$DRBD_RESOURCE environment variables. $DRBD_RESOURCE and $DRBD_PEER\n"
+ "will be ignored, if the command line options are used.\n");
fflush(stream);
exit(exit_status);
More information about the drbd-cvs
mailing list