Sorry, while re-reading, I guess what Guido wanted to say is that we should
1) check if the master IP is no longer configured on the master device and
2) if it is no longer configured, check if it is configured on another
device on the master node. If it is, error, otherwise success.
Interdiff (replaces the one from the last mail):
diff --git a/tools/master-ip-setup b/tools/master-ip-setup
index 463def6..9716bc3 100755
--- a/tools/master-ip-setup
+++ b/tools/master-ip-setup
@@ -63,10 +63,11 @@ start() {
# Stop the master IP
stop() {
# Check if the master IP address is still configured on this machine
- if ! fping -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
- # Check if the master IP address is configured on another machine
- if fping $MASTER_IP >/dev/null 2>&1; then
- echo "Error: master IP address configured on another 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
On Thu, May 16, 2013 at 5:04 PM, Thomas Thrainer <[email protected]>wrote:
> Hmm, maybe I then got the comment from your first mail regarding this
> patch wrong...
>
> Anyway, here's the interdiff:
>
> diff --git a/tools/master-ip-setup b/tools/master-ip-setup
> index 463def6..1b65f69 100755
> --- a/tools/master-ip-setup
> +++ b/tools/master-ip-setup
> @@ -64,15 +64,8 @@ start() {
> stop() {
> # Check if the master IP address is still configured on this machine
> if ! fping -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
> - # Check if the master IP address is configured on another machine
> - if fping $MASTER_IP >/dev/null 2>&1; then
> - echo "Error: master IP address configured on another machine," \
> - "can't shut it down." >&2
> - exit 1
> - else
> - echo "Master IP address not configured on this machine. Doing
> nothing."
> - exit 0
> - fi
> + echo "Master IP address not configured on this machine. Doing
> nothing."
> + exit 0
> fi
>
> if ! ip addr del $MASTER_IP/$MASTER_NETMASK dev $MASTER_NETDEV; then
>
>
> On Thu, May 16, 2013 at 3:41 PM, Guido Trotter <[email protected]>wrote:
>
>>
>>
>>
>> On Thu, May 16, 2013 at 9:06 AM, Thomas Thrainer <[email protected]>wrote:
>>
>>> I changed the way to check for the master IP on the master node to fping
>>> -S 127.0.0.1, and if the master IP is not configured, now there's a check
>>> which looks for the master IP on another node. If it is configured on a
>>> different node, an error is produced.
>>>
>>> Interdiff:
>>>
>>> diff --git a/tools/master-ip-setup b/tools/master-ip-setup
>>> index d40b4c3..463def6 100755
>>> --- a/tools/master-ip-setup
>>> +++ b/tools/master-ip-setup
>>> @@ -62,10 +62,17 @@ start() {
>>>
>>> # Stop the master IP
>>> stop() {
>>> - if ! ip addr show dev $MASTER_NETDEV | \
>>> - grep -F " $MASTER_IP/$MASTER_NETMASK" >/dev/null 2>&1; then
>>> - echo "Master IP address not configured on this machine. Doing
>>> nothing."
>>> - exit 0
>>> + # Check if the master IP address is still configured on this machine
>>> + if ! fping -S 127.0.0.1 $MASTER_IP >/dev/null 2>&1; then
>>> + # Check if the master IP address is configured on another machine
>>> + if fping $MASTER_IP >/dev/null 2>&1; then
>>> + echo "Error: master IP address configured on another machine," \
>>> + "can't shut it down." >&2
>>> + exit 1
>>>
>>
>> I'm not sure we should do the second fping. If the master ip is indeed
>> not active on the local node, should we really check other nodes? I believe
>> this script, at this level, should just return "success".
>> LGTM on the rest.
>>
>> Thanks,
>> Guido
>>
>>
>
>
> --
> Thomas Thrainer | Software Engineer | [email protected] |
>
> Google Germany GmbH
> Dienerstr. 12
> 80331 München
>
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Katherine Stephens
>
--
Thomas Thrainer | Software Engineer | [email protected] |
Google Germany GmbH
Dienerstr. 12
80331 München
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Katherine Stephens