Skip to content

Commit 0dacb2c

Browse files
Changed lease time to inifinity (#16)
* Changed lease time to inifinity * message around DHCP lease infinity Co-authored-by: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com>
1 parent 930e3c8 commit 0dacb2c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,21 @@ def write_hosts(self):
159159

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

172169
if entry['default_entry']:
173-
self.cloud.add("%s,%s,%s,%sh" % (entry['mac_address'],
170+
self.cloud.add("%s,%s,%s,%s" % (entry['mac_address'],
174171
entry['ipv4_address'],
175172
entry['host_name'],
176173
lease))
177174
else:
178175
tag = entry['ipv4_address'].replace(".", "_")
179-
self.cloud.add("%s,set:%s,%s,%s,%sh" % (entry['mac_address'],
176+
self.cloud.add("%s,set:%s,%s,%s,%s" % (entry['mac_address'],
180177
tag,
181178
entry['ipv4_address'],
182179
entry['host_name'],

0 commit comments

Comments
 (0)