You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/03/17 11:26:43 UTC

[41/50] git commit: updated refs/heads/master to 3c429ee

Check both ip and hosts when building dhcp bag


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/748e2e51
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/748e2e51
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/748e2e51

Branch: refs/heads/master
Commit: 748e2e51a9ead7be4047e112aad2ed07a3d7a2c9
Parents: c1ec5b0
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Feb 18 18:36:59 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:08 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs_dhcp.py  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/748e2e51/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
index 64d8f8d..d9f30e5 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
@@ -21,6 +21,7 @@ from netaddr import *
 
 def merge(dbag, data):
 
+    search(dbag, data['host_name'])
     # A duplicate ip address wil clobber the old value
     # This seems desirable ....
     if "add" in data and data['add'] is False and \
@@ -31,3 +32,18 @@ def merge(dbag, data):
     else:
         dbag[data['ipv4_adress']] = data
     return dbag
+
+
+def search(dbag, name):
+    """
+    Dirty hack because CS does not deprovision hosts
+    """
+    hosts = []
+    for o in dbag:
+        if o == 'id':
+            continue
+        print "%s %s" % (dbag[o]['host_name'], name)
+        if dbag[o]['host_name'] == name:
+            hosts.append(o)
+    for o in hosts:
+        del(dbag[o])