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:24 UTC
[1/4] git commit: updated refs/heads/master to 1f6781b
Repository: cloudstack
Updated Branches:
refs/heads/master da9063e7d -> 1f6781bab
CLOUDSTACK-8991 - Make sure the public IP is removed form the router before checking
- Adding proper logger to the tests
- Changing message that was copied/pasted from another assert
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/99318caa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/99318caa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/99318caa
Branch: refs/heads/master
Commit: 99318caa67f25932b652ea53c1742b6c1e5b0927
Parents: f241455
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Oct 27 19:45:34 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 27 19:45:34 2015 +0100
----------------------------------------------------------------------
test/integration/smoke/test_network.py | 56 ++++++++++++++++-------------
1 file changed, 32 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99318caa/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 05dd67a..a89055c 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -50,9 +50,14 @@ from nose.plugins.attrib import attr
from ddt import ddt, data
# Import System modules
import time
+import logging
_multiprocess_shared_ = True
+logger = logging.getLogger('TestNetworkOps')
+stream_handler = logging.StreamHandler()
+logger.setLevel(logging.DEBUG)
+logger.addHandler(stream_handler)
class TestPublicIP(cloudstackTestCase):
@@ -390,7 +395,7 @@ class TestPortForwarding(cloudstackTestCase):
)
# SSH virtual machine to test port forwarding
try:
- self.debug("SSHing into VM with IP address %s with NAT IP %s" %
+ logger.debug("SSHing into VM with IP address %s with NAT IP %s" %
(
self.virtual_machine.ipaddress,
src_nat_ip_addr.ipaddress
@@ -424,7 +429,7 @@ class TestPortForwarding(cloudstackTestCase):
# Check if the Public SSH port is inaccessible
with self.assertRaises(Exception):
- self.debug(
+ logger.debug(
"SSHing into VM with IP address %s after NAT rule deletion" %
self.virtual_machine.ipaddress)
@@ -518,7 +523,7 @@ class TestPortForwarding(cloudstackTestCase):
)
try:
- self.debug("SSHing into VM with IP address %s with NAT IP %s" %
+ logger.debug("SSHing into VM with IP address %s with NAT IP %s" %
(
self.virtual_machine.ipaddress,
ip_address.ipaddress.ipaddress
@@ -538,11 +543,11 @@ class TestPortForwarding(cloudstackTestCase):
id=nat_rule.id
)
except CloudstackAPIException:
- self.debug("Nat Rule is deleted")
+ logger.debug("Nat Rule is deleted")
# Check if the Public SSH port is inaccessible
with self.assertRaises(Exception):
- self.debug(
+ logger.debug(
"SSHing into VM with IP address %s after NAT rule deletion" %
self.virtual_machine.ipaddress)
@@ -673,8 +678,8 @@ class TestRebootRouter(cloudstackTestCase):
# Retrieve router for the user account
- self.debug("Public IP: %s" % self.vm_1.ssh_ip)
- self.debug("Public IP: %s" % self.public_ip.ipaddress.ipaddress)
+ logger.debug("Public IP: %s" % self.vm_1.ssh_ip)
+ logger.debug("Public IP: %s" % self.public_ip.ipaddress.ipaddress)
routers = list_routers(
self.apiclient,
account=self.account.name,
@@ -688,7 +693,7 @@ class TestRebootRouter(cloudstackTestCase):
router = routers[0]
- self.debug("Rebooting the router (ID: %s)" % router.id)
+ logger.debug("Rebooting the router (ID: %s)" % router.id)
cmd = rebootRouter.rebootRouterCmd()
cmd.id = router.id
@@ -710,7 +715,7 @@ class TestRebootRouter(cloudstackTestCase):
vm = list_vm_response[0]
if vm.state == 'Running':
- self.debug("VM state: %s" % vm.state)
+ logger.debug("VM state: %s" % vm.state)
break
if timeout == 0:
@@ -722,7 +727,7 @@ class TestRebootRouter(cloudstackTestCase):
# we should be able to SSH after successful reboot
try:
- self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id)
+ logger.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id)
SshClient(
self.public_ip.ipaddress.ipaddress,
@@ -825,7 +830,7 @@ class TestReleaseIP(cloudstackTestCase):
def test_releaseIP(self):
"""Test for release public IP address"""
- self.debug("Deleting Public IP : %s" % self.ip_addr.id)
+ logger.debug("Deleting Public IP : %s" % self.ip_addr.id)
self.ip_address.delete(self.apiclient)
@@ -854,9 +859,9 @@ class TestReleaseIP(cloudstackTestCase):
self.apiclient,
id=self.nat_rule.id
)
- self.debug("List NAT Rule response" + str(list_nat_rule))
+ logger.debug("List NAT Rule response" + str(list_nat_rule))
except CloudstackAPIException:
- self.debug("Port Forwarding Rule is deleted")
+ logger.debug("Port Forwarding Rule is deleted")
# listLoadBalancerRules should not list
# associated rules with Public IP address
@@ -865,9 +870,9 @@ class TestReleaseIP(cloudstackTestCase):
self.apiclient,
id=self.lb_rule.id
)
- self.debug("List LB Rule response" + str(list_lb_rule))
+ logger.debug("List LB Rule response" + str(list_lb_rule))
except CloudstackAPIException:
- self.debug("Port Forwarding Rule is deleted")
+ logger.debug("Port Forwarding Rule is deleted")
# SSH Attempt though public IP should fail
with self.assertRaises(Exception):
@@ -982,7 +987,7 @@ class TestDeleteAccount(cloudstackTestCase):
domainid=self.account.domainid
)
except CloudstackAPIException:
- self.debug("Port Forwarding Rule is deleted")
+ logger.debug("Port Forwarding Rule is deleted")
# ListPortForwardingRules should not
# list associated rules with deleted account
@@ -993,7 +998,7 @@ class TestDeleteAccount(cloudstackTestCase):
domainid=self.account.domainid
)
except CloudstackAPIException:
- self.debug("NATRule is deleted")
+ logger.debug("NATRule is deleted")
# Retrieve router for the user account
try:
@@ -1008,7 +1013,7 @@ class TestDeleteAccount(cloudstackTestCase):
"Check routers are properly deleted."
)
except CloudstackAPIException:
- self.debug("Router is deleted")
+ logger.debug("Router is deleted")
except Exception as e:
raise Exception(
@@ -1187,6 +1192,9 @@ class TestRouterRules(cloudstackTestCase):
self.lb_rule.delete(self.apiclient)
else:
self.nat_rule.delete(self.apiclient)
+
+ ipaddressobj.delete(self.apiclient)
+
return
@data(STATIC_NAT_RULE, NAT_RULE, LB_RULE)
@@ -1216,13 +1224,13 @@ class TestRouterRules(cloudstackTestCase):
listall=True)[0]
response = self.getCommandResultFromRouter(router, "ip addr")
- self.debug(response)
+ logger.debug(response)
stringToMatch = "inet %s" % self.ipaddress.ipaddress.ipaddress
self.assertTrue(stringToMatch in str(response), "IP address is\
- not removed from VR even after disabling statin NAT")
+ not added to the VR!")
try:
- self.debug("SSHing into VM with IP address %s with NAT IP %s" %
+ logger.debug("SSHing into VM with IP address %s with NAT IP %s" %
(
self.virtual_machine.ipaddress,
self.ipaddress.ipaddress.ipaddress
@@ -1242,14 +1250,14 @@ class TestRouterRules(cloudstackTestCase):
self.removeNetworkRules(rule=value, ipaddressobj=self.ipaddress)
response = self.getCommandResultFromRouter(router, "ip addr")
- self.debug(response)
+ logger.debug(response)
stringToMatch = "inet %s" % self.ipaddress.ipaddress.ipaddress
self.assertFalse(stringToMatch in str(response), "IP address is\
- not removed from VR even after disabling statin NAT")
+ not removed from VR even after disabling stat in NAT")
# Check if the Public SSH port is inaccessible
with self.assertRaises(Exception):
- self.debug(
+ logger.debug(
"SSHing into VM with IP address %s after NAT rule deletion" %
self.virtual_machine.ipaddress)
[2/4] git commit: updated refs/heads/master to 1f6781b
Posted by re...@apache.org.
CLOUDSTACK-8991 - Remove public IP form interface in case add = false
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7197cf2e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7197cf2e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7197cf2e
Branch: refs/heads/master
Commit: 7197cf2e24a02dbc5cd4c1964e7c8baadc112340
Parents: 99318ca
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Oct 27 19:46:13 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 27 19:46:13 2015 +0100
----------------------------------------------------------------------
.../debian/config/opt/cloud/bin/cs/CsAddress.py | 23 +++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7197cf2e/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 b80187a..6d26de6 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -103,6 +103,7 @@ class CsAddress(CsDataBag):
for address in self.dbag[dev]:
ip.setAddress(address)
+ logging.info("Address found in DataBag ==> %s" % address)
if ip.configured():
logging.info(
@@ -263,10 +264,17 @@ class CsIP:
return self.address
def configure(self, address):
- logging.info(
- "Configuring address %s on device %s", self.ip(), self.dev)
- cmd = "ip addr add dev %s %s brd +" % (self.dev, self.ip())
- subprocess.call(cmd, shell=True)
+ # When "add" is false, it means that the IP has to be removed.
+ if address["add"]:
+ try:
+ logging.info("Configuring address %s on device %s", self.ip(), self.dev)
+ cmd = "ip addr add dev %s %s brd +" % (self.dev, self.ip())
+ subprocess.call(cmd, shell=True)
+ except Exception as e:
+ logging.info("Exception occurred ==> %s" % e)
+
+ else:
+ self.delete(self.ip())
self.post_configure(address)
def post_configure(self, address):
@@ -602,9 +610,8 @@ class CsIP:
if self.dev in bag.keys():
for address in bag[self.dev]:
self.setAddress(address)
- if self.hasIP(ip):
- found = True
- if self.is_guest_gateway(address, ip):
+ 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)
found = True
if not found:
self.delete(ip)
@@ -620,7 +627,7 @@ class CsIP:
gw = interface.get_gateway()
logging.info("Interface has the following gateway ==> %s", gw)
-
+
if bag['nw_type'] == "guest" and rip == gw:
return True
return False
[4/4] git commit: updated refs/heads/master to 1f6781b
Posted by re...@apache.org.
Merge pull request #989 from ekholabs/fix/cleanup_vr_ips-CLOUDSTACK-8991
CLOUDSTACK-8991 - IP address is not removed from VR even after disabling static NATThis PR fixes the Public IP removal form the virtual routers. It also improves the existing test_network.py.
* pr/989:
CLOUDSTACK-8991 - Process the IPs that have been removed
CLOUDSTACK-8991 - Remove public IP form interface in case add = false
CLOUDSTACK-8991 - Make sure the public IP is removed form the router before checking
Signed-off-by: Remi Bergsma <gi...@remi.nl>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f6781ba
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f6781ba
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f6781ba
Branch: refs/heads/master
Commit: 1f6781babcab7c999cefd67337d16c00d2c0e256
Parents: da9063e 7d40814
Author: Remi Bergsma <gi...@remi.nl>
Authored: Wed Oct 28 22:24:40 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Wed Oct 28 22:24:40 2015 +0100
----------------------------------------------------------------------
.../debian/config/opt/cloud/bin/cs/CsAddress.py | 23 ++++---
.../debian/config/opt/cloud/bin/cs_ip.py | 27 +++++----
test/integration/smoke/test_network.py | 64 +++++++++++---------
3 files changed, 65 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
[3/4] git commit: updated refs/heads/master to 1f6781b
Posted by re...@apache.org.
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)