From d0ad539f831d9aef7a7d7d653ff0537f47264852 Mon Sep 17 00:00:00 2001 From: Teresa Ho Date: Fri, 13 Sep 2019 13:33:02 -0400 Subject: [PATCH] Disable duplicate address detection when using duplex-direct In a duplex-direct configuration, the physical mgmt and cluster-host link on controller-0 will be down until controller-1 comes up. In an IPv6 configuration, this results in dad not completing, so the addresses stay tentative. This commit disables duplicate address detection on the mgmt and cluster-host interface if the system is configured as duplex-direct. If the interface is a bonded interface, the interface is added to the bonding masters list before the DAD is disabled. Closes-Bug: 1836969 Change-Id: I0e169904445db905729fce77e4afa2ba2052598b Signed-off-by: Teresa Ho --- .../sysinv/sysinv/sysinv/puppet/interface.py | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py index 38d489ca31..525764d50c 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py @@ -787,6 +787,27 @@ def get_bridge_network_config(context, iface): return config +def get_duplex_direct_network_config(context, iface, config, network_id=None): + """ + Disable dad on duplex-direct interfaces + """ + networktype = find_networktype_by_network_id(context, network_id) + if (networktype and networktype in [constants.NETWORK_TYPE_MGMT, + constants.NETWORK_TYPE_CLUSTER_HOST]): + if iface['iftype'] == constants.INTERFACE_TYPE_VLAN: + sysctl_ifname = config['ifname'].replace('.', '/') + else: + sysctl_ifname = iface['ifname'] + new_pre_up = "sysctl -wq net.ipv6.conf.%s.accept_dad=0" % sysctl_ifname + old_pre_up = config['options'].get('pre_up') + if old_pre_up: + new_pre_up = "%s ; %s" % (old_pre_up, new_pre_up) + options = {'pre_up': new_pre_up} + config['options'].update(options) + + return config + + def get_vlan_network_config(context, iface, config): """ Augments a basic config dictionary with the attributes specific to a VLAN @@ -818,7 +839,7 @@ def get_bond_interface_options(iface, primary_iface): return options -def get_bond_network_config(context, iface, config): +def get_bond_network_config(context, iface, config, network_id): """ Augments a basic config dictionary with the attributes specific to a bond interface. @@ -829,6 +850,11 @@ def get_bond_network_config(context, iface, config): if bonding_options: options['BONDING_OPTS'] = bonding_options options['up'] = 'sleep 10' + networktype = find_networktype_by_network_id(context, network_id) + if (networktype and networktype in [constants.NETWORK_TYPE_MGMT, + constants.NETWORK_TYPE_CLUSTER_HOST]): + options['pre_up'] = "/sbin/modprobe bonding; echo +%s > /sys/class/net/bonding_masters" % ( + iface['ifname']) config['options'].update(options) return config @@ -1018,10 +1044,16 @@ def get_interface_network_config(context, iface, network_id=None): if iface['iftype'] == constants.INTERFACE_TYPE_VLAN: config = get_vlan_network_config(context, iface, config) elif iface['iftype'] == constants.INTERFACE_TYPE_AE: - config = get_bond_network_config(context, iface, config) + config = get_bond_network_config(context, iface, config, + network_id) else: config = get_ethernet_network_config(context, iface, config) + # add duplex_direct + if context['system_mode'] == constants.SYSTEM_MODE_DUPLEX_DIRECT: + config = get_duplex_direct_network_config(context, iface, config, + network_id) + return config