diff --git a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py index ef1a52dec1c..2c0deea4abe 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py @@ -40,6 +40,7 @@ class CsDhcp(CsDataBag): self.cloud = CsFile(DHCP_HOSTS) self.dhcp_opts = CsFile(DHCP_OPTS) self.conf = CsFile(CLOUD_CONF) + self.dhcp_leases = CsFile(LEASES) self.cloud.repopulate() self.dhcp_opts.repopulate() @@ -60,6 +61,9 @@ class CsDhcp(CsDataBag): if self.cloud.commit(): restart_dnsmasq = True + if self.dhcp_leases.commit(): + restart_dnsmasq = True + self.dhcp_opts.commit() if restart_dnsmasq: @@ -186,6 +190,9 @@ class CsDhcp(CsDataBag): entry['ipv4_address'], entry['host_name'], lease)) + self.dhcp_leases.search(entry['mac_address'], "0 %s %s %s *" % (entry['mac_address'], + entry['ipv4_address'], + entry['host_name'])) else: tag = entry['ipv4_address'].replace(".", "_") self.cloud.add("%s,set:%s,%s,%s,%s" % (entry['mac_address'], @@ -196,6 +203,9 @@ class CsDhcp(CsDataBag): self.dhcp_opts.add("%s,%s" % (tag, 3)) self.dhcp_opts.add("%s,%s" % (tag, 6)) self.dhcp_opts.add("%s,%s" % (tag, 15)) + self.dhcp_leases.search(entry['mac_address'], "0 %s %s %s *" % (entry['mac_address'], + entry['ipv4_address'], + entry['host_name'])) i = IPAddress(entry['ipv4_address']) # Calculate the device