mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
vr: Ensuring dnsmasq.leases file is populated (#4529)
This commit is contained in:
parent
96cfe27504
commit
4d33e159f7
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user