[PATCHES] make ctdb runnable in non-FHS installs

Michael Adam obnox at samba.org
Fri Jun 10 07:44:54 UTC 2016


On 2016-06-10 at 15:43 +1000, Martin Schwenke wrote:
> Hi Michael,
> 
> On Thu, 9 Jun 2016 17:57:21 +0200, Michael Adam <obnox at samba.org> wrote:
> 
> > After a long fruitful IRC discussion with Martin
> > and Amitay, we are sticking with #1, i.e. not renaming
> > ctdb and naming the wrapper ctdb. This poses too many
> > problems.
> > 
> > Instead the updated patchset first makes sure that
> > the proper ctdb binary can always be found as $CTDB
> > in the scripts (and is used in the scripts). For the
> > tests, a simple CTDB=ctdb override did the trick.
> 
> The hunk in the last patch that does the wscript sed magic needs to
> come into the first patch, so that "/usr/local/bin" gets substituted on
> installation.

Indeed! Done.

> Can you please move the patch that sets CTDB in the test code to be
> second in the series?  That way it comes before the other patches that
> use $CTDB in eventscripts, and that means that tests will pass for
> each patch in the series.

Good pont. Done.

> In that patch it turns out I was wrong about needing something in
> local_daemons.bash.  This is already done in integration.bash,
> which is used by "simple" and "complex" tests.  Sorry I got that
> wrong!

Correct. Just verified (with a complete successfull ctdb autobuild)
and removed the hunk. Somehow I originally thought this was needed...

> For the hunk that remains, you could do the export on the same
> line as the assignment, but that's no big deal...  :-)

Done.

> > Node: I provided patches to make use of $CTDB
> > instead of verbatim 'ctdb' as one patch per file.
> > I like this better, but if people insist, we could
> > also squash those into one big sweeping change patch.
> 
> No worries...  :-)
> 
> > Finally the super simple wrapper is provided
> > as ctdb_wrapper. This is mainly convenient
> > when a non-default CTDB_SOCKET is set in the conf file.
> 
> > Note: instead of doing the maybe_set thing to
> > turn CTDB_SOCKET into a --socket option, we could
> > use export CTDB_SOCKET, but I like cmdline options
> > better and we don't need the export for other purposes.
> 
> Can we please drop the wrapper (and the maybe_set() refactoring) for
> now, get the $CTDB stuff upstream and discuss the wrapper further?

Sure!

> Before I added all of the sed magic to make things install cleanly, I
> thought about adding a wrapper... but I'm not sure it serves a useful
> purpose anymore.  For a regular installation CTDB_SOCKET should not be
> set - the socket location should be set at compile time.  For testing
> with local daemons, the preference is to use onnode with
> $CTDB_NODES_SOCKETS set, the way local_daemons.bash does it.

OK. Onnode can also read $CTDB_BASE/nodes to build the list
of nodes, which seems even more practical to me.

> This provides a nice abstraction layer so tests can be written
> that can run against both local daemons and a real cluster,
> like the "simple" tests.
> 
> If we have a wrapper then it will also need a manpage, since it is
> installed in a bin directory.

True.

> Also, I honestly think it will confuse people and they won't know which
> command to use...

Sold. I withdraw the ctdb_wrapper! :-)

Attached find the updated patchset.

Thanks for the reviews!

Michael

-------------- next part --------------
From 57e0f565328d752e899da3014438dbb135c189cc Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 12:08:35 +0200
Subject: [PATCH 01/14] ctdb: set the path to 'ctdb' in 'functions' in CTDB

Allow this to be overridden from the caller.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/functions | 2 ++
 ctdb/wscript          | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ctdb/config/functions b/ctdb/config/functions
index b2a0735..7032540 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -10,6 +10,8 @@ fi
 CTDB_VARDIR="/usr/local/var/lib/ctdb"
 ctdb_rundir="/usr/local/var/run/ctdb"
 
+CTDB="${CTDB:-/usr/local/bin/ctdb}"
+
 # Only (and always) override these variables in test code
 
 if [ -z "$CTDB_SCRIPT_VARDIR" ] ; then
