Skip to content

Commit

Permalink
ctdb-scripts: Drop functions mark_up() and mark_down()
Browse files Browse the repository at this point in the history
Each is now used in only one place and the logic is more obvious
without them.

Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Jan 25, 2016
1 parent 85316c0 commit d0f2143
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions ctdb/config/events.d/10.interface
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ loadconfig
exit 0
}

mark_up ()
{
up_interfaces_found=true
ctdb setifacelink $1 up >/dev/null 2>&1
}

mark_down ()
{
fail=true
ctdb setifacelink $1 down >/dev/null 2>&1
}

# This sets $all_interfaces as a side-effect.
get_all_interfaces ()
{
Expand Down Expand Up @@ -61,13 +49,14 @@ monitor_interfaces()

# Note that this loop must not exit early. It must process
# all interfaces so that the correct state for each interface
# is set in CTDB using mark_up/mark_down. If there is a
# problem with an interface then set fail=true and continue.
# is set in CTDB using setifacelink.
for _iface in $all_interfaces ; do
if interface_monitor "$_iface" ; then
mark_up "$_iface"
up_interfaces_found=true
ctdb setifacelink "$_iface" up >/dev/null 2>&1
else
mark_down "$_iface"
fail=true
ctdb setifacelink "$_iface" down >/dev/null 2>&1
fi
done

Expand Down

0 comments on commit d0f2143

Please sign in to comment.