gildegoma commented on a change in pull request #3351: [WIP: DO NOT MERGE] Fix
not persistent DHCP leases file on VRs
URL: https://github.com/apache/cloudstack/pull/3351#discussion_r288455419
##########
File path: systemvm/debian/opt/cloud/bin/cs/CsDhcp.py
##########
@@ -114,8 +114,23 @@ def configure_server(self):
idx += 1
def delete_leases(self):
+ macs_dhcphosts = []
try:
- open(LEASES, 'w').close()
+ logging.info("Attempting to delete entries from dnsmasq.leases
file for VMs which are not on dhcphosts file")
+ for host in open(DHCP_HOSTS):
+ macs_dhcphosts.append(host.split(',')[0])
+
+ removed = 0
+ for leaseline in open(LEASES):
+ lease = leaseline.split(' ')
+ mac = lease[1]
+ ip = lease[2]
+ if mac not in macs_dhcphosts:
+ cmd = "dhcp_release %s %s" % (ip, mac)
Review comment:
@nvazquez the dhcp_release `<interface>` parameter is missing here
See https://manpages.debian.org/stretch/dnsmasq-utils/dhcp_release.1.en.html
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services