You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/10/28 22:25:26 UTC

[3/4] git commit: updated refs/heads/master to 1f6781b

CLOUDSTACK-8991 - Process the IPs that have been removed


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

Branch: refs/heads/master
Commit: 7d40814ba1fdef8f7260a120b48358c8585a4570
Parents: 7197cf2
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Oct 27 19:46:48 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Wed Oct 28 19:51:57 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py |  4 +--
 .../debian/config/opt/cloud/bin/cs_ip.py        | 27 ++++++++++----------
 test/integration/smoke/test_network.py          | 10 ++++----
 3 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d40814b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 6d26de6..91ee873 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -610,8 +610,8 @@ class CsIP:
             if self.dev in bag.keys():
                 for address in bag[self.dev]:
                     self.setAddress(address)
-                    if (self.hasIP(ip) or self.is_guest_gateway(address, ip)) and addess["add"]:
-                        logging.debig("The IP address in '%s' will be configured" % address)
+                    if (self.hasIP(ip) or self.is_guest_gateway(address, ip)) and address["add"]:
+                        logging.debug("The IP address in '%s' will be configured" % address)
                         found = True
             if not found:
                 self.delete(ip)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d40814b/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
index 14003d9..efcf311 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
@@ -27,17 +27,18 @@ def merge(dbag, ip):
         for address in dbag[dev]:
             if address['public_ip'] == ip['public_ip']:
                 dbag[dev].remove(address)
-    if ip['add']:
-        ipo = IPNetwork(ip['public_ip'] + '/' + ip['netmask'])
-        ip['device'] = 'eth' + str(ip['nic_dev_id'])
-        ip['broadcast'] = str(ipo.broadcast)
-        ip['cidr'] = str(ipo.ip) + '/' + str(ipo.prefixlen)
-        ip['size'] = str(ipo.prefixlen)
-        ip['network'] = str(ipo.network) + '/' + str(ipo.prefixlen)
-        if 'nw_type' not in ip.keys():
-            ip['nw_type'] = 'public'
-        if ip['nw_type'] == 'control':
-            dbag['eth' + str(ip['nic_dev_id'])] = [ip]
-        else:
-            dbag.setdefault('eth' + str(ip['nic_dev_id']), []).append(ip)
+
+    ipo = IPNetwork(ip['public_ip'] + '/' + ip['netmask'])
+    ip['device'] = 'eth' + str(ip['nic_dev_id'])
+    ip['broadcast'] = str(ipo.broadcast)
+    ip['cidr'] = str(ipo.ip) + '/' + str(ipo.prefixlen)
+    ip['size'] = str(ipo.prefixlen)
+    ip['network'] = str(ipo.network) + '/' + str(ipo.prefixlen)
+    if 'nw_type' not in ip.keys():
+        ip['nw_type'] = 'public'
+    if ip['nw_type'] == 'control':
+        dbag['eth' + str(ip['nic_dev_id'])] = [ip]
+    else:
+        dbag.setdefault('eth' + str(ip['nic_dev_id']), []).append(ip)
+
     return dbag

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d40814b/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index a89055c..719d78a 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -1177,7 +1177,7 @@ class TestRouterRules(cloudstackTestCase):
             )
         return
 
-    def removeNetworkRules(self, rule, ipaddressobj):
+    def removeNetworkRules(self, rule):
         """ Remove specified rule on acquired public IP and
         default network of virtual machine
         """
@@ -1186,14 +1186,15 @@ class TestRouterRules(cloudstackTestCase):
         if rule == STATIC_NAT_RULE:
             StaticNATRule.disable(
                 self.apiclient,
-                ipaddressobj.ipaddress.id)
+                self.ipaddress.ipaddress.id)
 
         elif rule == LB_RULE:
             self.lb_rule.delete(self.apiclient)
         else:
             self.nat_rule.delete(self.apiclient)
 
-        ipaddressobj.delete(self.apiclient)
+        logger.debug("Releasing IP %s from account %s" % (self.ipaddress.ipaddress.ipaddress, self.account.name))
+        self.ipaddress.delete(self.apiclient)
 
         return
 
@@ -1213,7 +1214,6 @@ class TestRouterRules(cloudstackTestCase):
             domainid=self.account.domainid,
             networkid=self.defaultNetworkId
         )
-        self.cleanup.append(self.ipaddress)
 
         self.createNetworkRules(rule=value,
                                 ipaddressobj=self.ipaddress,
@@ -1247,7 +1247,7 @@ class TestRouterRules(cloudstackTestCase):
         # 1. listIpForwardingRules should not return the deleted rule anymore
         # 2. attempt to do ssh should now fail
 
-        self.removeNetworkRules(rule=value, ipaddressobj=self.ipaddress)
+        self.removeNetworkRules(rule=value)
 
         response = self.getCommandResultFromRouter(router, "ip addr")
         logger.debug(response)