1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

ctdb-scripts: Changed uses of "ctdb xpnn" to ctdb_get_pnn()

"ctdb xpnn" does not work when sysctl net.ipv4.ip_nonlocal_bind=1,
since it determines the node by attempting to bind to each addres in
the nodes file.  The solution is to not use "ctdb xpnn".  After the
initial call, ctdb_get_pnn() will be more efficient that "ctdb xpnn".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2015-04-18 22:00:49 +10:00 committed by Amitay Isaacs
parent af93ae1a54
commit 09b5e4978a
3 changed files with 9 additions and 9 deletions

View File

@ -103,7 +103,8 @@ EOF
update_config_from_tdb() {
# Pull optional ctdb configuration data out of config.tdb
_key="public_addresses:node#$(ctdb -t 1 xpnn|sed -e 's/.*://')"
ctdb_get_pnn
_key="public_addresses:node#${pnn}"
_t="$service_state_dir/public_addresses"
rm -f "$_t"

View File

@ -47,15 +47,14 @@ EOF
# Stop iSCSI daemon
killall -9 tgtd >/dev/null 2>/dev/null
# What node is this?
this_node=$(ctdb xpnn | sed -e 's@PNN:@@')
[ -n "$this_node" ] || die "Failed to get node pnn"
ctdb_get_pnn
[ -n "$pnn" ] || die "Failed to get node pnn"
# Start iSCSI daemon
tgtd >/dev/null 2>&1
# Run a script for each currently hosted public IP address
ips=$(echo "$all_ips" | awk -F'|' -v pnn=$this_node '$3 == pnn {print $2}')
ips=$(echo "$all_ips" | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
for ip in $ips ; do
script="${CTDB_START_ISCSI_SCRIPTS}/${ip}.sh"
if [ -x "$script" ] ; then

View File

@ -47,7 +47,7 @@ case "$1" in
# statd does not tell us to which IP the client connected so
# we must add it to all the IPs that we serve
cip="$2"
pnn=$(ctdb xpnn | sed -e 's/.*://')
ctdb_get_pnn
date=$(date '+%s')
ctdb ip -X |
tail -n +2 |
@ -62,7 +62,7 @@ case "$1" in
# statd does not tell us from which IP the client disconnected
# so we must add it to all the IPs that we serve
cip="$2"
pnn=$(ctdb xpnn | sed -e 's/.*://')
ctdb_get_pnn
ctdb ip -X |
tail -n +2 |
while IFS="|" read x sip node x ; do
@ -80,7 +80,7 @@ case "$1" in
fi
# Filter out lines for any IP addresses that are not currently
# hosted public IP addresses.
pnn=$(ctdb xpnn | sed -e 's/.*://')
ctdb_get_pnn
ctdb_ips=$(ctdb ip | tail -n +2)
sed_expr=$(echo "$ctdb_ips" |
awk -v pnn=$pnn 'pnn == $2 { \
@ -156,7 +156,7 @@ case "$1" in
# probability that the client will accept the statd notify packet and
# not just ignore it.
# For all IPs we serve, collect info and push to the config database
pnn=$(ctdb xpnn | sed -e 's/.*://')
ctdb_get_pnn
# Construct a sed expression to take catdb output and produce pairs of:
# server-IP client-IP