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:44 UTC

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

Work arounds for how CS adds and removes hosts


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

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

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsDhcp.py   | 13 +++++--------
 .../patches/debian/config/opt/cloud/bin/cs/CsFile.py   |  3 +++
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cc0915a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 1b76b86..821444f 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -128,8 +128,9 @@ class CsDhcp(CsDataBag):
 
     def write_hosts(self):
         file = CsFile("/etc/hosts")
+        file.repopulate()
         for ip in self.hosts:
-            file.search("^%s" % ip, "%s\t%s" % (ip, self.hosts[ip]))
+            file.add("%s\t%s" % (ip, self.hosts[ip]))
         file.commit()
         if file.is_changed():
             logging.info("Updated hosts file")
@@ -138,13 +139,9 @@ class CsDhcp(CsDataBag):
 
     def add(self, entry):
         self.add_host(entry['ipv4_adress'], entry['host_name'])
-        if self.cloud.search("%s," % entry['mac_address'],
-                             "%s,%s,%s,infinite" % (entry['mac_address'],
-                                                    entry['ipv4_adress'],
-                                                    entry['host_name'])):
-                        self.changed.append({'mac': entry['mac_address'],
-                                             'ip4': entry['ipv4_adress'],
-                                             'host': entry['host_name']})
+        self.cloud.add("%s,%s,%s,infinite" % (entry['mac_address'],
+                                              entry['ipv4_adress'],
+                                              entry['host_name']))
         i = IPAddress(entry['ipv4_adress'])
         # Calculate the device
         for v in self.devinfo:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cc0915a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
index e3d11dd..6195f4e 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
@@ -53,6 +53,9 @@ class CsFile:
         self.config = []
         self.new_config = []
 
+    def repopulate(self):
+        self.new_config = []
+
     def commit(self):
         if not self.is_changed():
             return