[Debian-ha-commits] [sbd] 07/16: New upstream version 1.3.0-13-gf37a182

Valentin Vidic vvidic-guest at moszumanska.debian.org
Fri Jun 23 16:49:26 UTC 2017


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

vvidic-guest pushed a commit to branch master
in repository sbd.

commit d4a140f9bdbd5ca1d1803e4a0e80f75b089d87a2
Author: Valentin Vidic <Valentin.Vidic at CARNet.hr>
Date:   Fri Jun 23 15:42:34 2017 +0200

    New upstream version 1.3.0-13-gf37a182
---
 Makefile.am          |  7 +++++--
 configure.ac         |  2 +-
 man/sbd.8.pod        | 45 +++++++++++++++++++++++++--------------------
 sbd.spec             | 11 ++++++++---
 src/Makefile.am      |  2 +-
 src/sbd-cluster.c    |  2 +-
 src/sbd-common.c     |  8 +++++---
 src/sbd-inquisitor.c | 23 ++++++++++++++++++-----
 src/sbd-md.c         |  8 ++++----
 src/sbd.h            |  5 +++--
 src/sbd.sh           |  8 ++++----
 src/sbd.sysconfig    |  9 +++++----
 12 files changed, 80 insertions(+), 50 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index fd3abaf..f0f6d4e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,16 +29,19 @@ export:
 	    echo `date`: Rebuilt $(TARFILE);					\
 	fi
 
-srpm:	export
+#replace commit id in sbd.spce
+spec:
 	rm -f *.src.rpm
 	sed -i 's/global\ commit.*/global\ commit\ $(TAG)/' $(PACKAGE).spec
+
+srpm:	spec export
 	if [ -e $(BUILD_COUNTER) ]; then							\
 		sed -i 's/global\ buildnum.*/global\ buildnum\ $(COUNT)/' $(PACKAGE).spec;	\
 		echo $(COUNT) > $(BUILD_COUNTER);					\
 	fi
 	rpmbuild $(RPM_OPTS) -bs $(PACKAGE).spec
 
-rpm:	export
+rpm:	spec export
 	rpmbuild $(RPM_OPTS) -ba $(PACKAGE).spec
 
 mock:   srpm
diff --git a/configure.ac b/configure.ac
index 048af5a..a7e3e70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ dnl     checks for library functions
 dnl     checks for system services
 
 AC_INIT([sbd], 
-	[1.2.1],
+	[1.3.0],
 	[lmb at suse.com])
 AC_CANONICAL_HOST
 AC_CONFIG_AUX_DIR(.)
diff --git a/man/sbd.8.pod b/man/sbd.8.pod
index fd1efad..b410a27 100644
--- a/man/sbd.8.pod
+++ b/man/sbd.8.pod
@@ -2,7 +2,7 @@
 
 sbd - STONITH Block Device daemon
 
-=head1 SYNPOSIS
+=head1 SYNOPSIS
 
 sbd <-d F</dev/...>> [options] C<command>
 
@@ -16,16 +16,22 @@ dependencies on specific firmware controllers, and it can be used as a
 STONITH mechanism in all configurations that have reliable shared
 storage.
 
+SBD can also be used without any shared storage. In this mode, the
+watchdog device will be used to reset the node if it loses quorum, if
+any monitored daemon is lost and not recovered or if Pacemaker decides
+that the node requires fencing.
+
 The F<sbd> binary implements both the daemon that watches the message
 slots as well as the management tool for interacting with the block
 storage device(s). This mode of operation is specified via the
 C<command> parameter; some of these modes take additional parameters.
 
-To use, you must first C<create> the messaging layout on one to three
-block devices. Second, configure F</etc/sysconfig/sbd> to list those
-devices (and possibly adjust other options), and restart the cluster
-stack on each node to ensure that C<sbd> is started. Third, configure
-the C<external/sbd> fencing resource in the Pacemaker CIB.
+To use SBD with shared storage, you must first C<create> the messaging
+layout on one to three block devices. Second, configure
+F</etc/sysconfig/sbd> to list those devices (and possibly adjust other
+options), and restart the cluster stack on each node to ensure that
+C<sbd> is started. Third, configure the C<external/sbd> fencing
+resource in the Pacemaker CIB.
 
 Each of these steps is documented in more detail below the description
 of the command options.
