Skip to content

Commit 61a5a29

Browse files
authored
CLOUDSTACK-10252: Delete dnsmasq leases file on restart (#2427)
Delete dnsmasq's leases file when dnsmasq is restarted to avoid it use old ip-mac-address-vm mapping leases. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent f80f00e commit 61a5a29

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

systemvm/debian/opt/cloud/bin/cs/CsDhcp.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,21 @@ def process(self):
4949
self.add(self.dbag[item])
5050
self.write_hosts()
5151

52-
if self.cloud.is_changed():
53-
self.delete_leases()
54-
5552
self.configure_server()
5653

57-
restart_dnsmasq = self.conf.commit()
58-
self.cloud.commit()
54+
restart_dnsmasq = False
55+
56+
if self.conf.commit():
57+
restart_dnsmasq = True
58+
59+
if self.cloud.commit():
60+
restart_dnsmasq = True
61+
5962
self.dhcp_opts.commit()
6063

64+
if restart_dnsmasq:
65+
self.delete_leases()
66+
6167
if not self.cl.is_redundant() or self.cl.is_master():
6268
if restart_dnsmasq:
6369
CsHelper.service("dnsmasq", "restart")

0 commit comments

Comments
 (0)