Change in vdsm[master]: restore-nets: move disable_ipv6 before setupNetworks, suppor...

osvoboda at redhat.com osvoboda at redhat.com
Tue Mar 1 17:39:33 UTC 2016


Ondřej Svoboda has uploaded a new change for review.

Change subject: restore-nets: move disable_ipv6 before setupNetworks, support bridgeless
......................................................................

restore-nets: move disable_ipv6 before setupNetworks, support bridgeless

Disabling IPv6 on networks in the kernel must be done even
before actual restoration is performed because there is probably going to
be a link-local address already (or "worse", initscripts may have acquired
a global address through autoconfiguration) and thus the network's state
would differ from the persisted config, causing needless restoration.
This is implemented for unified persistence only.

Change-Id: Ic3010e4a163cb8b7622b3b7425fa8fca09d602c7
Signed-off-by: Ondřej Svoboda <osvoboda at redhat.com>
Backport-To: 3.6
---
M vdsm/vdsm-restore-net-config
1 file changed, 27 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/54226/1

diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 46cecac..fc0cb8e 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -130,6 +130,8 @@
 
     _wait_for_for_all_devices_up(
         available_config.networks.keys() + available_config.bonds.keys())
+    if ipv6_supported():
+        _restore_disable_ipv6(available_config.networks)
     changed_config = _filter_changed_nets_bonds(available_config)
     nets = changed_config.networks
     bonds = changed_config.bonds
@@ -139,8 +141,6 @@
                       'and bond (%s).', nets, bonds)
         setupNetworks(nets, bonds, {'connectivityCheck': False,
                                     '_inRollback': True})
-    if ipv6_supported():
-        _restore_disable_ipv6(available_config.networks)
 
 
 def _verify_all_devices_are_up(owned_ifcfg_files):
@@ -350,16 +350,35 @@
                not l.oper_up)
 
 
+def _get_topmost_network_device(net, net_attrs):
+    if net_attrs.get('bridged'):
+        return net
+    vlan_name = net_attrs.get('vlan')
+    if vlan_name:
+        return vlan_name
+    bonding_or_nic = net_attrs.get('bonding') or net_attrs.get('nic')
+    vlan_id = net_attrs.get('vlan_id')
+    if vlan_id:
+        return '{}.{}'.format(bonding_or_nic, vlan_id)
+    else:
+        return bonding_or_nic
+
+
 def _restore_disable_ipv6(networks):
     """
-    Disable IPv6 on bridges with no IPv6 configuration, after networks have
-    been restored. This is implemented for unified persistence only.
+    Disable IPv6 on networks with no IPv6 configuration. This must be done even
+    before actual restoration is performed because there is probably going to
+    be a link-local address already (or "worse", initscripts may have acquired
+    a global address through autoconfiguration) and thus the network's state
+    would differ from the persisted config, causing needless restoration.
+    This is implemented for unified persistence only.
     """
-    for net, net_attr in six.iteritems(networks):
-        if net_attr.get('bridged') and not net_attr.get('ipv6addr') and not (
-                net_attr.get('ipv6autoconf')) and not net_attr.get('dhcpv6'):
+    for net, net_attrs in six.iteritems(networks):
+        if not net_attrs.get('ipv6addr') and not (
+                net_attrs.get('ipv6autoconf')) and not net_attrs.get('dhcpv6'):
             # _wait_for_for_all_devices_up has already run, so assuming up
-            sysctl.disable_ipv6(net)
+            topmost_device = _get_topmost_network_device(net, net_attrs)
+            sysctl.disable_ipv6(topmost_device)
 
 
 def _owned_ifcfg(link_name):


-- 
To view, visit https://gerrit.ovirt.org/54226
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3010e4a163cb8b7622b3b7425fa8fca09d602c7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>


More information about the vdsm-patches mailing list