[Debian-ha-commits] [cluster-glue] 08/73: Imported Upstream version 1.0.5

Richard Winters devrik-guest at moszumanska.debian.org
Sat Apr 18 20:24:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

devrik-guest pushed a commit to branch master
in repository cluster-glue.

commit e0526c99bc07fef07f412242a5e822e8a77efc32
Author: Richard B Winters <rik at mmogp.com>
Date:   Sat Apr 18 07:44:58 2015 -0400

    Imported Upstream version 1.0.5
---
 .hg_archival.txt                            |   2 +-
 .hgtags                                     |   2 +
 ChangeLog                                   |  31 +++
 cluster-glue-fedora.spec                    |   2 +-
 cluster-glue-suse.spec                      |   4 +-
 configure.ac                                |   3 +-
 doc/stonith/README.ippower9258              |  68 ++++++
 hb_report/hb_report.in                      |   6 +-
 include/clplumbing/ipc.h                    |   2 -
 lib/clplumbing/cl_msg_types.c               |   2 +
 lib/clplumbing/ipcsocket.c                  |  70 ++----
 lib/plugins/stonith/external/Makefile.am    |   2 +-
 lib/plugins/stonith/external/ippower9258.in | 316 ++++++++++++++++++++++++++++
 lib/plugins/stonith/external/sbd            |  14 +-
 lib/stonith/sbd.c                           |   2 +-
 lrm/lrmd/lrmd.c                             |   2 +-
 16 files changed, 458 insertions(+), 70 deletions(-)

diff --git a/.hg_archival.txt b/.hg_archival.txt
index f3eb368..e530f24 100644
--- a/.hg_archival.txt
+++ b/.hg_archival.txt
@@ -1,2 +1,2 @@
 repo: e3ffdd7ae81c596b2be7e1e110d2c1255161340e
-node: 6c8645d6a4c2d6452aa7cd29eca05c7d5dfd8ca8
+node: 3af80b93d9e5d5e441f3f4c3aad16775ea27d2d9
diff --git a/.hgtags b/.hgtags
index 2d7e703..5179d8c 100644
--- a/.hgtags
+++ b/.hgtags
@@ -53,3 +53,5 @@ f6c2cd2593f365f984ce051db61466738ac05dcd Beta-0.4.9f
 0000000000000000000000000000000000000000 glue-1.0.3
 0000000000000000000000000000000000000000 glue-1.0.3
 2e33ecd820b2673755d1280a259489a026921f63 glue-1.0.3
+761edff8c35ea2cdf3e1bd37d600b06233e61d4f glue-1.0.4-rc1
+3229873980e1028bf05de81f5bafccb3a92b9aa4 glue-1.0.4
diff --git a/ChangeLog b/ChangeLog
index a27d2ae..2d22512 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+* Mon Apr 15 2010 Dejan Muhamedagic <dejan at suse.de>
+- stable release 1.0.5
+- clplumbing: revert changeset 81ad41d14f72 which breaks the ABI
+* Mon Apr 12 2010 Dejan Muhamedagic <dejan at suse.de>
+- stable release 1.0.4
+- clplumbing: fix memory leak in cl_msg/lrmd (lf#1841,2389)
+- clplumbing: Add identity info of the user on the other side of socket
+- clplumbing: Fix erroneous "Stack hogger failed 0xffffffff" warnings
+- lrmd: fix possible null pointer dereference
+- lrmd: raise severity from debug to info for some log messages
+- lrmd: on shutdown exit once all operations finished (lf#2340)
+- lrmd: don't add the cancel option in flush to the running operations (bnc#578644)
+- lrmd: check if tables exist before free_str_table and prevent 
+  segfault (bnc#587887)
+- stonith: new external/ippower9258 plugin
+- stonith: external/sbd: fix status operation
+- stonith: external/sbd: add support for heartbeat
+- stonith: external/ibmrsa-telnet: fix ha_log.sh invocation
+- stonith: external/ibmrsa-telnet: fix expect regex
+- stonith: external/ipmi: make reset work when the node is off
+- stonith: external/riloe: log error message on unrecognized power method
+- hb_report: don't create dot files if there are more than 20 PE files
+- hb_report: make dot and png files for PE inputs (if there are
+  not too many)
+- hb_report: do not filter CIB/PE files by default (use -s to
+  force filtering)
+- hb_report: add -Z option to force destination directory cleanup
+- hb_report: allow for default destination
+- hb_report: when creating cts reports get information from the log
+- hb_report: new option -d to keep the directory
+- hb_report: don't give up early when creating backtraces (lf#2350)
 * Tue Feb 02 2010 Dejan Muhamedagic <dejan at suse.de>
 - bugfix release 1.0.3
 - lrmd: don't flush operations which don't belong to the requesting client (lf#2161)
diff --git a/cluster-glue-fedora.spec b/cluster-glue-fedora.spec
index 06f3143..bdc4f3b 100644
--- a/cluster-glue-fedora.spec
+++ b/cluster-glue-fedora.spec
@@ -15,7 +15,7 @@
 
 Name:		cluster-glue
 Summary:	Reusable cluster components
-Version:	1.0.3
+Version:	1.0.5
 Release:	1%{?dist}
 License:	GPLv2+ and LGPLv2+
 Url:		http://www.linux-ha.org/wiki/Cluster_Glue
diff --git a/cluster-glue-suse.spec b/cluster-glue-suse.spec
index 2193908..f6cec14 100644
--- a/cluster-glue-suse.spec
+++ b/cluster-glue-suse.spec
@@ -29,8 +29,8 @@
 
 Name:           cluster-glue
 Summary:        Reusable cluster components
-Version:        1.0.3
-Release:	1%{?dist}
+Version:        1.0.5
+Release:        1%{?dist}
 License:        GPL v2 or later; LGPL v2.1 or later
 Url:            http://www.linux-ha.org/wiki/Cluster_Glue
 Group:		Productivity/Clustering/HA
diff --git a/configure.ac b/configure.ac
index 3701971..765f9d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ dnl     checks for compiler characteristics
 dnl     checks for library functions
 dnl     checks for system services
 
-AC_INIT(cluster-glue, 1.0.3, linux-ha-dev at lists.linux-ha.org)
+AC_INIT(cluster-glue, 1.0.5, linux-ha-dev at lists.linux-ha.org)
 
 PKG_FEATURES=""
 HB_PKG=heartbeat
@@ -1298,6 +1298,7 @@ lib/Makefile							\
             lib/plugins/stonith/external/drac5			\
             lib/plugins/stonith/external/kdumpcheck		\
             lib/plugins/stonith/external/ssh			\
+            lib/plugins/stonith/external/ippower9258	\
             lib/plugins/stonith/external/xen0-ha		\
 lrm/Makefile					        	\
    lrm/lrmd/Makefile				        	\
diff --git a/doc/stonith/README.ippower9258 b/doc/stonith/README.ippower9258
new file mode 100644
index 0000000..6873efd
--- /dev/null
+++ b/doc/stonith/README.ippower9258
@@ -0,0 +1,68 @@
+IP Power 9258 as external stonith device.
+=========================================
+
+Device Information
+==================
+
+	Warning:
+	========
+
+	Aviosys provides different types and versions of IP Power 9258.
+	The device is currently available with four or eight power outlets. 
+	This script was tested with firmware version: V1.55 2009/12/22
+
+	Especially "IP Power 9258 HP" uses a different http command interface.
+	======================================================================
+
+	Resources for device documentation: 
+
+	Manufacturer URL: http://www.aviosys.com/ippower9258.htm
+	Manual URL: http://www.aviosys.com/manual.htm
+	Manual current version URL:
+	http://www.aviosys.com/images/9258_manual_20081104.pdf
+
+The documentation of the http command interface defines three
+supported commands:
+
+	GetPower - useful for testing status of the device and of each port
+	SetPower - used to control status of each power outlet
+	SetSchedule+Power - useless for stonith
+
+Common documented structure of these three commands is
+
+	http://username:password@a.b.c.d/Set.cmd?CMD=command[+param=value...]
+	param is one or more of P60 to P67 and value is 0 or 1
+	expected response for GetPower is of the format
+	<html>P60=1,P61=0,P62=1,P63=1,P64=0,P65=0,P66=0,P67=0</html>
+	SetPower does respond with the same format but restricts the list
+	to the modified ports.
+	P60 to P67 represent the status of the power outlet 1 to 8: 0 <=>
+	power off; 1 <=> power on.
+
+IP Power 9258 allows to assign port names (pw1Name to pw8Name) to each
+port.  These names can be used with the web interface (web form with
+post-method).
+
+Script specific notes
+=====================
+
+There is no documented http command to retrieve port names via the
+http command interface.  We try to get the hostlist via the web
+interface.
+
+This script assumes a one to one mapping between names of hostlist and
+port attributes of power outlet:
+
+	1st hostname in hostlist connected to 1st power outlet with port
+	status P60 and port name pw1Name.
+	...
+	8th hostname in hostlist connected to 8th power outlet with port
+	status P67 and port name pw8Name.
+
+If the hostlist parameter is not defined, then all assigned outlets
+are inserted into the hostlist. Unused outlets should have empty
+names. The node names obviously have to match the corresponding outlet
+names. A reserved hostname is "*not-defined*".  This is a
+sript-internal placeholder for unused outlets.  It does not appear in
+the hostlist.
+
diff --git a/hb_report/hb_report.in b/hb_report/hb_report.in
index f1d851a..6c7237b 100755
--- a/hb_report/hb_report.in
+++ b/hb_report/hb_report.in
@@ -46,12 +46,12 @@ LOG_PATTERNS="CRIT: ERROR:"
 #	title	extended_regexp
 # NB: don't use spaces in titles or regular expressions!
 EVENT_PATTERNS="
-membership	pcmk_peer_update.*(lost|memb):
-quorum		crmd.*ais.disp.*quorum.(lost|ac?quir)
+membership	crmd.*ccm_event.*(NEW|LOST)|pcmk_peer_update.*(lost|memb):
+quorum		crmd.*crm_update_quorum:.Updating.quorum.status|crmd.*ais.disp.*quorum.(lost|ac?quir)
 pause		Process.pause.detected
 resources	lrmd.*rsc:(start|stop)
 stonith		crmd.*te_fence_node.*Exec|stonith-ng.*log_oper.*reboot|stonithd.*(requests|(Succeeded|Failed).to.STONITH|result=)
-start_stop	corosync.*Initializing transport..UDP|Executive.Service.RELEASE|crm_shutdown:.Requesting.shutdown|pcmk_shutdown:.Shutdown.complete
+start_stop	Configuration.validated..Starting.heartbeat|Corosync.Cluster.Engine|Executive.Service.RELEASE|crm_shutdown:.Requesting.shutdown|pcmk_shutdown:.Shutdown.complete
 "
 
 #
diff --git a/include/clplumbing/ipc.h b/include/clplumbing/ipc.h
index fca1d7c..bd60bca 100644
--- a/include/clplumbing/ipc.h
+++ b/include/clplumbing/ipc.h
@@ -132,8 +132,6 @@ struct IPC_CHANNEL{
 	int		ch_status;	/* identify the status of channel.*/
 	int		refcount;	/* reference count */
 	pid_t		farside_pid;	/* far side pid */
-	uid_t		farside_uid;	/* far side uid */
-	gid_t		farside_gid;	/* far side gid */
 	void*		ch_private;	/* channel private data. */
 					/* (may contain conn. info.) */
 	IPC_Ops*	ops;		/* IPC_Channel function table.*/
diff --git a/lib/clplumbing/cl_msg_types.c b/lib/clplumbing/cl_msg_types.c
index 6ff7227..9ac8ca5 100644
--- a/lib/clplumbing/cl_msg_types.c
+++ b/lib/clplumbing/cl_msg_types.c
@@ -1027,6 +1027,8 @@ add_list_field(struct ha_msg* msg, char* name, size_t namelen,
 		msg->vlens[j] =  string_list_pack_length(list);
 		g_list_free((GList*)value); /*we don't free each element
 					      because they are used in new list*/
+		free(name); /* this name is no longer necessary
+			       because msg->names[j] is reused */
 		
 	} else { 
 		cl_log(LOG_ERR, "field already exists "
diff --git a/lib/clplumbing/ipcsocket.c b/lib/clplumbing/ipcsocket.c
index 58794b0..5f81b6c 100644
--- a/lib/clplumbing/ipcsocket.c
+++ b/lib/clplumbing/ipcsocket.c
@@ -2204,8 +2204,6 @@ channel_new(int sockfd, int conntype, const char *path_name) {
   temp_ch->low_flow_mark = -1;
   temp_ch->conntype = conntype;
   temp_ch->refcount = 0;
-  temp_ch->farside_uid = -1;
-  temp_ch->farside_gid = -1;
 
   return temp_ch;
   
@@ -2343,20 +2341,14 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 	}
 	if (auth_info == NULL
 	||	(auth_info->uid == NULL && auth_info->gid == NULL)) {
-		ret = IPC_OK;    /* no restriction for authentication */
+		return IPC_OK;    /* no restriction for authentication */
 	  }
 
 	/* Get the credential information for our peer */
 	conn_info = (struct SOCKET_CH_PRIVATE *) ch->ch_private;
 	if (getsockopt(conn_info->s, SOL_SOCKET, SO_PEERCRED, &cred, &n) != 0
 	||	(size_t)n != sizeof(cred)) {
-		return ret;
-	}
-
-	ch->farside_uid = cred.uid;
-	ch->farside_gid = cred.gid;
-	if (ret == IPC_OK) {
-		return ret;
+		return IPC_FAIL;
 	}
 #if 0
 	cl_log(LOG_DEBUG, "SO_PEERCRED returned [%d, (%ld:%ld)]"
@@ -2427,19 +2419,13 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 
 	if (auth_info == NULL
 	||	(auth_info->uid == NULL && auth_info->gid == NULL)) {
-		ret = IPC_OK;    /* no restriction for authentication */
+		return IPC_OK;    /* no restriction for authentication */
 	}
 	conn_info = (struct SOCKET_CH_PRIVATE *) ch->ch_private;
 
 	if (getpeereid(conn_info->s, &euid, &egid) < 0) {
 		cl_perror("getpeereid() failure");
-		return ret;
-	}
-
-	ch->farside_uid = euid;
-	ch->farside_gid = egid;
-	if (ret == IPC_OK) {
-		return ret;
+		return IPC_FAIL;
 	}
 
 	/* Check credentials against authorization information */
@@ -2538,7 +2524,7 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 #endif
 
   struct SOCKET_CH_PRIVATE *conn_info;
-  int ret = IPC_FAIL;
+  int ret = IPC_OK;
   char         buf;
   
   /* Compute size without padding */
@@ -2557,7 +2543,7 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 
   if (auth_info == NULL
   ||	(auth_info->uid == NULL && auth_info->gid == NULL)) {
-    ret = IPC_OK;    /* no restriction for authentication */
+    return IPC_OK;    /* no restriction for authentication */
   }
   conn_info = (struct SOCKET_CH_PRIVATE *) ch->ch_private;
 
@@ -2580,19 +2566,12 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
       || cmsg->cmsg_len < CMSGSIZE
       || cmsg->cmsg_type != SCM_CREDS) {
       cl_perror("can't get credential information from peer");
-      return ret;
+      return IPC_FAIL;
     }
 
   /* Avoid alignment issues - just copy it! */
   memcpy(&cred, CMSG_DATA(cmsg), sizeof(cred));
 
-  ch->farside_uid = cred.crEuid;
-  ch->farside_gid = cred.crEgid;
-  if (ret == IPC_OK) {
-      return ret;
-  }
-
-  ret = IPC_OK;
 
   if (	auth_info->uid
   &&	g_hash_table_lookup(auth_info->uid, &(cred.crEuid)) == NULL) {
@@ -2639,7 +2618,7 @@ static int
 socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 {
 	int len = 0;
-	int ret = IPC_FAIL;
+	int ret = IPC_OK;
 	struct stat stat_buf;
 	struct sockaddr_un *peer_addr = NULL;
 	struct SOCKET_CH_PRIVATE *ch_private = NULL;	
@@ -2657,36 +2636,26 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 		
 	} else if (auth_info == NULL
 	    ||	(auth_info->uid == NULL && auth_info->gid == NULL)) {
-		ret = IPC_OK;    /* no restriction for authentication */
+		return IPC_OK;    /* no restriction for authentication */
 
-	}
-
-	if(ch_private == NULL) {
+	} else if(ch_private == NULL) {
 		cl_log(LOG_ERR, "No channel private data available");
-		return ret;
+		return IPC_FAIL;
 		
 	} else if(peer_addr == NULL) {	
 		cl_log(LOG_ERR, "No peer information available");
-		return ret;
+		return IPC_FAIL;
 	}
 	
 	len = SUN_LEN(peer_addr);
 
 	if(len < 1) {
 		cl_log(LOG_ERR, "No peer information available");
-		return ret;
+		return IPC_FAIL;
 	}
 	peer_addr->sun_path[len] = 0;
 	stat(peer_addr->sun_path, &stat_buf);
 
-	ch->farside_uid = stat_buf.st_uid;
-	ch->farside_gid = stat_buf.st_gid;
-	if (ret == IPC_OK) {
-		return ret;
-	}
-
-	ret = IPC_OK;
-
 	if ((auth_info->uid == NULL || g_hash_table_size(auth_info->uid) == 0)
 	    && auth_info->gid != NULL
 	    && g_hash_table_size(auth_info->gid) != 0) {
@@ -2735,9 +2704,6 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 
 	conn_info = (struct SOCKET_CH_PRIVATE *) ch->ch_private;
 
-	ch->farside_uid = conn_info->farside_uid;
-	ch->farside_gid = conn_info->farside_gid;
-
 	if (auth_info == NULL
 	  || (auth_info->uid == NULL && auth_info->gid == NULL)) {
 		return IPC_OK;	/* no restriction for authentication */
@@ -2785,18 +2751,12 @@ socket_verify_auth(struct IPC_CHANNEL* ch, struct IPC_AUTH * auth_info)
 
 	if (auth_info == NULL
 	  || (auth_info->uid == NULL && auth_info->gid == NULL)) {
-		rc = IPC_OK;	/* no restriction for authentication */
+		return IPC_OK;	/* no restriction for authentication */
 	}
 
 	if (getpeerucred(conn_info->s, &ucred) < 0) {
 		cl_perror("getpeereid() failure");
-		return rc;
-	}
-
-	ch->farside_uid = ucred_geteuid(ucred);
-	ch->farside_gid = ucred_getegid(ucred);
-	if (rc == IPC_OK) {
-		return rc;
+		return IPC_FAIL;
 	}
 
 	/* Check credentials against authorization information */
diff --git a/lib/plugins/stonith/external/Makefile.am b/lib/plugins/stonith/external/Makefile.am
index 969263d..363a860 100644
--- a/lib/plugins/stonith/external/Makefile.am
+++ b/lib/plugins/stonith/external/Makefile.am
@@ -27,6 +27,6 @@ extdir		     = $(stonith_ext_plugindir)
 helperdir	     = $(stonith_plugindir)
 
 ext_SCRIPTS	     = drac5 dracmc-telnet ibmrsa ibmrsa-telnet ipmi riloe ssh vmware rackpdu xen0 hmchttp \
-			xen0-ha sbd kdumpcheck
+			xen0-ha sbd kdumpcheck ippower9258
 
 helper_SCRIPTS	     = xen0-ha-dom0-stonith-helper
diff --git a/lib/plugins/stonith/external/ippower9258.in b/lib/plugins/stonith/external/ippower9258.in
new file mode 100755
index 0000000..6ae7e02
--- /dev/null
+++ b/lib/plugins/stonith/external/ippower9258.in
@@ -0,0 +1,316 @@
+#!/bin/sh
+#
+# External STONITH module using IP Power 9258 or compatible devices.
+#
+# Copyright (c) 2010 Helmut Weymann (Helmut (at) h-weymann (dot) de)
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Further, this software is distributed without any warranty that it is
+# free of the rightful claim of any third person regarding infringement
+# or the like. Any license provided herein, whether implied or
+# otherwise, applies only to this software file. Patent licenses, if
+# any, provided herein do not apply to combinations of this program with
+# other software, or any other product whatsoever.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+#
+
+#
+# Basic commands & parameters independent from individual device 
+
+DEVICE="IP Power 9258"
+IPPowerOn="1"
+IPPowerOff="0"
+IPGetPower="Set.cmd?CMD=GetPower"
+IPSetPower="Set.cmd?CMD=SetPower"
+IPPort_name="P"
+IPPort0=60
+HTTP_COMMAND="wget -q -O - --"
+LOG_ERROR="ha_log.sh err"
+LOG_WARNING="ha_log.sh warn"
+LOG_INFO="ha_log.sh info"
+LOG_DEBUG="ha_log.sh debug"
+MY_COOKIES="cookies.txt"
+MY_TEMPFILE="temp.htm"
+PORT_STATUS="iocontrol.htm"
+UNDEFINED_HOSTNAME="*not-defined*"
+
+#
+# check MY_ROOT_PATH for IP Power 9258 and create it if necessary
+MY_ROOT_PATH="@GLUE_STATE_DIR@/heartbeat/rsctmp/ippower9258"
+
+#
+# script functions
+#
+
+get_challenge() {
+	#
+	# device sends a challenge for md5 encryption of username, password and challenge
+	send_web_command - "http://$deviceip/" | grep Challenge | grep input | cut -d '"' -f 6
+}
+
+get_cookie_from_device(){
+	# the form on the login page has these fields:
+	# Username, Password, Challenge, Response, ScreenWidth
+	#
+    challenge=`get_challenge`
+	response=`echo -n "$username$password$challenge" | md5sum | cut -b -32`
+	postdata="Username=$username&Password=&Challenge=&Response=$response&ScreenWidth=1024"
+	send_web_command " $MY_PATH/$MY_TEMPFILE --post-data=$postdata" "http://$deviceip/tgi/login.tgi"
+	if grep -qs "Invalid User name or Password" $MY_PATH/$MY_TEMPFILE
+	then
+		$LOG_ERROR "Login to device $deviceip failed."
+		$LOG_ERROR "Received Challenge = <<<$challenge>>>."
+		$LOG_ERROR "Sent postdata = <<<$postdata>>>."
+		exit 1
+	fi
+}
+
+get_data_from_device() {
+	# If successful all device info is available in MY_PATH
+	rm -f "$MY_PATH/$PORT_STATUS"
+	send_web_command "$MY_PATH/$PORT_STATUS" "http://$deviceip/$PORT_STATUS"
+	if grep -qs "Cookie Time Out" $MY_PATH/$PORT_STATUS
+	then
+		$LOG_ERROR "received no port data from $deviceip (Cookie Time Out)"
+		exit 1
+	fi
+}
+
+send_http_request() {
+	# ececution of http commands supported by the device
+	$HTTP_COMMAND "http://$username:$password@$deviceip/$1"
+}
+
+send_web_command(){
+	# ececution of web commands through the web-interface
+	WEB_COMMAND="wget -q --keep-session-cookies"
+	WEB_COMMAND="$WEB_COMMAND --load-cookies $MY_PATH/$MY_COOKIES"
+	WEB_COMMAND="$WEB_COMMAND --save-cookies $MY_PATH/$MY_COOKIES"
+	$WEB_COMMAND -O $1 -- $2
+}
+
+name2port() {
+	local name=$1
+	local i=$IPPort0
+	for h in $device_hostlist ; do
+		if [ $h = $name ]; then
+			echo $IPPort_name$i
+			return
+		fi
+		i=`expr $i + 1`
+	done
+	echo "invalid"
+}
+
+set_port() {
+	#
+	# port status is always set. Even if requested status is current status.
+	# host status is not considered.
+	local host=$1
+	local requested_status=$2 # 0 or 1
+	local port=`name2port $host`
+	if [ "$port" = "invalid" ]
+	then
+		$LOG_ERROR "Host $host is not in hostlist ($hostlist) for $deviceip."
+		exit 1
+	fi
+	ret=`send_http_request "$IPSetPower+$port=$requested_status" | cut -b 11`
+	if [ "$ret" != "$requested_status" ]
+	then
+		$LOG_ERROR "$DEVICE at $deviceip responds with wrong status $ret for host $host at port $port."
+		exit 1
+	fi
+	return 0
+}
+
+build_device_hostlist() {
+	# 
+	# hostnames are available from http://$deviceip/iocontrol.htm"
+	# check for number of ports
+	#
+	device_hostlist=$(
+	w3m -dump $MY_PATH/$PORT_STATUS | grep 'Power[1-8]' |
+	sed 's/[^[]*\[//;s/\].*//;s/ *//' |
+	while read h; do
+		[ -z "$h" ] &&
+			echo $UNDEFINED_HOSTNAME ||
+			echo $h
+	done
+	)
+	if [ x = x"$device_hostlist" ]; then
+		$LOG_ERROR "cannot get hostlist for $deviceip"
+		exit 1
+	fi
+	$LOG_DEBUG "Got new hostlist ($device_hostlist) from $deviceip"
+}
+
+filter_device_hostlist() {
+	# check the given hostlist against the device hostlist
+	local host
+	for host in $device_hostlist; do
+		[ "$host" != "$UNDEFINED_HOSTNAME" ] &&
+			echo $host
+	done
+}
+
+check_hostlist() {
+	# check the given hostlist against the device hostlist
+	local cnt=`echo "$hostlist" | wc -w`
+	local cnt2=0
+	local host
+	for host in $hostlist; do
+		if [ `name2port $host` != "invalid" ]; then
+			cnt2=$((cnt2+1))
+		else
+			$LOG_ERROR "host $host not defined at $deviceip"
+		fi
+	done
+	[ $cnt -ne $cnt2 ] &&
+		exit 1
+}
+
+get_http_status() {
+	pattern="P60=[01],P61=[01],P62=[01],P63=[01],P64=[01],P65=[01],P66=[01],P67=[01]"
+	ret=`send_http_request "$IPGetPower" | grep $pattern`
+	if [ "X$ret" = "X" ]
+	then
+		$LOG_ERROR "$DEVICE at $deviceip returns invalid or no string."
+		exit 1
+	fi
+}
+
+hostlist=`echo $hostlist | tr ',' ' '`
+case $1 in
+gethosts|on|off|reset|status)
+	# need environment from stonithd
+	# and device information from individual device
+	#
+	# default device username is admin
+	# IP Power 9258 does not allow user management.
+	#
+	if [ "X$username" = "X" ]
+	then
+		username="admin"
+	fi
+
+	mkdir -p $MY_ROOT_PATH
+	tmp_path="$deviceip" # ensure a simple unique pathname
+	MY_PATH="$MY_ROOT_PATH/$tmp_path"
+	mkdir -p $MY_PATH
+	get_cookie_from_device
+	get_data_from_device
+	build_device_hostlist
+	if [ "X$hostlist" = "X" ]; then
+		hostlist="`filter_device_hostlist`"
+	else
+		check_hostlist
+	fi
+	;;
+*)
+	# the client is asking for meta-data
+	;;
+esac
+
+target=`echo $2 | sed 's/[.].*//'`
+# the necessary actions for stonithd
+case $1 in
+gethosts)
+	echo $hostlist
+	;;
+on)
+	set_port $target $IPPowerOn
+	;;
+off)
+	set_port $target $IPPowerOff
+	;;
+reset)
+	set_port $target $IPPowerOff
+	sleep 5
+	set_port $target $IPPowerOn
+	;;
+status)
+	# werify http command interface
+	get_http_status
+	;;
+getconfignames)
+	# return all the config names
+	for ipparam in deviceip username password hostlist
+	do
+		echo $ipparam
+	done
+	;;
+getinfo-devid)
+	echo "IP Power 9258"
+	;;
+getinfo-devname)
+	echo "IP Power 9258 power switch"
+	;;
+getinfo-devdescr)
+	echo "Power switch IP Power 9258 with 4 or 8 power outlets."
+	echo "WARNING: It is different from IP Power 9258 HP"
+	;;
+getinfo-devurl)
+	echo "http://www.aviosys.com/manual.htm"
+	;;
+getinfo-xml)
+	cat << IPPOWERXML
+<parameters>
+<parameter name="deviceip" unique="1" required="1">
+<content type="string" />
+<shortdesc lang="en">
+IP address or hostname of the device.
+</shortdesc>
+<longdesc lang="en">
+The IP Address or the hostname of the device.
+</longdesc>
+</parameter>
+
+<parameter name="password" unique="0" required="1">
+<content type="string" />
+<shortdesc lang="en">
+Password
+</shortdesc>
+<longdesc lang="en">
+The password to log in with.
+</longdesc>
+</parameter>
+
+<parameter name="hostlist" unique="0" required="0">
+<content type="string" />
+<shortdesc lang="en">
+Hostlist
+</shortdesc>
+<longdesc lang="en">
+The list of hosts that the device controls.
+If you leave this list empty, we will retrieve the hostnames from the device.
+</longdesc>
+</parameter>
+
+<parameter name="username" unique="0" required="0">
+<content type="string" default="admin"/>
+<shortdesc lang="en">
+Account Name
+</shortdesc>
+<longdesc lang="en">
+The user to log in with.
+</longdesc>
+</parameter>
+
+</parameters>
+IPPOWERXML
+	;;
+*)
+	$LOG_ERROR "Unexpected command $1 for $DEVICE at $deviceip."
+	exit 1;
+	;;
+esac
diff --git a/lib/plugins/stonith/external/sbd b/lib/plugins/stonith/external/sbd
index 2631292..283b5f3 100644
--- a/lib/plugins/stonith/external/sbd
+++ b/lib/plugins/stonith/external/sbd
@@ -9,6 +9,11 @@
 
 # Main code
 
