Change in vdsm[master]: dhclient: use the same modern names for leases as initscript...

osvoboda at redhat.com osvoboda at redhat.com
Wed May 27 13:21:22 UTC 2015


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

Change subject: dhclient: use the same modern names for leases as initscripts do
......................................................................

dhclient: use the same modern names for leases as initscripts do

This affects iproute2 and pyroute2 configurators which run their own
dhclients directly.

Functional tests failed with both configurators because DHCPv4 lease files
were never deleted as they contained a superfluous '4' in the name, which
initscripts never had.

(I added the 4s long before we realized we need to delete leases created
by tests – so there would be no misdetection of DHCPv4/6 based on leases
left behind by previous runs of the same test).

Change-Id: I3520c258785dccb93ca126092b2ed5d4d7735b4b
Signed-off-by: Ondřej Svoboda <osvoboda at redhat.com>
---
M vdsm/network/configurators/dhclient.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/41509/1

diff --git a/vdsm/network/configurators/dhclient.py b/vdsm/network/configurators/dhclient.py
index f6db491..cfbc7d5 100644
--- a/vdsm/network/configurators/dhclient.py
+++ b/vdsm/network/configurators/dhclient.py
@@ -35,7 +35,7 @@
 class DhcpClient(object):
     PID_FILE = '/var/run/dhclient%s-%s.pid'
     LEASE_DIR = '/var/lib/dhclient'
-    LEASE_FILE = os.path.join(LEASE_DIR, 'dhclient%s-%s.leases')
+    LEASE_FILE = os.path.join(LEASE_DIR, 'dhclient{0}--{1}.lease')
     DHCLIENT = CommandPath('dhclient', '/sbin/dhclient')
 
     def __init__(self, iface, family=4):
@@ -44,7 +44,8 @@
         self.pidFile = self.PID_FILE % (family, self.iface)
         if not os.path.exists(self.LEASE_DIR):
             os.mkdir(self.LEASE_DIR)
-        self.leaseFile = self.LEASE_FILE % (family, self.iface)
+        self.leaseFile = self.LEASE_FILE.format(
+            '' if family == 4 else '6', self.iface)
 
     def _dhclient(self):
         # Ask dhclient to stop any dhclient running for the device


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3520c258785dccb93ca126092b2ed5d4d7735b4b
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