Commit 7f965aea authored by Thomas Thrainer's avatar Thomas Thrainer
Browse files

Don't fail to deactivate master IP if already down



The master IP setup script now checks if the master IP is actually
configured on the machine before trying to remove the IP.

This fixes issue 460.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent e2e98c6e
......@@ -62,6 +62,20 @@ start() {
# Stop the master IP
stop() {
# Check if the master IP address is still configured on this machine
if ! ip addr show dev $MASTER_NETDEV | \
grep -F " $MASTER_IP/$MASTER_NETMASK" >/dev/null 2>&1; then
# Check if the master IP address is configured on a wrong device
if fping -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
echo "Error: master IP address configured on wrong device," \
"can't shut it down." >&2
exit 1
else
echo "Master IP address not configured on this machine. Doing nothing."
exit 0
fi
fi
if ! ip addr del $MASTER_IP/$MASTER_NETMASK dev $MASTER_NETDEV; then
echo "Error during the deactivation of the master IP address" >&2
exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment