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

Change subject: networkTests: Make DEFROUTE controllable so the system's 
gateway is preserved
......................................................................

networkTests: Make DEFROUTE controllable so the system's gateway is preserved

testSetupNetworksAddDelDhcp, a test on a veth pair (with dnsmasq and
a VDSM-invoked dhclient), has recently been adapted to account for source
routing. Other two tests using dhclient directly however result in
the replacement of the system's default route.

Fix this situation on Fedora and RHEL by instructing their dhclient-script
not to set the gateway on the veth.

Change-Id: I0c0210b188feec45d151060d5cadaefe1ed6dc99
Signed-off-by: Ondřej Svoboda <[email protected]>
---
M tests/functional/dhcp.py
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/35701/1

diff --git a/tests/functional/dhcp.py b/tests/functional/dhcp.py
index d36c0c5..9d7bf28 100644
--- a/tests/functional/dhcp.py
+++ b/tests/functional/dhcp.py
@@ -78,16 +78,20 @@
     In the working directory (tmp_dir), which is managed by the caller.
     dhclient accepts the following date_formats: 'default' and 'local'.
     """
-    def __init__(self, interface, tmp_dir, date_format):
+    def __init__(self, interface, tmp_dir, date_format, default_route=False):
         self._interface = interface
         self._date_format = date_format
         self._conf_file = os.path.join(tmp_dir, 'test.conf')
         self._pid_file = os.path.join(tmp_dir, 'test.pid')
         self.pid = None
         self.lease_file = os.path.join(tmp_dir, 'test.lease')
-        self._cmd = (_DHCLIENT_BINARY.cmd, '-v', '-lf', self.lease_file, '-pf',
-                     self._pid_file, '-timeout', str(_DHCLIENT_TIMEOUT), '-1',
-                     '-cf', self._conf_file, self._interface)
+        cmd = [_DHCLIENT_BINARY.cmd, '-v', '-1',
+               '-cf', self._conf_file, '-pf', self._pid_file,
+               '-lf', self.lease_file, '-timeout', str(_DHCLIENT_TIMEOUT)]
+        if not default_route:
+            # Instruct Fedora/EL's dhclient-script not to set gateway on iface
+            cmd += ['-e', 'DEFROUTE=no']
+        self._cmd = cmd + [self._interface]
 
     def _create_conf(self):
         with open(self._conf_file, 'w') as f:


-- 
To view, visit http://gerrit.ovirt.org/35701
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c0210b188feec45d151060d5cadaefe1ed6dc99
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to