Change in vdsm[master]: hooks: ovs: rename _set/drop/remove_ip_config functions

phoracek at redhat.com phoracek at redhat.com
Thu Dec 10 14:39:21 UTC 2015


Petr Horáček has uploaded a new change for review.

Change subject: hooks: ovs: rename _set/drop/remove_ip_config functions
......................................................................

hooks: ovs: rename _set/drop/remove_ip_config functions

Make difference between _drop_ip_config, _remove_ip_config and
_set_ip_config more explicit by renaming and adding extra comments.

Change-Id: I0489b7679577e2e038d46f025db75168986f3a49
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M vdsm_hooks/ovs/ovs_before_network_setup_ip.py
1 file changed, 11 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/50260/1

diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
index 6599ed6..3d8912e 100644
--- a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
@@ -66,7 +66,8 @@
         log('failed to start dhclient%s on iface %s' % (family, iface))
 
 
-def _set_ip_config(ip_config):
+def _set_network_ip_config(ip_config):
+    """Set IP configuration on Vdsm controlled OVS network"""
     iface = ip_config.top_dev
     ipv4 = ip_config.ipv4
     ipv6 = ip_config.ipv6
@@ -100,7 +101,8 @@
     iproute2._addSourceRoute(net_dev)
 
 
-def _remove_ip_config(ip_config):
+def _remove_network_ip_config(ip_config):
+    """Remove IP configuration from Vdsm controlled OVS network"""
     iface = ip_config.top_dev
     ipv4 = ip_config.ipv4
     ipv6 = ip_config.ipv6
@@ -114,8 +116,8 @@
             ipwrapper.addrFlush(iface)
 
 
-def _drop_ip_config(iface):
-    """Remove IP configuration of a new nic controlled by VDSM"""
+def _drop_nic_ip_config(iface):
+    """Drop IP configuration of a new nic controlled by VDSM"""
     if os.path.exists(os.path.join('/sys/class/net', iface)):
         kill_dhclient(iface, family=4)  # kill_dhclient flushes IP
         kill_dhclient(iface, family=6)
@@ -146,7 +148,7 @@
 
                 # drop IP of newly attached nics
                 if init_nets[net].get('nic') != attrs.get('nic') is not None:
-                    _drop_ip_config(attrs.get('nic'))
+                    _drop_nic_ip_config(attrs.get('nic'))
 
                 # if IP config is to be changed or network's top device was
                 # changed, remove initial IP configuration and set the new one
@@ -162,7 +164,7 @@
                 # drop IP of newly attached nics
                 nic = attrs.get('nic')
                 if nic is not None:
-                    _drop_ip_config(nic)
+                    _drop_nic_ip_config(nic)
 
                 # set networks IP configuration if any
                 if ip_config.ipv4 or ip_config.ipv6:
@@ -175,11 +177,11 @@
                 set(attrs.get('nics')) - set(init_bonds[bond].get('nics'))
                 if bond in init_bonds else attrs.get('nics'))
             for nic in nics_to_drop_ip_from:
-                _drop_ip_config(nic)
+                _drop_nic_ip_config(nic)
 
     log('Remove IP configuration of: %s' % ip_config_to_remove)
     log('Set IP configuration: %s' % ip_config_to_set)
     for iface, ip_config in six.iteritems(ip_config_to_remove):
-        _remove_ip_config(ip_config)
+        _remove_network_ip_config(ip_config)
     for iface, ip_config in six.iteritems(ip_config_to_set):
-        _set_ip_config(ip_config)
+        _set_network_ip_config(ip_config)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0489b7679577e2e038d46f025db75168986f3a49
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>


More information about the vdsm-patches mailing list