1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

ctdb-tools: Simplify "ctdb pnn" output format

Just print the PNN.

Update dependent code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-07-22 16:19:23 +10:00 committed by Amitay Isaacs
parent d6e1e69765
commit c3c106e41f
5 changed files with 9 additions and 10 deletions

View File

@ -249,7 +249,7 @@ ctdb_get_pnn ()
{
_pnn_file="${CTDB_SCRIPT_VARDIR}/my-pnn"
if [ ! -f "$_pnn_file" ] ; then
$CTDB pnn | sed -e 's@.*:@@' >"$_pnn_file"
$CTDB pnn >"$_pnn_file"
fi
cat "$_pnn_file"

View File

@ -66,8 +66,7 @@ parse_nodespec ()
elif [ -n "$nodespec" ] ; then
nodes="$(echo $nodespec | sed -e 's@,@ @g')"
else
_t=$(ctdb_pnn)
nodes="${_t#PNN:}"
node=$(ctdb_pnn)
fi
}
@ -81,7 +80,7 @@ done
ctdb_pnn ()
{
# Defaults to 0
echo "PNN:${FAKE_CTDB_PNN:-0}"
echo "${FAKE_CTDB_PNN:-0}"
}
######################################################################
@ -139,7 +138,7 @@ ctdb_ip ()
# If nobody has done any IP-fu then generate a layout.
[ -f "$FAKE_CTDB_IP_LAYOUT" ] || ip_reallocate
_mypnn=$(ctdb_pnn | sed -e 's@PNN:@@')
_mypnn=$(ctdb_pnn)
if $machine_readable ; then
if $verbose ; then

View File

@ -231,7 +231,7 @@ get_test_ip_mask_and_iface ()
ctdb_get_all_pnns ()
{
try_command_on_node -q all "$CTDB pnn | sed -e 's@PNN:@@'"
try_command_on_node -q all "$CTDB pnn"
all_pnns="$out"
}

View File

@ -873,7 +873,7 @@ static int control_pnn(struct ctdb_context *ctdb, int argc, const char **argv)
mypnn = getpnn(ctdb);
printf("PNN:%d\n", mypnn);
printf("%u\n", mypnn);
return 0;
}

View File

@ -199,9 +199,9 @@ get_any_available_node ()
# We do a recursive onnode to find which nodes are up and running.
local out line
out=$("$0" -pq all ctdb pnn 2>&1)
while read line ; do
local pnn="${line#PNN:}"
if [ "$pnn" != "$line" ] ; then
while read line ; do
if [[ "$line" =~ ^[0-9]+$ ]] ; then
local pnn="$line"
# Intentional multi-word expansion
# shellcheck disable=SC2086
echo_nth "$pnn" $all_nodes