diff --git a/ctdb/wscript b/ctdb/wscript
index 6a411da..60ea824 100755
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -515,9 +515,10 @@ def build(bld):
     sed_expr4 = 's|/usr/local/var/run/ctdb|%s|g'  % (bld.env.CTDB_RUNDIR)
     sed_expr5 = 's|/usr/local/sbin|%s|g'          % (bld.env.SBINDIR)
     sed_expr6 = 's|/usr/local/libexec/ctdb|%s|g'  % (bld.env.CTDB_HELPER_BINDIR)
-    sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \
+    sed_expr7 = 's|/usr/local/bin|%s|g'           % (bld.env.BINDIR)
+    sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \
                        (sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5,
-                        sed_expr6)
+                        sed_expr6, sed_expr7)
 
     for f in manpages:
         x = '%s.xml' % (f)
-- 
2.5.5


From ecd8563c917ff964c9806024b326640b0fb772ab Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 9 Jun 2016 13:55:29 +0200
Subject: [PATCH 02/14] ctdb: make sure scripts using $CTDB called by test find
 ctdb

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/tests/eventscripts/scripts/local.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index 51f3858..37141c6 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -20,6 +20,8 @@ export EVENTSCRIPTS_PATH
 
 PATH="${EVENTSCRIPTS_PATH}:${PATH}"
 
+export CTDB="ctdb"
+
 export EVENTSCRIPTS_TESTS_VAR_DIR="${TEST_VAR_DIR}/unit_eventscripts"
 if [ -d "$EVENTSCRIPTS_TESTS_VAR_DIR" -a \
     "$EVENTSCRIPTS_TESTS_VAR_DIR" != "/unit_eventscripts" ] ; then
-- 
2.5.5


