Skip to content

Commit e8d418c

Browse files
router: Fix dhcp infinite lease time (#3913)
The previous setup of many hours would not work, due to some internal dnsmasq issues - lease was set correclty, but dnsmasq was setting the dhcp-renew-time (and rebind time) to less than 2 years from the date the lease was issued. Using "infinite" as the value (instead of the number) works as expected - and (atm) the renew date is set to year 2088, etc. Co-authored-by: dahn <daan.hoogland@gmail.com>
1 parent 7e30e3d commit e8d418c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,18 @@ def write_hosts(self):
174174

175175
def add(self, entry):
176176
self.add_host(entry['ipv4_address'], entry['host_name'])
177-
# Lease time set to effectively infinite (36000+ days) since we properly control all DHCP/DNS config via CloudStack.
177+
# Lease time set to "infinite" since we properly control all DHCP/DNS config via CloudStack.
178178
# Infinite time helps avoid some edge cases which could cause DHCPNAK being sent to VMs since
179179
# (RHEL) system lose routes when they receive DHCPNAK.
180180
# When VM is expunged, its active lease and DHCP/DNS config is properly removed from related files in VR,
181181
# so the infinite duration of lease does not cause any issues or garbage.
182-
# There will be soon a PR which also regenerates the /var/lib/misc/dnsmasq.leases (active lease DB file)
183-
# in the new VR (when restarting network with cleanup), which will help around RHEL edge cases (described above)
184-
# for the VMs who are already running in productions systems with 30d lease time.
185-
lease = randint(870000, 870010)
182+
lease = 'infinite'
186183

187184
if entry['default_entry']:
188-
self.cloud.add("%s,%s,%s,%sh" % (entry['mac_address'],
189-
entry['ipv4_address'],
190-
entry['host_name'],
191-
lease))
185+
self.cloud.add("%s,%s,%s,%s" % (entry['mac_address'],
186+
entry['ipv4_address'],
187+
entry['host_name'],
188+
lease))
192189
else:
193190
tag = entry['ipv4_address'].replace(".", "_")
194191
self.cloud.add("%s,set:%s,%s,%s,%sh" % (entry['mac_address'],

0 commit comments

Comments
 (0)