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

Change subject: net: call address.flush explicitly after dhclient.kill
......................................................................

net: call address.flush explicitly after dhclient.kill

Change-Id: I7c03ce4917174a78fc97f216ceac6e8c92d82de8
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Petr Horáček <[email protected]>
---
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/network/ip/dhclient.py
M vdsm_hooks/ovs/ovs_before_network_setup_ip.py
3 files changed, 6 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/60155/1

diff --git a/lib/vdsm/network/configurators/ifcfg.py 
b/lib/vdsm/network/configurators/ifcfg.py
index 45d293c..8c49607 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -45,8 +45,8 @@
 
 from vdsm.network import ipwrapper
 from vdsm.network import libvirt
+from vdsm.network.ip import address
 from vdsm.network.ip import dhclient
-from vdsm.network.ip.address import IPv4, IPv6
 from vdsm.network.netconfpersistence import RunningConfig, PersistentConfig
 from vdsm.network.netinfo import (bonding as netinfo_bonding, mtus, nics,
                                   vlans, misc, NET_PATH)
@@ -222,8 +222,8 @@
             self.configApplier.removeBonding(bonding.name)
             if bonding.on_removal_just_detach_from_network:
                 # Recreate the bond with ip and master info cleared
-                bonding.ipv4 = IPv4()
-                bonding.ipv6 = IPv6()
+                bonding.ipv4 = address.IPv4()
+                bonding.ipv6 = address.IPv6()
                 bonding.master = None
                 bonding.configure()
             else:
@@ -533,6 +533,7 @@
                     os.path.exists(os.path.join(NET_PATH, name))):
                 # Ask dhclient to stop any dhclient running for the device
                 dhclient.kill(name)
+                address.flush(name, family=4)
         if mtu:
             cfg += 'MTU=%d\n' % mtu
         if ipv4.defaultRoute is not None:
diff --git a/lib/vdsm/network/ip/dhclient.py b/lib/vdsm/network/ip/dhclient.py
index 27ac95d..631e918 100644
--- a/lib/vdsm/network/ip/dhclient.py
+++ b/lib/vdsm/network/ip/dhclient.py
@@ -28,7 +28,6 @@
 
 from vdsm import cmdutils
 from vdsm.network import errors as ne
-from vdsm.network import ipwrapper
 from vdsm.network import netinfo
 from vdsm.commands import execCmd
 from vdsm.utils import CommandPath, memoized, pgrep, kill_and_rm_pid
@@ -117,12 +116,6 @@
         logging.info('Stopping dhclient -%s before running our own on %s',
                      family, device_name)
         kill_and_rm_pid(pid, pid_file)
-
-    #  In order to be able to configure the device with dhclient again. It is
-    #  necessary that dhclient does not find it configured with any IP address
-    #  (except 0.0.0.0 which is fine, or IPv6 link-local address needed for
-    #   DHCPv6).
-    ipwrapper.addrFlush(device_name, family)
 
 
 @memoized
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py 
b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
index 7943960..d015385 100644
--- a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
@@ -128,8 +128,9 @@
 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)):
-        dhclient.kill(iface, family=4)  # kill_dhclient flushes IP
+        dhclient.kill(iface, family=4)
         dhclient.kill(iface, family=6)
+        address.flush(iface)
 
 
 def configure_ip(nets, init_nets, bonds, init_bonds):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c03ce4917174a78fc97f216ceac6e8c92d82de8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to