You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2021/02/05 12:41:09 UTC

[cloudstack] branch 4.14 updated: VR: fix expunging vm will remove dhcp entries of another vm in VR (#4627)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.14 by this push:
     new d62d5c6  VR: fix expunging vm will remove dhcp entries of another vm in VR (#4627)
d62d5c6 is described below

commit d62d5c6cd23daeb922e5c6f64399cc30596c15a3
Author: Wei Zhou <w....@global.leaseweb.com>
AuthorDate: Fri Feb 5 13:40:53 2021 +0100

    VR: fix expunging vm will remove dhcp entries of another vm in VR (#4627)
    
    Steps to reproduce the issue
    
    (1) create two vm wei-001 and wei-002, start them
    
    (2) check /etc/cloudstack/dhcpentry.json and /etc/dhcphosts.txt in VR
    They have entries for both of wei-001 and wei-002
    
    (3) stop wei-002, and restart VR (or restart network with cleanup).
    check /etc/cloudstack/dhcpentry.json and /etc/dhcphosts.txt in VR
    They have entries for wei-001 only (as wei-002 is stopped)
    
    (4) expunge wei-002. when it is done,
    check /etc/cloudstack/dhcpentry.json and /etc/dhcphosts.txt in VR
    They do not have entries for wei-001.
    VR health check fails at dhcp_check.py and dns_check.py
---
 systemvm/debian/opt/cloud/bin/cs_dhcp.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/systemvm/debian/opt/cloud/bin/cs_dhcp.py b/systemvm/debian/opt/cloud/bin/cs_dhcp.py
index bb2ff7b..d949981 100755
--- a/systemvm/debian/opt/cloud/bin/cs_dhcp.py
+++ b/systemvm/debian/opt/cloud/bin/cs_dhcp.py
@@ -28,13 +28,10 @@ def merge(dbag, data):
     else:
         remove_keys = set()
         for key, entry in dbag.iteritems():
-            if key != 'id' and entry['mac_address'] == data['mac_address']:
+            if key != 'id' and entry['mac_address'] == data['mac_address'] and data['remove']:
                 remove_keys.add(key)
                 break
 
-        if data['remove'] and key not in remove_keys:
-            remove_keys.add(key)
-
         for remove_key in remove_keys:
             del(dbag[remove_key])