From 67ec4eccfe8c6ee422fab69bfce8c17ee0521534 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 12:28:36 +0200
Subject: [PATCH 03/14] ctdb: use properly configured ctdb in functions

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/functions | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/ctdb/config/functions b/ctdb/config/functions
index 7032540..e32826d 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -245,7 +245,7 @@ ctdb_get_pnn ()
 {
     _pnn_file="${CTDB_SCRIPT_VARDIR}/my-pnn"
     if [ ! -f "$_pnn_file" ] ; then
-	ctdb pnn | sed -e 's at .*:@@' >"$_pnn_file"
+	$CTDB pnn | sed -e 's at .*:@@' >"$_pnn_file"
     fi
 
     read pnn <"$_pnn_file"
@@ -257,7 +257,7 @@ ctdb_get_ip_address ()
 {
     _ip_addr_file="${CTDB_SCRIPT_VARDIR}/my-ip-address"
     if [ ! -f "$_ip_addr_file" ] ; then
-	ctdb -X nodestatus |
+	$CTDB -X nodestatus |
 	    awk -F '|' 'NR == 2 { print $3 }' >"$_ip_addr_file"
     fi
 
@@ -380,7 +380,7 @@ ctdb_check_tcp_ports()
     fi
 
     for _p ; do  # process each function argument (port)
-	_cmd="ctdb checktcpport $_p"
+	_cmd="$CTDB checktcpport $_p"
 	_out=$($_cmd 2>&1)
 	_ret=$?
 	case "$_ret" in
@@ -402,7 +402,7 @@ ctdb_check_tcp_ports()
 	    *)
 		echo "ERROR: unexpected error running \"ctdb checktcpport\""
 		debug <<EOF
-ctdb checktcpport (exited with $_ret) with output:
+$CTDB checktcpport (exited with $_ret) with output:
 $_out"
 EOF
 		return $_ret
@@ -520,9 +520,9 @@ tickle_tcp_connections ()
 
 	while read dest src; do
 	    echo "Tickle TCP connection $src $dest"
-	    ctdb tickle $src $dest >/dev/null 2>&1 || _failed=true
+	    $CTDB tickle $src $dest >/dev/null 2>&1 || _failed=true
 	    echo "Tickle TCP connection $dest $src"
-	    ctdb tickle $dest $src >/dev/null 2>&1 || _failed=true
+	    $CTDB tickle $dest $src >/dev/null 2>&1 || _failed=true
 	done
 
 	if $_failed ; then
@@ -911,7 +911,7 @@ ctdb_replay_monitor_status ()
 {
     echo "Replaying previous status for this script due to reconfigure..."
     # Leading separator ('|') is missing in some versions...
-    _out=$(ctdb scriptstatus -X | grep -E "^\|?monitor\|${script_name}\|")
+    _out=$($CTDB scriptstatus -X | grep -E "^\|?monitor\|${script_name}\|")
     # Output looks like this:
     # |monitor|60.nfs|1|ERROR|1314764004.030861|1314764004.035514|foo bar|
     # This is the cheapest way of getting fields in the middle.
@@ -1243,7 +1243,7 @@ update_tickles ()
 	ctdb_get_pnn
 
 	# What public IPs do I hold?
-	_ips=$(ctdb -X ip | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
+	_ips=$($CTDB -X ip | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
 
 	# IPs and port as ss filters
 	_ip_filter=""
@@ -1268,7 +1268,7 @@ update_tickles ()
 	# Record our current tickles in a temporary file
 	_my_tickles="${tickledir}/${_port}.tickles.$$"
 	for _i in $_ips ; do
-		ctdb -X gettickles $_i $_port |
+		$CTDB -X gettickles $_i $_port |
 		awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
 	done |
 	sort >"$_my_tickles"
@@ -1276,13 +1276,13 @@ update_tickles ()
 	# Add tickles for connections that we haven't already got tickles for
 	comm -23 "$_my_connections" "$_my_tickles" |
 	while read _src _dst ; do
-		ctdb addtickle $_src $_dst
+		$CTDB addtickle $_src $_dst
 	done
 
 	# Remove tickles for connections that are no longer there
 	comm -13 "$_my_connections" "$_my_tickles" |
 	while read _src _dst ; do
-		ctdb deltickle $_src $_dst
+		$CTDB deltickle $_src $_dst
 	done
 
 	rm -f "$_my_connections" "$_my_tickles"
-- 
2.5.5


From 87c0b2bc59baa368d26fa79d9d61e53ccce55f7b Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Tue, 7 Jun 2016 07:44:53 +0000
Subject: [PATCH 04/14] ctdb: use properly configured ctdb in ctdbd_wrapper

This makes ctdbd_wrapper usable in non-standard installs.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/ctdbd_wrapper | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index b1f71c3..b6b983c 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -256,7 +256,7 @@ start()
 		return 1
 	    fi
 
-	    if ctdb runstate first_recovery startup running >/dev/null 2>&1 ; then
+	    if $CTDB runstate first_recovery startup running >/dev/null 2>&1 ; then
 		return 0
 	    fi
 	fi
@@ -278,7 +278,7 @@ stop()
 	return 0
     fi
 
-    ctdb shutdown
+    $CTDB shutdown
 
     # Wait for remaining CTDB processes to exit...
     _timeout=${CTDB_SHUTDOWN_TIMEOUT:-30}
-- 
2.5.5


From 83d79369b93f61ee089dd44e6f45f97f762aed57 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 13:21:56 +0200
Subject: [PATCH 05/14] ctdb: use properly configured ctdb in 00.ctdb

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/00.ctdb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb
index 3bc20d7..bb150ac 100755
--- a/ctdb/config/events.d/00.ctdb
+++ b/ctdb/config/events.d/00.ctdb
@@ -107,7 +107,7 @@ set_ctdb_variables ()
     while read v; do
 	varname="${v#CTDB_SET_}"
 	value=$(eval echo "\$$v")
-	if ctdb setvar $varname $value ; then
+	if $CTDB setvar $varname $value ; then
 	    echo "Set $varname to $value"
 	else
 	    echo "Invalid configuration: CTDB_SET_${varname}=${value}"
@@ -140,7 +140,7 @@ case "$1" in
 	;;
 
     startup)
-	ctdb attach ctdb.tdb persistent
+	$CTDB attach ctdb.tdb persistent
 	;;
 
     *)
-- 
2.5.5


From 963f134098d0a9eef77674bb71c74da1a2b5ab04 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 13:22:24 +0200
Subject: [PATCH 06/14] ctdb: use properly configured ctdb in 01.reclock

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/01.reclock | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/config/events.d/01.reclock b/ctdb/config/events.d/01.reclock
index e2d4d12..da37cf8 100755
--- a/ctdb/config/events.d/01.reclock
+++ b/ctdb/config/events.d/01.reclock
@@ -41,7 +41,7 @@ case "$1" in
 	    echo "Reclock file \"$CTDB_RECOVERY_LOCK\" can not be accessed. Shutting down."
 	    df
 	    sleep 1
-	    ctdb shutdown
+	    $CTDB shutdown
 	fi
 
 	ctdb_check_counter "error" -gt 3
-- 
2.5.5


From 33d3573c18391501670665bc77b314577d36c088 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 13:22:44 +0200
Subject: [PATCH 07/14] ctdb: use properly configured ctdb in 10.external

---
 ctdb/config/events.d/10.external | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ctdb/config/events.d/10.external b/ctdb/config/events.d/10.external
index 3fcb0e1..40f4680 100644
--- a/ctdb/config/events.d/10.external
+++ b/ctdb/config/events.d/10.external
@@ -28,12 +28,12 @@ takeover_assigned_ips ()
 {
     ctdb_get_pnn
 
-    ctdb -X ip |
+    $CTDB -X ip |
     awk -F'|' '{print $2}' |
     while read ip ; do
 	if [ -n "$(ip_maskbits_iface $ip)" ] ; then
 	    echo "Assigning $ip to this node ($pnn)"
-	    ctdb moveip "$ip" "$pnn"
+	    $CTDB moveip "$ip" "$pnn"
 	fi
     done
 }
-- 
2.5.5


From 1141769c4db9fdf4501c02948de093e58b2d61b6 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 13:23:07 +0200
Subject: [PATCH 08/14] ctdb: use properly configured ctdb in 13.per_ip_routing

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/13.per_ip_routing | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing
index 56dfc34..cfcd484 100755
--- a/ctdb/config/events.d/13.per_ip_routing
+++ b/ctdb/config/events.d/13.per_ip_routing
@@ -292,7 +292,7 @@ flush_rules_and_routes ()
 # routes.
 add_missing_routes ()
 {
-    ctdb ip -v -X | {
+    $CTDB ip -v -X | {
 	read _x # skip header line
 
 	# Read the rest of the lines.  We're only interested in the
@@ -319,7 +319,7 @@ add_missing_routes ()
 remove_bogus_routes ()
 {
     # Get a IPs current hosted by this node, each anchored with '@'.
-    _ips=$(ctdb ip -v -X | awk -F'|' 'NR > 1 && $4 != "" {printf "@%s@\n", $2}')
+    _ips=$($CTDB ip -v -X | awk -F'|' 'NR > 1 && $4 != "" {printf "@%s@\n", $2}')
 
     ip rule show |
     while read _p _x _i _x _t ; do
@@ -382,7 +382,7 @@ case "$1" in
 	# flush our route cache
 	set_proc sys/net/ipv4/route/flush 1
 
-	ctdb gratiousarp "$ip" "$iface"
+	$CTDB gratiousarp "$ip" "$iface"
 	;;
 
     updateip)
@@ -397,7 +397,7 @@ case "$1" in
 	# flush our route cache
 	set_proc sys/net/ipv4/route/flush 1
 
-	ctdb gratiousarp "$ip" "$niface"
+	$CTDB gratiousarp "$ip" "$niface"
 	tickle_tcp_connections "$ip"
 	;;
 
-- 
2.5.5


From fd7e5f6ea960c62cabc3913a6e0145433cb96b0d Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 12:37:00 +0200
Subject: [PATCH 09/14] ctdb: use properly configured ctdb in 10.interfaces

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/10.interface | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface
index bdb9443..204f4c6 100755
--- a/ctdb/config/events.d/10.interface
+++ b/ctdb/config/events.d/10.interface
@@ -33,7 +33,7 @@ get_all_interfaces ()
 
     # Get the interfaces for which CTDB has public IPs configured.
     # That is, for all but the 1st line, get the 1st field.
-    ctdb_ifaces=$(ctdb -X ifaces | sed -e '1d' -e 's@^|@@' -e 's@|.*@@')
+    ctdb_ifaces=$($CTDB -X ifaces | sed -e '1d' -e 's@^|@@' -e 's@|.*@@')
 
     # Add $ctdb_interfaces and uniquify
     all_interfaces=$(echo $all_interfaces $ctdb_ifaces | tr ' ' '\n' | sort -u)
@@ -52,10 +52,10 @@ monitor_interfaces()
 	for _iface in $all_interfaces ; do
 		if interface_monitor "$_iface" ; then
 			up_interfaces_found=true
-			ctdb setifacelink "$_iface" up >/dev/null 2>&1
+			$CTDB setifacelink "$_iface" up >/dev/null 2>&1
 		else
 			down_interfaces_found=true
-			ctdb setifacelink "$_iface" down >/dev/null 2>&1
+			$CTDB setifacelink "$_iface" down >/dev/null 2>&1
 		fi
 	done
 
@@ -233,7 +233,7 @@ case "$1" in
 	flush_route_cache
 
 	# propagate the new mac address
-	ctdb gratiousarp $ip $niface
+	$CTDB gratiousarp $ip $niface
 
 	# tickle all existing connections, so that dropped packets
 	# are retransmited and the tcp streams work
-- 
2.5.5


From 421be884d911d741669af8564e37d17907b6294c Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 12:44:28 +0200
Subject: [PATCH 10/14] ctdb: use properly configured ctdb in 70.iscsi

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/70.iscsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/config/events.d/70.iscsi b/ctdb/config/events.d/70.iscsi
index 33b71c4..9e75214 100755
--- a/ctdb/config/events.d/70.iscsi
+++ b/ctdb/config/events.d/70.iscsi
@@ -22,7 +22,7 @@ is_ctdb_managed_service || exit 0
 
 case "$1" in
     ipreallocated)
-	all_ips=$(ctdb -X ip | tail -n +2)
+	all_ips=$($CTDB -X ip | tail -n +2)
 
 	# Block the iSCSI port.  Only block for the address families
 	# we have configured.  This copes with, for example, ip6tables
-- 
2.5.5


From c39f355faf046858705edd57e8ee6d37d399c750 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 13:04:48 +0200
Subject: [PATCH 11/14] ctdb: use properly configured ctdb in 91.lvs

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/91.lvs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/config/events.d/91.lvs b/ctdb/config/events.d/91.lvs
index 141f964..434bd2b 100755
--- a/ctdb/config/events.d/91.lvs
+++ b/ctdb/config/events.d/91.lvs
@@ -109,7 +109,7 @@ ipreallocated)
 	ipvsadm -a -t "$CTDB_LVS_PUBLIC_IP" -r 127.0.0.1
 	ipvsadm -a -u "$CTDB_LVS_PUBLIC_IP" -r 127.0.0.1
 
-	ctdb gratiousarp \
+	$CTDB gratiousarp \
 	     "$CTDB_LVS_PUBLIC_IP" "$CTDB_LVS_PUBLIC_IFACE" >/dev/null 2>&1
 
 	flush_route_cache
-- 
2.5.5


From 31ee1f09a2b05eaf29b09c06e0a0474357c8bf28 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 13:05:03 +0200
Subject: [PATCH 12/14] ctdb: use properly configured ctdb in 99.timeout

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/99.timeout | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/config/events.d/99.timeout b/ctdb/config/events.d/99.timeout
index 2a6495a..c18475f 100755
--- a/ctdb/config/events.d/99.timeout
+++ b/ctdb/config/events.d/99.timeout
@@ -14,7 +14,7 @@ loadconfig ctdb
 
 case "$1" in
     monitor)
-	TIMEOUT=$(ctdb getvar EventScriptTimeout | awk '{print $3}')
+	TIMEOUT=$($CTDB getvar EventScriptTimeout | awk '{print $3}')
 	echo "sleeping for $((TIMEOUT * 2)) seconds..."
 	sleep $((TIMEOUT * 2))
 	;;
-- 
2.5.5


From 2458e1e8f0acf0d1f74a663f6c74b81854a919cd Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 12:28:56 +0200
Subject: [PATCH 13/14] ctdb: use properly configured ctdb in statd-callout

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/statd-callout | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout
index a923d8a..1cbe653 100755
--- a/ctdb/config/statd-callout
+++ b/ctdb/config/statd-callout
@@ -49,7 +49,7 @@ case "$1" in
 	cip="$2"
 	ctdb_get_pnn
 	date=$(date '+%s')
-	ctdb ip -X |
+	$CTDB ip -X |
 	tail -n +2 |
 	while IFS="|" read x sip node x ; do
 	    [ "$node" = "$pnn" ] || continue # not us
@@ -63,7 +63,7 @@ case "$1" in
 	# so we must add it to all the IPs that we serve
 	cip="$2"
 	ctdb_get_pnn
-	ctdb ip -X |
+	$CTDB ip -X |
 	tail -n +2 |
 	while IFS="|" read x sip node x ; do
 	    [ "$node" = "$pnn" ] || continue # not us
@@ -81,12 +81,12 @@ case "$1" in
 	# Filter out lines for any IP addresses that are not currently
 	# hosted public IP addresses.
 	ctdb_get_pnn
-	ctdb_ips=$(ctdb ip | tail -n +2)
+	ctdb_ips=$($CTDB ip | tail -n +2)
 	sed_expr=$(echo "$ctdb_ips" |
 	    awk -v pnn=$pnn 'pnn == $2 { \
                 ip = $1; gsub(/\./, "\\.", ip); \
                 printf "/statd-state@%s@/p\n", ip }')
-        if cat $files | sed -n "$sed_expr" | ctdb ptrans "ctdb.tdb" ; then
+        if cat $files | sed -n "$sed_expr" | $CTDB ptrans "ctdb.tdb" ; then
             rm $files
 	fi
         ;;
@@ -159,13 +159,13 @@ case "$1" in
 	# Construct a sed expression to take catdb output and produce pairs of:
 	#   server-IP client-IP
 	# but only for the server-IPs that are hosted on this node.
-	ctdb_all_ips=$(ctdb ip all | tail -n +2)
+	ctdb_all_ips=$($CTDB ip all | tail -n +2)
 	sed_expr=$(echo "$ctdb_all_ips" |
 	    awk -v pnn=$pnn 'pnn == $2 { \
                 ip = $1; gsub(/\./, "\\.", ip); \
                 printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", ip }')
 
-	statd_state=$(ctdb catdb ctdb.tdb | sed -n "$sed_expr" | sort)
+	statd_state=$($CTDB catdb ctdb.tdb | sed -n "$sed_expr" | sort)
 	[ -n "$statd_state" ] || exit 0
 
 	smnotify="${CTDB_HELPER_BINDIR}/smnotify"
@@ -195,7 +195,7 @@ case "$1" in
 		"$smnotify" --client=$cip --ip=$sip --server=$NFS_HOSTNAME --stateval=$stateval
 	    done
 
-	    echo "$items" | ctdb ptrans "ctdb.tdb"
+	    echo "$items" | $CTDB ptrans "ctdb.tdb"
 	}
 
 	# Remove any stale touch files (i.e. for IPs not currently
-- 
2.5.5


From 4199db2d4da25aa26b1f405d3ea576a0e6da5716 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 8 Jun 2016 12:32:04 +0200
Subject: [PATCH 14/14] ctdb: use properly configured ctdb in
 debug-hung-script.sh

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/debug-hung-script.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/config/debug-hung-script.sh b/ctdb/config/debug-hung-script.sh
index 9bde684..cef004b 100755
--- a/ctdb/config/debug-hung-script.sh
+++ b/ctdb/config/debug-hung-script.sh
@@ -47,7 +47,7 @@ fi
 
     if [ "$2" != "init" ] ; then
 	echo "---- ctdb scriptstatus ${2}: ----"
-	ctdb scriptstatus "$2"
+	$CTDB scriptstatus "$2"
     fi
 
     echo "===== End of hung script debug for PID=\"$1\", event=\"$2\" ====="
-- 
2.5.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160610/e4ae5a0a/signature.sig>


More information about the samba-technical mailing list