Commit aee0edd9 authored by Wido den Hollander's avatar Wido den Hollander

cloudstack: Only use DHCPv4 lease files as a datasource

It could be that there are also 'dhclient6.leases' files in /var/lib/dhcp
when DHCPv6 is used next to DHCPv4.

This patch makes sure we only read from DHCPv4 lease files
parent b029dcef
......@@ -206,7 +206,8 @@ def get_latest_lease():
latest_mtime = -1
latest_file = None
for file_name in lease_files:
if file_name.endswith(".lease") or file_name.endswith(".leases"):
if file_name.startswith("dhclient.") and \
(file_name.endswith(".lease") or file_name.endswith(".leases")):
abs_path = os.path.join(lease_d, file_name)
mtime = os.path.getmtime(abs_path)
if mtime > latest_mtime:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment