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

Change subject: network: add 'default_route' parameter to DhcpClient
......................................................................

network: add 'default_route' parameter to DhcpClient

Non-ifcfg configurators handle 'default_route' option only with
static IPs, but this should be allowed with dynamic as well.

This patch enhances DhcpClient so it is able to disable standard
default gateway overwriting.

Change-Id: Ia4c3a7c5598f2a7b10670415714d980113bc72ae
Signed-off-by: Petr Horáček <phora...@redhat.com>
---
M vdsm/network/configurators/dhclient.py
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/43900/1

diff --git a/vdsm/network/configurators/dhclient.py 
b/vdsm/network/configurators/dhclient.py
index d71b5ff..222d902 100644
--- a/vdsm/network/configurators/dhclient.py
+++ b/vdsm/network/configurators/dhclient.py
@@ -42,9 +42,11 @@
     LEASE_FILE = os.path.join(LEASE_DIR, 'dhclient{0}--{1}.lease')
     DHCLIENT = CommandPath('dhclient', '/sbin/dhclient')
 
-    def __init__(self, iface, family=4, cgroup=DHCLIENT_CGROUP):
+    def __init__(self, iface, family=4, default_route=True,
+                 cgroup=DHCLIENT_CGROUP):
         self.iface = iface
         self.family = family
+        self.default_route = default_route
         self.pidFile = self.PID_FILE % (family, self.iface)
         if not os.path.exists(self.LEASE_DIR):
             os.mkdir(self.LEASE_DIR)
@@ -58,6 +60,9 @@
             kill_dhclient(self.iface, self.family)
         cmd = [self.DHCLIENT.cmd, '-%s' % self.family, '-1', '-pf',
                self.pidFile, '-lf', self.leaseFile, self.iface]
+        if not self.default_route:
+            # Instruct Fedora/EL's dhclient-script not to set gateway on iface
+            cmd += ['-e', 'DEFROUTE=no']
         cmd = cmdutils.systemd_run(cmd, scope=True, slice=self._cgroup)
         rc, out, err = execCmd(cmd)
         return rc, out, err


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4c3a7c5598f2a7b10670415714d980113bc72ae
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phora...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to