From 048c7fe5b0f38a675a8540228add59e24737e674 Mon Sep 17 00:00:00 2001 From: Tushar Patil Date: Tue, 30 Aug 2011 16:32:46 -0700 Subject: Fix for LP Bug #782364 --- nova/network/linux_net.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 57c1d0c28..73fafdfbb 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -68,6 +68,8 @@ flags.DEFINE_string('linuxnet_interface_driver', 'Driver used to create ethernet devices.') flags.DEFINE_string('linuxnet_ovs_integration_bridge', 'br-int', 'Name of Open vSwitch bridge used with linuxnet') +flags.DEFINE_bool('send_arp_for_ha', False, + 'send gratuitous ARPs for HA setup') binary_name = os.path.basename(inspect.stack()[-1][1]) @@ -404,6 +406,10 @@ def bind_floating_ip(floating_ip, check_exit_code=True): _execute('ip', 'addr', 'add', floating_ip, 'dev', FLAGS.public_interface, run_as_root=True, check_exit_code=check_exit_code) + if FLAGS.send_arp_for_ha: + _execute('sudo', 'arping', '-U', floating_ip, + '-A', '-I', FLAGS.public_interface, + '-c', 1, check_exit_code=False) def unbind_floating_ip(floating_ip): @@ -853,6 +859,10 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): if gateway: _execute('route', 'add', 'default', 'gw', gateway, run_as_root=True) + if FLAGS.send_arp_for_ha: + _execute('sudo', 'arping', '-U', gateway, + '-A', '-I', bridge, + '-c', 1, check_exit_code=False) if (err and err != "device %s is already a member of a bridge;" "can't enslave it to bridge %s.\n" % (interface, bridge)): -- cgit From 0a5365bd2a324ce3485f58e39365354ff39bfb7e Mon Sep 17 00:00:00 2001 From: Tushar Patil Date: Tue, 30 Aug 2011 17:57:05 -0700 Subject: Fix for LP Bug #782364 --- nova/network/linux_net.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 73fafdfbb..aa4bd1ea7 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -481,6 +481,10 @@ def initialize_gateway_device(dev, network_ref): check_exit_code=False) if err and err != 'RTNETLINK answers: File exists\n': raise exception.Error('Failed to add ip: %s' % err) + if FLAGS.send_arp_for_ha: + _execute('sudo', 'arping', '-U', network_ref['gateway'], + '-A', '-I', dev, + '-c', 1, check_exit_code=False) if(FLAGS.use_ipv6): _execute('ip', '-f', 'inet6', 'addr', 'change', network_ref['cidr_v6'], @@ -859,10 +863,6 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): if gateway: _execute('route', 'add', 'default', 'gw', gateway, run_as_root=True) - if FLAGS.send_arp_for_ha: - _execute('sudo', 'arping', '-U', gateway, - '-A', '-I', bridge, - '-c', 1, check_exit_code=False) if (err and err != "device %s is already a member of a bridge;" "can't enslave it to bridge %s.\n" % (interface, bridge)): -- cgit From 5579ade405ce3318d4a5d33e68e39ee76c80b27c Mon Sep 17 00:00:00 2001 From: Tushar Patil Date: Thu, 15 Sep 2011 10:05:07 -0700 Subject: Execute arping command using run_as_root=True instead of sudo --- nova/network/linux_net.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index aa4bd1ea7..83330b8ca 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -409,7 +409,7 @@ def bind_floating_ip(floating_ip, check_exit_code=True): if FLAGS.send_arp_for_ha: _execute('sudo', 'arping', '-U', floating_ip, '-A', '-I', FLAGS.public_interface, - '-c', 1, check_exit_code=False) + '-c', 1, run_as_root=True, check_exit_code=False) def unbind_floating_ip(floating_ip): @@ -484,7 +484,7 @@ def initialize_gateway_device(dev, network_ref): if FLAGS.send_arp_for_ha: _execute('sudo', 'arping', '-U', network_ref['gateway'], '-A', '-I', dev, - '-c', 1, check_exit_code=False) + '-c', 1, run_as_root=True, check_exit_code=False) if(FLAGS.use_ipv6): _execute('ip', '-f', 'inet6', 'addr', 'change', network_ref['cidr_v6'], -- cgit