@@ -134,8 +140,8 @@ This also affects the I<stonith-timeout> in Pacemaker's CIB; see below.
 Example usage:
 
 	# sbd -d /dev/sda1 list
-	0	hex-0	clear	
-	1	hex-7	clear	
+	0	hex-0	clear
+	1	hex-7	clear
 	2	hex-9	clear
 
 List all allocated slots on device, and messages. You should see all
@@ -165,7 +171,7 @@ Dump meta-data header from device.
 
 Example usage:
 
-	sbd -d /dev/sdc2 -d /dev/sdd3 -W -P watch
+	sbd -d /dev/sdc2 -d /dev/sdd3 -P watch
 
 This command will make C<sbd> start in daemon mode. It will constantly monitor
 the message slot of the local node for incoming messages, reachability, and
@@ -249,7 +255,7 @@ servant will be restarted once every B<-t> seconds. If set to a different
 value, the servant will be restarted that many times within the dampening
 period and then delay.
 
-Defaults to I<1>. 
+Defaults to I<1>.
 
 =item B<-t> I<N>
 
@@ -443,7 +449,7 @@ storage (with internal redundancy) anyway; the SBD device does not
 introduce an additional single point of failure then.
 
 If the SBD device is not accessible, the daemon will fail to start and
-inhibit openais startup. 
+inhibit openais startup.
 
 =item Two devices
 
@@ -472,7 +478,7 @@ at least two devices remain accessible.
 This configuration is appropriate for more complex scenarios where
 storage is not confined to a single array. For example, host-based
 mirroring solutions could have one SBD per mirror leg (not mirrored
-itself), and an additional tie-breaker on iSCSI. 
+itself), and an additional tie-breaker on iSCSI.
 
 It will only start if at least two devices are accessible on boot.
 
@@ -546,16 +552,16 @@ configure fencing resource. This should be a primitive, not a clone, as
 follows:
 
 	primitive fencing-sbd stonith:external/sbd \
-		op start start-delay="15"
+		params pcmk_delay_max=30
 
 This will automatically use the same devices as configured in
 F</etc/sysconfig/sbd>.
 
-While you should not configure this as a clone (as Pacemaker will start
-a fencing agent in each partition automatically), the I<start-delay>
-setting ensures, in a scenario where a split-brain scenario did occur in
-a two node cluster, that the one that still needs to instantiate a
-fencing agent is slightly disadvantaged to avoid fencing loops.
+While you should not configure this as a clone (as Pacemaker will register
+the fencing device on each node automatically), the I<pcmk_delay_max>
+setting enables random fencing delay which ensures, in a scenario where a
+split-brain scenario did occur in a two node cluster, that one of the nodes
+has a better chance to survive to avoid double fencing.
 
 SBD also supports turning the reset request into a crash request, which
 may be helpful for debugging if you have kernel crashdumping configured;
@@ -599,7 +605,7 @@ I<inquisitor> process.
 
 =head1 LICENSE
 
-Copyright (C) 2008-2013 Lars Marowsky-Bree 
+Copyright (C) 2008-2013 Lars Marowsky-Bree
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
@@ -614,4 +620,3 @@ General Public License for more details.
 For details see the GNU General Public License at
 http://www.gnu.org/licenses/gpl-2.0.html (version 2) and/or
 http://www.gnu.org/licenses/gpl.html (the newest as per "any later").
-
diff --git a/sbd.spec b/sbd.spec
index 33334b2..e643c53 100644
--- a/sbd.spec
+++ b/sbd.spec
@@ -15,16 +15,16 @@
 
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
-%global commit 872e82f39db02eab3527ecfa392b1a930dd1964b
+%global commit 4ee36fa33b57a1ad95678363911cfb02a92e1edb
 %global shortcommit %(c=%{commit}; echo ${c:0:7})
 %global github_owner beekhof
