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>
This commit is contained in:
Rohit Yadav 2018-01-24 11:09:45 +01:00 committed by GitHub
parent f80f00ebcb
commit 61a5a29705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,15 +49,21 @@ class CsDhcp(CsDataBag):
self.add(self.dbag[item])
self.write_hosts()
if self.cloud.is_changed():
self.delete_leases()
self.configure_server()
restart_dnsmasq = self.conf.commit()
self.cloud.commit()
restart_dnsmasq = False
if self.conf.commit():
restart_dnsmasq = True
if self.cloud.commit():
restart_dnsmasq = True
self.dhcp_opts.commit()
if restart_dnsmasq:
self.delete_leases()
if not self.cl.is_redundant() or self.cl.is_master():
if restart_dnsmasq:
CsHelper.service("dnsmasq", "restart")