This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push: new e01dd89 CLOUDSTACK-10217: Clean up old MAC addresses from DHCP lease file (#2393) e01dd89 is described below commit e01dd89c930b6218e0062becf20e0dc594d00569 Author: Wido den Hollander <w...@widodh.nl> AuthorDate: Tue Jan 9 20:11:55 2018 +0100 CLOUDSTACK-10217: Clean up old MAC addresses from DHCP lease file (#2393) When the IPv4 address of a Instance changes we need to make sure the old entry is removed from the DHCP lease file on the Virtual Router otherwise the Instance will still get the old lease. Signed-off-by: Wido den Hollander <w...@widodh.nl> --- systemvm/debian/opt/cloud/bin/cs_dhcp.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/systemvm/debian/opt/cloud/bin/cs_dhcp.py b/systemvm/debian/opt/cloud/bin/cs_dhcp.py index b85e650..88b4b75 100755 --- a/systemvm/debian/opt/cloud/bin/cs_dhcp.py +++ b/systemvm/debian/opt/cloud/bin/cs_dhcp.py @@ -25,12 +25,18 @@ def merge(dbag, data): if data['ipv4_address'] in dbag: del(dbag[data['ipv4_address']]) else: - remove_key = None + remove_keys = set() for key, entry in dbag.iteritems(): if key != 'id' and entry['host_name'] == data['host_name']: - remove_key = key + remove_keys.add(key) break - if remove_key is not None: + + for key, entry in dbag.iteritems(): + if key != 'id' and entry['mac_address'] == data['mac_address']: + remove_keys.add(key) + break + + for remove_key in remove_keys: del(dbag[remove_key]) dbag[data['ipv4_address']] = data -- To stop receiving notification emails like this one, please contact ['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].