+is_heartbeat() {
+    which cl_status 2>/dev/null &&
+		cl_status hbstatus >/dev/null 2>&1
+}
+
 case $1 in
 gethosts)
     echo `sbd -d $sbd_device list | cut -f2`
@@ -23,8 +28,13 @@ status)
     	ha_log err "sbd could not list nodes from $sbd_device"
     	exit 1
     fi
-    nodes="$(crm_node -l)"
-    if [ -z "$node" ]; then
+    nodes=$(
+    if is_heartbeat; then
+	crm_node -H -p
+    else
+	crm_node -p
+    fi)
+    if [ -z "$nodes" ]; then
         # No active nodes; strange, but maybe not running pacemaker?
 	ha_log warn "no active nodes reported by the CRM"
     	exit 0
diff --git a/lib/stonith/sbd.c b/lib/stonith/sbd.c
index 825f3a9..f8a4956 100644
--- a/lib/stonith/sbd.c
+++ b/lib/stonith/sbd.c
@@ -878,7 +878,7 @@ main(int argc, char** argv)
 	}
 
 	cl_log_set_entity(cmdname);
-	cl_log_enable_stderr(1);
+	cl_log_enable_stderr(0);
 	cl_log_set_facility(LOG_DAEMON);
 	
 	get_uname();
diff --git a/lrm/lrmd/lrmd.c b/lrm/lrmd/lrmd.c
index 077f58e..690933e 100644
--- a/lrm/lrmd/lrmd.c
+++ b/lrm/lrmd/lrmd.c
@@ -3507,7 +3507,7 @@ notify_client(lrmd_op_t* op)
 		/* send the result to client */
 		send_cbk_msg(op->msg, client);
 	} else {
-		lrmd_log(LOG_ERR
+		lrmd_log(LOG_WARNING
 		,	"%s: client for the operation %s does not exist"
 			" and client requested notification."
 		,	__FUNCTION__,	op_info(op));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/cluster-glue.git



More information about the Debian-HA-Commits mailing list