-%global buildnum 5
+%global buildnum 1
 
 Name:           sbd
 Summary:        Storage-based death
 License:        GPLv2+
 Group:          System Environment/Daemons
-Version:        1.2.1
+Version:        1.3.0
 Release:        0.%{buildnum}.%{shortcommit}.git%{?dist}
 Url:            https://github.com/%{github_owner}/%{name}
 Source0:        https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
@@ -113,6 +113,11 @@ rm -rf %{buildroot}
 %doc COPYING
 
 %changelog
+* Sun Mar 26 2016 <klaus.wenninger at aon.at> - 1.3.0-0.1.4ee36fa3.git
+- Changes since v1.2.0 like adding the possibility to have a
+  watchdog-only setup without shared-block-devices
+  legitimate a bump to v1.3.0.
+
 * Mon Oct 13 2014 <andrew at beekhof.net> - 1.2.1-0.4.3de531ed.git
 - Fixes for suitability to the el7 environment
 
diff --git a/src/Makefile.am b/src/Makefile.am
index f18b2b1..4d509c2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,5 +11,5 @@ if SUPPORT_SHARED_DISK
 sbd_SOURCES += sbd-md.c
 endif
 
-sbd_LDFLAGS = $(glib_LIBS) $(libcoroipcc_LIBS)
+sbd_LDADD = $(glib_LIBS) $(libcoroipcc_LIBS)
 
diff --git a/src/sbd-cluster.c b/src/sbd-cluster.c
index 67e930b..0ed56e7 100644
--- a/src/sbd-cluster.c
+++ b/src/sbd-cluster.c
@@ -297,7 +297,7 @@ sbd_remote_check(gpointer user_data)
         expected_path[rc] = 0;
 
         if (strcmp(exe_path, expected_path) == 0) {
-            cl_log(LOG_DEBUG, "Poccess %s (%ld) is active",
+            cl_log(LOG_DEBUG, "Process %s (%ld) is active",
                    exe_path, (long)remoted_pid);
             running = 1;
         }
diff --git a/src/sbd-common.c b/src/sbd-common.c
index b24f483..0f3fd62 100644
--- a/src/sbd-common.c
+++ b/src/sbd-common.c
@@ -487,8 +487,10 @@ do_exit(char kind)
     } else {
         watchdog_close(false);
         sysrq_trigger(kind);
-        if(reboot(RB_AUTOBOOT) < 0) {
-            cl_perror("Reboot failed");
+        if (kind != 'o') {
+            if(reboot(RB_AUTOBOOT) < 0) {
+                cl_perror("Reboot failed");
+            }
         }
     }
 
@@ -687,7 +689,7 @@ set_servant_health(enum pcmk_health state, int level, char const *format, ...)
         len = vasprintf (&string, format, ap);
 
         if(len > 0) {
-            cl_log(level, string);
+            cl_log(level, "%s", string);
         }
         
         va_end(ap);
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
index 3206973..3c3a5a0 100644
--- a/src/sbd-inquisitor.c
+++ b/src/sbd-inquisitor.c
@@ -50,6 +50,11 @@ void recruit_servant(const char *devname, pid_t pid)
 	struct servants_list_item *s = servants_leader;
 	struct servants_list_item *newbie;
 
+	if (lookup_servant_by_dev(devname)) {
+		cl_log(LOG_DEBUG, "Servant %s already exists", devname);
+		return;
+	}
+
 	newbie = malloc(sizeof(*newbie));
 	if (!newbie) {
 		fprintf(stderr, "malloc failed in recruit_servant.\n");
@@ -104,7 +109,7 @@ struct servants_list_item *lookup_servant_by_dev(const char *devname)
 	struct servants_list_item *s;
 
 	for (s = servants_leader; s; s = s->next) {
-		if (strncasecmp(s->devname, devname, strlen(s->devname)))
+		if (strcasecmp(s->devname, devname) == 0)
 			break;
 	}
 	return s;
@@ -194,7 +199,7 @@ void servants_kill(void)
 	}
 }
 
