From 9e1b366e33bd828b46d1aa54ceba36bb91dca106 Mon Sep 17 00:00:00 2001 From: Sam Tannous Date: Tue, 30 Jun 2015 13:47:08 -0400 Subject: [PATCH] ifreload causes unnecessary dhcp restart for eth0 Ticket: CM-5730 Reviewed By: roopa Testing Done: tested change on Sean and Jason's lab setup The dhcp restart on all interfaces using dhcp causes a reconnection for NTP and in addition, a recent addition of rack management packages (CM-5782) added ntp and a exit-hook script that also interrupted NTP for a second time. This patch will check for dhclient running (IPv4 and IPv6) and not restart dhcp if it's already running. --- addons/dhcp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/dhcp.py b/addons/dhcp.py index ed68466..6b9b3d2 100644 --- a/addons/dhcp.py +++ b/addons/dhcp.py @@ -23,6 +23,12 @@ class dhcp(moduleBase): self.ipcmd = None def _up(self, ifaceobj): + # if dhclient is already running do not stop and start it + if self.dhclientcmd.is_running(ifaceobj.name) or \ + self.dhclientcmd.is_running6(ifaceobj.name): + self.logger.info('dhclient already running on %s. Not restarting.' % \ + ifaceobj.name) + return try: if ifaceobj.addr_family == 'inet': # First release any existing dhclient processes