-inline void cleanup_servant_by_pid(pid_t pid)
+static inline void cleanup_servant_by_pid(pid_t pid)
 {
 	struct servants_list_item* s;
 
@@ -564,8 +569,8 @@ void inquisitor_child(void)
 
                     } else if(cluster_alive(false)) {
                         if(!decoupled) {
-                            /* On the way up, detatch and arm the watchdog */
-                            cl_log(LOG_NOTICE, "Partial cluster detected, detatching");
+                            /* On the way up, detach and arm the watchdog */
+                            cl_log(LOG_NOTICE, "Partial cluster detected, detaching");
                         }
 
                         can_detach = 1;
@@ -1012,6 +1017,14 @@ int main(int argc, char **argv, char **envp)
 		cl_log(LOG_INFO, "Watchdog disabled.");
 	}
 
+	if ((disk_count > 0) && (strlen(local_uname) > SECTOR_NAME_MAX)) {
+		fprintf(stderr, "Node name mustn't be longer than %d chars.\n",
+			SECTOR_NAME_MAX);
+		fprintf(stderr, "If uname is longer define a name to be used by sbd.\n");
+		exit_status = -1;
+		goto out;
+	}
+
 	if (disk_count > 3) {
 		fprintf(stderr, "You can specify up to 3 devices via the -d option.\n");
 		exit_status = -1;
@@ -1068,7 +1081,7 @@ int main(int argc, char **argv, char **envp)
 #endif
         
         if (strcmp(argv[optind], "watch") == 0) {
-            /* sleep $(sbd -d "$SBD_DEVICE" dump | grep -m 1 msgwait | awk '{print $4}') 2>/dev/null */
+            /* sleep $(sbd $SBD_DEVICE_ARGS dump | grep -m 1 msgwait | awk '{print $4}') 2>/dev/null */
 
                 /* We only want this to have an effect during watch right now;
                  * pinging and fencing would be too confused */
diff --git a/src/sbd-md.c b/src/sbd-md.c
index 9cdb6e9..10b1925 100644
--- a/src/sbd-md.c
+++ b/src/sbd-md.c
@@ -452,7 +452,7 @@ slot_lookup(struct sbd_context *st, const struct sector_header_s *s_header, cons
 		}
 		if (s_node->in_use != 0) {
 			if (strncasecmp(s_node->name, name,
-						sizeof(s_node->name)) == 0) {
+						SECTOR_NAME_MAX) == 0) {
 				DBGLOG(LOG_INFO, "%s owns slot %d", name, i);
 				rc = i; goto out;
 			}
@@ -526,7 +526,7 @@ slot_allocate(struct sbd_context *st, const char *name)
 			fprintf(stdout, "slot %d is unused - trying to own\n", i);
 			memset(s_node, 0, sizeof(*s_node));
 			s_node->in_use = 1;
-			strncpy(s_node->name, name, sizeof(s_node->name));
+			strncpy(s_node->name, name, SECTOR_NAME_MAX);
 			if (slot_write(st, i, s_node) < 0) {
 				rc = -1; goto out;
 			}
@@ -623,7 +623,7 @@ slot_msg(struct sbd_context *st, const char *name, const char *cmd)
 		rc = -1; goto out;
 	}
 
-	strncpy(s_mbox->from, local_uname, sizeof(s_mbox->from)-1);
+	strncpy(s_mbox->from, local_uname, SECTOR_NAME_MAX);
 
 	cl_log(LOG_INFO, "Writing %s to node slot %s",
 			cmd, name);
@@ -675,7 +675,7 @@ slot_ping(struct sbd_context *st, const char *name)
 	s_mbox = sector_alloc();
 	s_mbox->cmd = SBD_MSG_TEST;
 
-	strncpy(s_mbox->from, local_uname, sizeof(s_mbox->from)-1);
+	strncpy(s_mbox->from, local_uname, SECTOR_NAME_MAX);
 
 	DBGLOG(LOG_DEBUG, "Pinging node %s", name);
 	if (mbox_write(st, mbox, s_mbox) < -1) {
diff --git a/src/sbd.h b/src/sbd.h
index bf8bb62..07a476d 100644
--- a/src/sbd.h
+++ b/src/sbd.h
@@ -55,6 +55,7 @@
 /* FIXME: should add dynamic check of SIG_XX >= SIGRTMAX */
 
 #define HOG_CHAR	0xff
+#define SECTOR_NAME_MAX 63
 
 /* Sector data types */
 struct sector_header_s {
@@ -75,13 +76,13 @@ struct sector_header_s {
 
 struct sector_mbox_s {
 	signed char	cmd;
-	char		from[64];
+	char		from[SECTOR_NAME_MAX+1];
 };
 
 struct sector_node_s {
 	/* slots will be created with in_use == 0 */
 	char	in_use;
-	char 	name[64];
+	char 	name[SECTOR_NAME_MAX+1];
 };
 
 struct servants_list_item {
diff --git a/src/sbd.sh b/src/sbd.sh
index 91f49a3..35b0e92 100644
--- a/src/sbd.sh
+++ b/src/sbd.sh
@@ -38,7 +38,7 @@ if [ -z "$SBD_DEVICE" ]; then
 	exit 1
 fi
 SBD_DEVS=${SBD_DEVICE%;}
-SBD_DEVICE=${SBD_DEVS//;/ -d }
+SBD_DEVICE_ARGS="-d ${SBD_DEVS//;/ -d }"
 
 : ${SBD_PIDFILE:=/var/run/sbd.pid}
 SBD_OPTS+=" -p $SBD_PIDFILE"
@@ -62,12 +62,12 @@ esac
 
 start() {
 	if ! pidofproc -p $SBD_PIDFILE $SBD_BIN >/dev/null 2>&1 ; then
-		if ! $SBD_BIN -d $SBD_DEVICE $SBD_OPTS watch ; then
+		if ! $SBD_BIN $SBD_DEVICE_ARGS $SBD_OPTS watch ; then
 			echo "SBD failed to start; aborting."
 			exit 1
 		fi
 		if ocf_is_true ${SBD_DELAY_START} ; then
-			sleep $(sbd -d "$SBD_DEVICE" dump | grep -m 1 msgwait | awk '{print $4}') 2>/dev/null
+			sleep $($SBD_BIN $SBD_DEVICE_ARGS dump | grep -m 1 msgwait | awk '{print $4}') 2>/dev/null
 		fi
 	else
 		return 0
@@ -75,7 +75,7 @@ start() {
 }
 
 stop() {
-	if ! $SBD_BIN -d $SBD_DEVICE -D $SBD_OPTS message LOCAL exit ; then
+	if ! $SBD_BIN $SBD_DEVICE_ARGS -D $SBD_OPTS message LOCAL exit ; then
 		echo "SBD failed to stop; aborting."
 		exit 1
 	fi
diff --git a/src/sbd.sysconfig b/src/sbd.sysconfig
index 4b0d141..cbc1501 100644
--- a/src/sbd.sysconfig
+++ b/src/sbd.sysconfig
@@ -21,7 +21,7 @@ SBD_PACEMAKER=yes
 # allow sbd to start if it was not previously fenced. See the -S option
 # in the man page.
 #
-SBD_STARTMODE=clean
+SBD_STARTMODE=always
 
 ## Type: yesno
 ## Default: no
@@ -36,10 +36,11 @@ SBD_STARTMODE=clean
 #
 SBD_DELAY_START=no
 
-## Type: yesno
-## Default: yes
+## Type: string
+## Default: /dev/watchdog
 #
-# Whether to use a watchdog.
+# Watchdog device to use. If set to /dev/null, no watchdog device will
+# be used.
 #
 SBD_WATCHDOG_DEV=/dev/watchdog
 

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



More information about the Debian-HA-Commits mailing list