From fcdc2cc52979e74c6a67c765251c429bf354e90f Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Thu, 29 Sep 2016 22:41:34 +0530 Subject: [PATCH 01/16] CLOUDSTACK-9511: fix test_privategw_acl.py to handle multiple physical networks modified script to handle case where there can be multple physical networks in the zone Signed-off-by: Rohit Yadav --- test/integration/smoke/test_privategw_acl.py | 62 +++++++++++++------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py index d2e08f57d39..3b9e0a70d71 100644 --- a/test/integration/smoke/test_privategw_acl.py +++ b/test/integration/smoke/test_privategw_acl.py @@ -195,8 +195,9 @@ class TestPrivateGwACL(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.dbclient = self.testClient.getDbConnection() self.hypervisor = self.testClient.getHypervisorInfo() - + self.logger.debug("Creating Admin Account for Domain ID ==> %s" % self.domain.id) self.account = Account.create( self.apiclient, @@ -236,12 +237,16 @@ class TestPrivateGwACL(cloudstackTestCase): self.cleanup = [vpc, vpc_off, self.account] - physical_networks = get_physical_networks(self.apiclient, self.zone.id) - if not physical_networks: + physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id) + if not physical_network: self.fail("No Physical Networks found!") - vlans = physical_networks[0].vlan.split('-') - vlan_1 = int(vlans[0]) + qresultset = self.dbclient.execute( + "select vnet from op_dc_vnet_alloc where physical_network_id=\ + (select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_network.id + ) + vlans = qresultset + vlan_1 = int(vlans[0][0]) acl = self.createACL(vpc) self.createACLItem(acl.id) @@ -304,12 +309,16 @@ class TestPrivateGwACL(cloudstackTestCase): self.cleanup = [vpc_1, vpc_2, vpc_off, self.account] - physical_networks = get_physical_networks(self.apiclient, self.zone.id) - if not physical_networks: + physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id) + if not physical_network: self.fail("No Physical Networks found!") - vlans = physical_networks[0].vlan.split('-') - vlan_1 = int(vlans[0]) + qresultset = self.dbclient.execute( + "select vnet from op_dc_vnet_alloc where physical_network_id=\ + (select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id + ) + vlans = qresultset + vlan_1 = int(vlans[0][0]) network_1 = self.createNetwork(vpc_1, gateway = '10.0.1.1') network_2 = self.createNetwork(vpc_2, gateway = '10.0.2.1') @@ -356,12 +365,15 @@ class TestPrivateGwACL(cloudstackTestCase): self.cleanup = [vpc_1, vpc_off, self.account] - physical_networks = get_physical_networks(self.apiclient, self.zone.id) - if not physical_networks: + physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id) + if not physical_network: self.fail("No Physical Networks found!") - - vlans = physical_networks[0].vlan.split('-') - vlan_1 = int(vlans[0]) + qresultset = self.dbclient.execute( + "select vnet from op_dc_vnet_alloc where physical_network_id=\ + (select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_network.id + ) + vlans = qresultset + vlan_1 = int(vlans[0][0]) net_offering_no_lb = "network_offering_no_lb" @@ -392,7 +404,7 @@ class TestPrivateGwACL(cloudstackTestCase): public_ip_1 = self.acquire_publicip(vpc_1, network_1) nat_rule_1 = self.create_natrule(vpc_1, vm1, public_ip_1, network_1) - + self.check_private_gateway_interfaces() self.check_pvt_gw_connectivity(vm1, public_ip_1, [vm2.nic[0].ipaddress, vm3.nic[0].ipaddress, vm4.nic[0].ipaddress]) @@ -573,14 +585,14 @@ class TestPrivateGwACL(cloudstackTestCase): return obj_network def createPvtGw(self, vpc, ip_address, gateway, aclId, vlan): - physical_networks = get_physical_networks(self.apiclient, self.zone.id) - if not physical_networks: + physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id) + if not physical_network: self.fail("No Physical Networks found!") - self.logger.debug('::: Physical Networks ::: ==> %s' % physical_networks) + self.logger.debug('::: Physical Networks ::: ==> %s' % physical_network) createPrivateGatewayCmd = createPrivateGateway.createPrivateGatewayCmd() - createPrivateGatewayCmd.physicalnetworkid = physical_networks[0].id + createPrivateGatewayCmd.physicalnetworkid = physical_network.id createPrivateGatewayCmd.gateway = gateway createPrivateGatewayCmd.netmask = "255.255.255.0" createPrivateGatewayCmd.ipaddress = ip_address @@ -691,13 +703,13 @@ class TestPrivateGwACL(cloudstackTestCase): self.logger.debug("Ping to VM inside another Network Tier") result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 received"))) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (virtual_machine, e) ) - succeeded_pings += result.count("3 packets received") + succeeded_pings += result.count("3 received") self.assertTrue(succeeded_pings >= minimum_vms_to_pass, @@ -831,3 +843,11 @@ class TestPrivateGwACL(cloudstackTestCase): if cnts[vals.index(status_to_check)] != expected_count: self.fail("Expected '%s' routers at state '%s', but found '%s'!" % (expected_count, status_to_check, cnts[vals.index(status_to_check)])) + + def get_guest_traffic_physical_network(self, apiclient, zoneid): + physical_networks = get_physical_networks(apiclient, zoneid) + if not physical_networks: + return None + for physical_network in physical_networks: + if physical_network.vlan: + return physical_network From 7a1efd687e31e26f5b687d43c320751610a0aeab Mon Sep 17 00:00:00 2001 From: Boris Date: Thu, 29 Sep 2016 18:57:58 +0300 Subject: [PATCH 02/16] CLOUDSTACK-9514: Making the credentials of the host to be picked up from the Use config file, instead of hardcoded crendentials Signed-off-by: Rohit Yadav --- test/integration/smoke/test_network.py | 5 +++-- test/integration/smoke/test_password_server.py | 7 +++---- test/integration/smoke/test_primary_storage.py | 3 +++ test/integration/smoke/test_privategw_acl.py | 7 +++---- test/integration/smoke/test_router_dhcphosts.py | 8 +++----- .../smoke/test_routers_iptables_default_policy.py | 12 ++++++------ 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index 719d78afa88..bb1e14b5d14 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -1039,6 +1039,7 @@ class TestRouterRules(cloudstackTestCase): cls.domain = get_domain(cls.apiclient) cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) cls.hypervisor = testClient.getHypervisorInfo() + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ template = get_template( cls.apiclient, cls.zone.id, @@ -1117,8 +1118,8 @@ class TestRouterRules(cloudstackTestCase): "Check for list hosts response return valid data" ) host = hosts[0] - host.user = self.services["configurableData"]["host"]["username"] - host.passwd = self.services["configurableData"]["host"]["password"] + host.user = self.hostConfig['username'] + host.passwd = self.hostConfig['password'] result = get_process_status( host.ipaddress, diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py index 0fc7e258d58..c10478fe590 100644 --- a/test/integration/smoke/test_password_server.py +++ b/test/integration/smoke/test_password_server.py @@ -64,6 +64,7 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): cls.testClient = super(TestIsolatedNetworksPasswdServer, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -141,8 +142,6 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): cls.services["configurableData"] = { "host": { - "password": "password", - "username": "root", "port": 22 }, "input": "INPUT", @@ -202,8 +201,8 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): "Check for list hosts response return valid data") host = hosts[0] - host.user = self.services["configurableData"]["host"]["username"] - host.passwd = self.services["configurableData"]["host"]["password"] + host.user = self.hostConfig['username'] + host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] try: diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py index 82212255540..b1759a50582 100644 --- a/test/integration/smoke/test_primary_storage.py +++ b/test/integration/smoke/test_primary_storage.py @@ -157,6 +157,9 @@ class TestPrimaryStorageServices(cloudstackTestCase): if self.hypervisor.lower() in ["kvm","hyperv", "vmware", "lxc"]: raise self.skipTest("iscsi primary storage not supported on kvm, VMWare, Hyper-V, or LXC") + if not self.services["configurableData"]["iscsi"]["url"]: + raise self.skipTest("iscsi test storage url not setup, skipping") + # Validate the following: # 1. List Clusters # 2. verify that the cluster is in 'Enabled' allocation state diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py index 3b9e0a70d71..4946dfa2312 100644 --- a/test/integration/smoke/test_privategw_acl.py +++ b/test/integration/smoke/test_privategw_acl.py @@ -36,8 +36,6 @@ class Services: self.services = { "configurableData": { "host": { - "password": "password", - "username": "root", "port": 22 } }, @@ -172,6 +170,7 @@ class TestPrivateGwACL(cloudstackTestCase): cls.zone.id, cls.services["ostype"]) + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -747,8 +746,8 @@ class TestPrivateGwACL(cloudstackTestCase): "Check for list hosts response return valid data") host = hosts[0] - host.user = self.services["configurableData"]["host"]["username"] - host.passwd = self.services["configurableData"]["host"]["password"] + host.user = self.hostConfig['username'] + host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] try: diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index 4c2ec4ce57e..1681674a289 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -74,7 +74,7 @@ class TestRouterDHCPHosts(cloudstackTestCase): cls.zone.id, cls.services["ostype"] ) - + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, cls.zone.id)) @@ -143,8 +143,6 @@ class TestRouterDHCPHosts(cloudstackTestCase): cls.services["configurableData"] = { "host": { - "password": "password", - "username": "root", "port": 22 }, "input": "INPUT", @@ -211,8 +209,8 @@ class TestRouterDHCPHosts(cloudstackTestCase): "Check for list hosts response return valid data") host = hosts[0] - host.user = self.services["configurableData"]["host"]["username"] - host.passwd = self.services["configurableData"]["host"]["password"] + host.user = self.hostConfig['username'] + host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] #mac1,10.7.32.101,infinite try: diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py index a1bec4cac36..26072072a64 100644 --- a/test/integration/smoke/test_routers_iptables_default_policy.py +++ b/test/integration/smoke/test_routers_iptables_default_policy.py @@ -54,8 +54,6 @@ class Services: self.services = { "configurableData": { "host": { - "password": "password", - "username": "root", "port": 22 }, "input": "INPUT", @@ -220,6 +218,7 @@ class TestVPCIpTablesPolicies(cloudstackTestCase): cls.apiclient, cls.zone.id, cls.services["ostype"]) + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -312,8 +311,8 @@ class TestVPCIpTablesPolicies(cloudstackTestCase): "Check for list hosts response return valid data") host = hosts[0] - host.user = self.services["configurableData"]["host"]["username"] - host.passwd = self.services["configurableData"]["host"]["password"] + host.user = self.hostConfig['username'] + host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]] @@ -360,6 +359,7 @@ class TestRouterIpTablesPolicies(cloudstackTestCase): cls.zone.id, cls.services["ostype"]) + cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id @@ -428,8 +428,8 @@ class TestRouterIpTablesPolicies(cloudstackTestCase): "Check for list hosts response return valid data") host = hosts[0] - host.user = self.services["configurableData"]["host"]["username"] - host.passwd = self.services["configurableData"]["host"]["password"] + host.user = self.hostConfig['username'] + host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]] From 47104cf2b359800be55b34a546a7085a67add86b Mon Sep 17 00:00:00 2001 From: Paul Angus Date: Mon, 26 Sep 2016 12:08:41 +0100 Subject: [PATCH 03/16] fix ping tests to properly recognise successful ping test --- test/integration/smoke/test_password_server.py | 4 ++-- test/integration/smoke/test_router_dhcphosts.py | 4 ++-- test/integration/smoke/test_routers_network_ops.py | 8 ++++---- test/integration/smoke/test_vpc_redundant.py | 4 ++-- test/integration/smoke/test_vpc_router_nics.py | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py index c10478fe590..a85bd5488b1 100644 --- a/test/integration/smoke/test_password_server.py +++ b/test/integration/smoke/test_password_server.py @@ -180,12 +180,12 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5) result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except: self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress)) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index 1681674a289..c90599bfc38 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -188,12 +188,12 @@ class TestRouterDHCPHosts(cloudstackTestCase): ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5) result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except: self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress)) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py index 94c07742ad1..a15150d40a2 100644 --- a/test/integration/smoke/test_routers_network_ops.py +++ b/test/integration/smoke/test_routers_network_ops.py @@ -270,7 +270,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): # Test SSH after closing port 22 expected = 1 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( @@ -434,7 +434,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): expected = 0 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( @@ -822,7 +822,7 @@ class TestIsolatedNetworks(cloudstackTestCase): # Test SSH after closing port 22 expected = 1 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( @@ -977,7 +977,7 @@ class TestIsolatedNetworks(cloudstackTestCase): expected = 0 ssh_command = "ping -c 3 8.8.8.8" - check_string = "3 packets received" + check_string = " 0% packet loss" result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self) self.assertEqual( diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index fbaa5b96e6c..9e4038a32d6 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -695,14 +695,14 @@ class TestVPCRedundancy(cloudstackTestCase): self.logger.debug("Ping to google.com from VM") result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (vmObj.get_ip(), e) ) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py index cb0734d9930..39a92144438 100644 --- a/test/integration/smoke/test_vpc_router_nics.py +++ b/test/integration/smoke/test_vpc_router_nics.py @@ -464,14 +464,14 @@ class TestVPCNics(cloudstackTestCase): self.logger.debug("Ping to google.com from VM") result = str(ssh.execute(ssh_command)) - self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received"))) + self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss"))) except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (vmObj.get_ip(), e) ) self.assertEqual( - result.count("3 packets received"), + result.count(" 0% packet loss"), 1, "Ping to outside world from VM should be successful" ) From 99da5338ff0b36be8cb139927e00782c15d1a235 Mon Sep 17 00:00:00 2001 From: Paul Angus Date: Fri, 30 Sep 2016 13:16:29 +0530 Subject: [PATCH 04/16] fix macchinina template specificied for vmware in Marvin tests - Fix macchnina template url - Fix a variable scope issue Signed-off-by: Rohit Yadav --- test/integration/smoke/test_internal_lb.py | 2 +- test/integration/smoke/test_vpc_vpn.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index c4be42b6702..b378db9a4c2 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -254,7 +254,7 @@ class Services: "format": "ova", "hypervisor": "vmware", "ostype": "Other PV (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.vmdk.bz2", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", "requireshvm": "True", } } diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index af74e6f18f6..3811514dea0 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -253,7 +253,7 @@ class Services: "format": "ova", "hypervisor": "vmware", "ostype": "Other PV (64-bit)", - "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.vmdk.bz2", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", "requireshvm": "True", } } @@ -320,6 +320,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): self.assert_(vpcOffering is not None and len( vpcOffering) > 0, "No VPC offerings found") + vpc = None try: vpc = VPC.create( apiclient=self.apiclient, From 79f0adf3974e45ad416a50e0fc24ae6f529eff62 Mon Sep 17 00:00:00 2001 From: Paul Angus Date: Fri, 30 Sep 2016 13:17:30 +0530 Subject: [PATCH 05/16] Marvin Tests: Fix VPC network offering selection Signed-off-by: Rohit Yadav --- test/integration/smoke/test_network_acl.py | 2 +- test/integration/smoke/test_vpc_vpn.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py index 909da7e1e0b..734c312977e 100644 --- a/test/integration/smoke/test_network_acl.py +++ b/test/integration/smoke/test_network_acl.py @@ -64,7 +64,7 @@ class TestNetworkACL(cloudstackTestCase): self.assert_(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering") # 1) Create VPC - vpcOffering = VpcOffering.list(self.apiclient,isdefault=True) + vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering") self.assert_(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found") self.services["vpc"] = {} self.services["vpc"]["name"] = "vpc-networkacl" diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index 3811514dea0..698cda7276a 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -316,7 +316,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): networkOffering) > 0, "No VPC based network offering") # 1) Create VPC - vpcOffering = VpcOffering.list(self.apiclient, isdefault=True) + vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering") self.assert_(vpcOffering is not None and len( vpcOffering) > 0, "No VPC offerings found") From 0eb4fae8b7e6f48a961d424b1f168c277bc82c78 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 30 Sep 2016 15:12:37 +0530 Subject: [PATCH 06/16] CLOUDSTACK-9161: move quota test to plugins The quota integration test requires special setup and is moved to plugins directory as in 4.9 and master branch. Signed-off-by: Rohit Yadav --- test/integration/{smoke => plugins}/test_quota.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/integration/{smoke => plugins}/test_quota.py (100%) diff --git a/test/integration/smoke/test_quota.py b/test/integration/plugins/test_quota.py similarity index 100% rename from test/integration/smoke/test_quota.py rename to test/integration/plugins/test_quota.py From 052a9af0235134ea0256993345662a21a7d4e809 Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Thu, 29 Sep 2016 21:47:15 +0530 Subject: [PATCH 07/16] CLOUDSTACK-9515: internal LB vm is not handled when parsing cmd_line.json, resulting in internal LB vm not come up parsing cmd_line to create 'ips' data bag, never handled internal lb vm, but still worked due to another bug. support for internal lb vm is added with this fix --- systemvm/patches/debian/config/opt/cloud/bin/merge.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/systemvm/patches/debian/config/opt/cloud/bin/merge.py b/systemvm/patches/debian/config/opt/cloud/bin/merge.py index aa676827adb..76c0ffb8c02 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/merge.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/merge.py @@ -207,6 +207,10 @@ class updateDataBag: elif (self.qFile.data['cmd_line']['type'] == "dhcpsrvr"): self.processCLItem('0', "guest") self.processCLItem('1', "control") + elif (self.qFile.data['cmd_line']['type'] == "ilbvm"): + self.processCLItem('0', "guest") + self.processCLItem('1', "control") + return cs_cmdline.merge(dbag, self.qFile.data) def processCLItem(self, num, nw_type): From d4f0bf1ca92205f1838d68ec022d62450675a669 Mon Sep 17 00:00:00 2001 From: Boris Date: Mon, 3 Oct 2016 13:57:15 +0300 Subject: [PATCH 08/16] CLOUDSTACK-9526: Marvin test_deploy_vgpu_enabled_vm.py - Fix a hardcoded username and password Signed-off-by: Rohit Yadav --- test/integration/smoke/test_deploy_vgpu_enabled_vm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py index c9eb7672e2d..9b638a9d40b 100644 --- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py +++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py @@ -49,6 +49,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase): testClient = super(TestDeployvGPUenabledVM, self).getClsTestClient() self.apiclient = testClient.getApiClient() self.testdata = self.testClient.getParsedTestDataConfig() + self.hostConfig = self.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ self._cleanup = [] self.unsupportedHypervisor = False self.noSuitableHost = False @@ -69,8 +70,8 @@ class TestDeployvGPUenabledVM(cloudstackTestCase): sshClient = SshClient( host=ghost.ipaddress, port=self.testdata['configurableData']['host']["publicport"], - user=self.testdata['configurableData']['host']["username"], - passwd=self.testdata['configurableData']['host']["password"]) + user=self.hostConfig['username'], + passwd=self.hostConfig['password']) if ghost.hypervisorversion == "6.2.0": res = sshClient.execute( "xe patch-list uuid=0850b186-4d47-11e3-a720-001b2151a503") From 1f27874eaf0d1d8cb793527bd5b12cd262e3de2e Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Fri, 30 Sep 2016 16:59:12 +0530 Subject: [PATCH 09/16] CLOUDSTACK-9522: Check for available attribute in marvin response - Handle case where physical network instance does not have vlan attribute - Handle case where listIso response may not have status attribute Signed-off-by: Rohit Yadav --- .../smoke/test_non_contigiousvlan.py | 15 +++-- tools/marvin/marvin/lib/base.py | 55 +++++++++---------- tools/marvin/marvin/lib/common.py | 2 + 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py index e4446180688..c7a5467b110 100644 --- a/test/integration/smoke/test_non_contigiousvlan.py +++ b/test/integration/smoke/test_non_contigiousvlan.py @@ -47,9 +47,17 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase): self.assertNotEqual(len(phy_networks), 0, msg="There are no physical networks in the zone") - self.network = phy_networks[0] - self.networkid = phy_networks[0].id - self.existing_vlan = phy_networks[0].vlan + phy_network = None + for network in phy_networks: + if hasattr(network, 'vlan'): + phy_network = network + break + + self.assert_(phy_network is not None, msg="No network with vlan found") + + self.network = phy_network + self.networkid = phy_network.id + self.existing_vlan = phy_network.vlan vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0] updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1) self.assert_(updatePhysicalNetworkResponse is not None, @@ -65,7 +73,6 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase): vlanranges= updatePhysicalNetworkResponse2.vlan self.assert_(vlanranges is not None, "No VLAN ranges found on the deployment") - self.assert_(str(vlanranges) == vlan2, "vlan ranges are not extended") def tearDown(self): diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 835613d701f..91e7fdcee21 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -1237,43 +1237,45 @@ class Template: cmd.zoneid = zoneid apiclient.deleteTemplate(cmd) - def download(self, apiclient, timeout=5, interval=60): + def download(self, apiclient, retries=300, interval=5): """Download Template""" - # Sleep to ensure template is in proper state before download - time.sleep(interval) - - while True: + while retries > -1: + time.sleep(interval) template_response = Template.list( apiclient, id=self.id, zoneid=self.zoneid, templatefilter='self' ) - if isinstance(template_response, list): + if isinstance(template_response, list): template = template_response[0] + if retries >=0 and not hasattr(template, 'status'): + retries = retries - 1 + continue + # If template is ready, # template.status = Download Complete # Downloading - x% Downloaded # Error - Any other string - if template.status == 'Download Complete': - break + if template.status == 'Download Complete' and template.isready: + return elif 'Downloaded' in template.status: - time.sleep(interval) + retries = retries - 1 + continue elif 'Installing' not in template.status: + if retries >= 0: + retries = retries - 1 + continue raise Exception( "Error in downloading template: status - %s" % template.status) - elif timeout == 0: - break - else: - time.sleep(interval) - timeout = timeout - 1 - return + retries = retries - 1 + raise Exception("Template download failed exception") def updatePermissions(self, apiclient, **kwargs): """Updates the template permissions""" @@ -1376,11 +1378,10 @@ class Iso: apiclient.deleteIso(cmd) return - def download(self, apiclient, timeout=5, interval=60): + def download(self, apiclient, retries=300, interval=5): """Download an ISO""" # Ensuring ISO is successfully downloaded - retry = 1 - while True: + while retries > -1: time.sleep(interval) cmd = listIsos.listIsosCmd() @@ -1389,26 +1390,24 @@ class Iso: if isinstance(iso_response, list): response = iso_response[0] - # Again initialize timeout to avoid listISO failure - timeout = 5 + if retries >= 0 and not hasattr(response, 'status'): + retries = retries - 1 + continue # Check whether download is in progress(for Ex:10% Downloaded) # or ISO is 'Successfully Installed' - if response.status == 'Successfully Installed': + if response.status == 'Successfully Installed' and response.isready: return elif 'Downloaded' not in response.status and \ 'Installing' not in response.status: - if retry == 1: - retry = retry - 1 + if retries >= 0: + retries = retries - 1 continue raise Exception( "Error In Downloading ISO: ISO Status - %s" % response.status) - - elif timeout == 0: - raise Exception("ISO download Timeout Exception") else: - timeout = timeout - 1 - return + retries = retries - 1 + raise Exception("ISO download failed exception") @classmethod def extract(cls, apiclient, id, mode, zoneid=None): diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py index 5f738f4bf91..d1b872a953a 100644 --- a/tools/marvin/marvin/lib/common.py +++ b/tools/marvin/marvin/lib/common.py @@ -1056,6 +1056,8 @@ def setNonContiguousVlanIds(apiclient, zoneid): list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid for physical_network in list_physical_networks_response: + if not hasattr(physical_network, 'vlan'): + continue vlans = xsplit(physical_network.vlan, ['-', ',']) From dc932687888aa068ff4d4e657a76c07cff26cd90 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 3 Oct 2016 16:00:05 +0530 Subject: [PATCH 10/16] CLOUDSTACK-9524: Check router hypervisor before ssh to VR SSH to VR for vmware, goes via the mgmt server and uses ssh keys at /var/cloudstack path. Add suitable checks to tests failing on vmware. Signed-off-by: Rohit Yadav --- .../integration/smoke/test_password_server.py | 36 ++++++---- test/integration/smoke/test_privategw_acl.py | 49 +++++++++---- .../smoke/test_router_dhcphosts.py | 35 ++++++---- .../test_routers_iptables_default_policy.py | 68 +++++++++++++------ 4 files changed, 127 insertions(+), 61 deletions(-) diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py index a85bd5488b1..98c5ced19f1 100644 --- a/test/integration/smoke/test_password_server.py +++ b/test/integration/smoke/test_password_server.py @@ -169,6 +169,7 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() return def test_ssh_command(self, vm, nat_rule, rule_label): @@ -204,20 +205,31 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase): host.user = self.hostConfig['username'] host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] - - try: + + if self.hypervisor.lower() in ('vmware', 'hyperv'): result = get_process_status( - host.ipaddress, - host.port, - host.user, - host.passwd, + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, router.linklocalip, - "cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress)) - except KeyError: - self.skipTest( - "Provide a marvin config file with host\ - credentials to run %s" % - self._testMethodName) + "cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress), + hypervisor=self.hypervisor + ) + else: + try: + result = get_process_status( + host.ipaddress, + host.port, + host.user, + host.passwd, + router.linklocalip, + "cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress)) + except KeyError: + self.skipTest( + "Provide a marvin config file with host\ + credentials to run %s" % + self._testMethodName) self.logger.debug("cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}' RESULT IS ==> %s" % (vm.nic[0].gateway, vm.nic[0].ipaddress, result)) res = str(result) diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py index 4946dfa2312..9d39bdb2a6b 100644 --- a/test/integration/smoke/test_privategw_acl.py +++ b/test/integration/smoke/test_privategw_acl.py @@ -750,24 +750,43 @@ class TestPrivateGwACL(cloudstackTestCase): host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] - try: + if self.hypervisor.lower() in ('vmware', 'hyperv'): state = get_process_status( - host.ipaddress, - host.port, - host.user, - host.passwd, - router.linklocalip, - "ip addr | grep eth6 | grep state | awk '{print $9;}'") + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, + router.linklocalip, + "ip addr | grep eth6 | grep state | awk '{print $9;}'", + hypervisor=self.hypervisor) mac = get_process_status( - host.ipaddress, - host.port, - host.user, - host.passwd, - router.linklocalip, - "ip addr | grep link/ether | awk '{print $2;}' | sed -n 7p") - except KeyError: - self.skipTest("Provide a marvin config file with host credentials to run %s" % self._testMethodName) + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, + router.linklocalip, + "ip addr | grep link/ether | awk '{print $2;}' | sed -n 7p", + hypervisor=self.hypervisor) + else: + try: + state = get_process_status( + host.ipaddress, + host.port, + host.user, + host.passwd, + router.linklocalip, + "ip addr | grep eth6 | grep state | awk '{print $9;}'") + + mac = get_process_status( + host.ipaddress, + host.port, + host.user, + host.passwd, + router.linklocalip, + "ip addr | grep link/ether | awk '{print $2;}' | sed -n 7p") + except KeyError: + self.skipTest("Provide a marvin config file with host credentials to run %s" % self._testMethodName) state = str(state[0]) mac = str(mac[0]) diff --git a/test/integration/smoke/test_router_dhcphosts.py b/test/integration/smoke/test_router_dhcphosts.py index c90599bfc38..4e619542003 100644 --- a/test/integration/smoke/test_router_dhcphosts.py +++ b/test/integration/smoke/test_router_dhcphosts.py @@ -169,6 +169,7 @@ class TestRouterDHCPHosts(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.cleanup = [] return @@ -212,20 +213,30 @@ class TestRouterDHCPHosts(cloudstackTestCase): host.user = self.hostConfig['username'] host.passwd = self.hostConfig['password'] host.port = self.services["configurableData"]["host"]["port"] - #mac1,10.7.32.101,infinite - try: + + if self.hypervisor.lower() in ('vmware', 'hyperv'): result = get_process_status( - host.ipaddress, - host.port, - host.user, - host.passwd, + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, router.linklocalip, - "cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}'" % (vm.nic[0].ipaddress)) - except KeyError: - self.skipTest( - "Provide a marvin config file with host\ - credentials to run %s" % - self._testMethodName) + "cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}'" % (vm.nic[0].ipaddress), + hypervisor=self.hypervisor) + else: + try: + result = get_process_status( + host.ipaddress, + host.port, + host.user, + host.passwd, + router.linklocalip, + "cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}'" % (vm.nic[0].ipaddress)) + except KeyError: + self.skipTest( + "Provide a marvin config file with host\ + credentials to run %s" % + self._testMethodName) self.logger.debug("cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}' RESULT IS ==> %s" % (vm.nic[0].ipaddress, result)) res = str(result) diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py index 26072072a64..ec35396017b 100644 --- a/test/integration/smoke/test_routers_iptables_default_policy.py +++ b/test/integration/smoke/test_routers_iptables_default_policy.py @@ -253,6 +253,7 @@ class TestVPCIpTablesPolicies(cloudstackTestCase): return def setUp(self): + self.hypervisor = self.testClient.getHypervisorInfo() self.logger.debug("Creating a VPC offering.") self.vpc_off = VpcOffering.create( self.apiclient, @@ -317,19 +318,30 @@ class TestVPCIpTablesPolicies(cloudstackTestCase): tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]] for table in tables: - try: + result = None + if self.hypervisor.lower() in ('vmware', 'hyperv'): result = get_process_status( - host.ipaddress, - host.port, - host.user, - host.passwd, + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, router.linklocalip, - 'iptables -L %s' % table) - except KeyError: - self.skipTest( - "Provide a marvin config file with host\ - credentials to run %s" % - self._testMethodName) + 'iptables -L %s' % table, + hypervisor=self.hypervisor) + else: + try: + result = get_process_status( + host.ipaddress, + host.port, + host.user, + host.passwd, + router.linklocalip, + 'iptables -L %s' % table) + except KeyError: + self.skipTest( + "Provide a marvin config file with host\ + credentials to run %s" % + self._testMethodName) self.logger.debug("iptables -L %s: %s" % (table, result)) res = str(result) @@ -392,6 +404,7 @@ class TestRouterIpTablesPolicies(cloudstackTestCase): return def setUp(self): + self.hypervisor = self.testClient.getHypervisorInfo() self.cleanup = [] self.entity_manager.set_cleanup(self.cleanup) return @@ -434,19 +447,30 @@ class TestRouterIpTablesPolicies(cloudstackTestCase): tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]] for table in tables: - try: + result = None + if self.hypervisor.lower() in ('vmware', 'hyperv'): result = get_process_status( - host.ipaddress, - host.port, - host.user, - host.passwd, + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, router.linklocalip, - 'iptables -L %s' % table) - except KeyError: - self.skipTest( - "Provide a marvin config file with host\ - credentials to run %s" % - self._testMethodName) + 'iptables -L %s' % table, + hypervisor=self.hypervisor) + else: + try: + result = get_process_status( + host.ipaddress, + host.port, + host.user, + host.passwd, + router.linklocalip, + 'iptables -L %s' % table) + except KeyError: + self.skipTest( + "Provide a marvin config file with host\ + credentials to run %s" % + self._testMethodName) self.logger.debug("iptables -L %s: %s" % (table, result)) res = str(result) From 394f2e359f2af9de6c7e586659fed47051f44146 Mon Sep 17 00:00:00 2001 From: Boris Date: Mon, 3 Oct 2016 17:53:51 +0300 Subject: [PATCH 11/16] CLOUDSTACK-9527: Skip tests not supported for hypervisor - test_01_test_vm_volume_snapshot not supported for Xen, tests keep failing - Skip snapshot tests for centos6/kvm as snapshot is not supported by older qemu-img versions Signed-off-by: Rohit Yadav --- test/integration/smoke/test_snapshots.py | 2 +- test/integration/smoke/test_vm_snapshots.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 4b1fcbd526f..7cd56c8ff72 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -47,7 +47,7 @@ class TestSnapshotRootDisk(cloudstackTestCase): cls.hypervisorNotSupported = False cls.hypervisor = cls.testClient.getHypervisorInfo() - if cls.hypervisor.lower() in ['hyperv', 'lxc']: + if cls.hypervisor.lower() in ['hyperv', 'lxc'] or 'kvm-centos6' in cls.testClient.getZoneForTests(): cls.hypervisorNotSupported = True cls._cleanup = [] diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py index 3831848225c..d173aa4d329 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -16,7 +16,7 @@ # under the License. # Import Local Modules -from marvin.codes import FAILED, KVM, PASS +from marvin.codes import FAILED, KVM, PASS, XEN_SERVER from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.utils import random_gen, cleanup_resources, validateList, is_snapshot_on_nfs @@ -291,7 +291,7 @@ class TestSnapshots(cloudstackTestCase): cls.services = cls.testClient.getParsedTestDataConfig() cls.unsupportedHypervisor = False cls.hypervisor = cls.testClient.getHypervisorInfo() - if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc"): + if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc", XEN_SERVER.lower()): cls.unsupportedHypervisor = True return # Get Domain, Zone, Template From 5545bcaa9de9ddcc2e4842dc5d2bb073897ebef2 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 4 Oct 2016 17:42:53 +0530 Subject: [PATCH 12/16] CLOUDSTACK-9531: Try template teardown without failure As per previous discussions and ticket, a template deletion may result in failure (exception thrown) for templates that are not properly downloaded. The tearDown method, a template may be tried for deletion but on failure we may ignore it as account deletion/tearDown would retry to cleanup resource owned by the account. Signed-off-by: Rohit Yadav --- test/integration/smoke/test_internal_lb.py | 5 ++++- test/integration/smoke/test_vpc_vpn.py | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index b378db9a4c2..d8a45c0fa8b 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -302,7 +302,7 @@ class TestInternalLb(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls._cleanup = [cls.template, cls.account, cls.compute_offering] + cls._cleanup = [cls.account, cls.compute_offering] return def setUp(self): @@ -842,6 +842,9 @@ class TestInternalLb(cloudstackTestCase): def tearDownClass(cls): try: cls.logger.debug("Cleaning up class resources") + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls._cleanup) except Exception as e: raise Exception("Cleanup failed with %s" % e) diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index 698cda7276a..a0639d52263 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -299,7 +299,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls.cleanup = [cls.template, cls.account, cls.compute_offering] + cls.cleanup = [cls.account, cls.compute_offering] return @attr(tags=["advanced"], required_hardware="true") @@ -435,6 +435,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): try: cls.logger.debug("Cleaning up resources") + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -479,7 +482,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls.cleanup = [cls.template, cls.account, cls.compute_offering] + cls.cleanup = [cls.account, cls.compute_offering] return def _get_ssh_client(self, virtual_machine, services, retries): @@ -798,6 +801,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): @classmethod def tearDownClass(cls): try: + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) @@ -842,7 +848,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase): %s" % (cls.account.name, cls.account.id)) - cls.cleanup = [cls.template, cls.account, cls.compute_offering] + cls.cleanup = [cls.account, cls.compute_offering] return def _validate_vpc_offering(self, vpc_offering): @@ -1165,6 +1171,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase): @classmethod def tearDownClass(cls): try: + try: + cls.template.delete(cls.apiclient) + except Exception: pass cleanup_resources(cls.apiclient, cls.cleanup) except Exception, e: raise Exception("Cleanup failed with %s" % e) From b0d527688f2bd781d99511ac72c638aeca12f95b Mon Sep 17 00:00:00 2001 From: Boris Date: Mon, 3 Oct 2016 17:53:51 +0300 Subject: [PATCH 13/16] CLOUDSTACK-9527: test_01_test_vm_volume_snapshot making test negative again - test_01_test_vm_volume_snapshot not supported for Xen, tests keep failing Signed-off-by: Rohit Yadav --- test/integration/smoke/test_vm_snapshots.py | 31 ++++++--------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py index d173aa4d329..5fcb80a8aed 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -362,12 +362,12 @@ class TestSnapshots(cloudstackTestCase): @attr(tags=["advanced", "basic", "smoke"], required_hardware="true") def test_01_test_vm_volume_snapshot(self): """ - @Desc: Test that Volume snapshot for root volume is allowed + @Desc: Test that Volume snapshot for root volume is not allowed when VM snapshot is present for the VM @Steps: 1: Deploy a VM and create a VM snapshot for VM 2: Try to create snapshot for the root volume of the VM, - It should not fail + It should expect Exception """ # Creating Virtual Machine @@ -392,25 +392,10 @@ class TestSnapshots(cloudstackTestCase): self.assertEqual(validateList(volumes)[0], PASS, "Failed to get root volume of the VM") - snapshot = Snapshot.create( - self.apiclient, - volumes[0].id, - account=self.account.name, - domainid=self.account.domainid - ) - self.debug("Snapshot created: ID - %s" % snapshot.id) - snapshots = list_snapshots( - self.apiclient, - id=snapshot.id - ) - self.assertEqual( - validateList(snapshots)[0], - PASS, - "Invalid snapshot list" - ) - self.assertEqual( - snapshots[0].id, - snapshot.id, - "Check resource id in list resources call" - ) + volume = volumes[0] + + with self.assertRaises(Exception): + Snapshot.create(self.apiclient, + volume_id=volume.id) + return From 0c146e14c645811c02d6e3c74fd24ed5b3a2953c Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 4 Oct 2016 23:55:46 +0530 Subject: [PATCH 14/16] CLOUDSTACK-9532: Use macchinina as a template for failing tests - Switches to macchinina as template for VM in the tests - Modifies the ostype of the macchinina template to 'Other Linux (64-bit)' - Check template download status, fixes Nonetype iterable issue Signed-off-by: Rohit Yadav --- test/integration/smoke/test_internal_lb.py | 8 +- test/integration/smoke/test_privategw_acl.py | 4 +- .../smoke/test_routers_network_ops.py | 76 ++++++++++++++++-- test/integration/smoke/test_snapshots.py | 79 ++++++++++++++++--- test/integration/smoke/test_vpc_redundant.py | 62 +++++++++++++-- test/integration/smoke/test_vpc_vpn.py | 8 +- tools/marvin/marvin/lib/base.py | 5 +- 7 files changed, 205 insertions(+), 37 deletions(-) diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index d8a45c0fa8b..f2f93649fec 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -226,7 +226,7 @@ class Services: "displaytext": "macchinina kvm", "format": "qcow2", "hypervisor": "kvm", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", "requireshvm": "True" }, @@ -235,7 +235,7 @@ class Services: "displaytext": "macchinina xen", "format": "vhd", "hypervisor": "xenserver", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", "requireshvm": "True", }, @@ -244,7 +244,7 @@ class Services: "displaytext": "macchinina xen", "format": "vhd", "hypervisor": "hyperv", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", "requireshvm": "True", }, @@ -253,7 +253,7 @@ class Services: "displaytext": "macchinina vmware", "format": "ova", "hypervisor": "vmware", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", "requireshvm": "True", } diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py index 9d39bdb2a6b..33a5d3f1e24 100644 --- a/test/integration/smoke/test_privategw_acl.py +++ b/test/integration/smoke/test_privategw_acl.py @@ -242,7 +242,7 @@ class TestPrivateGwACL(cloudstackTestCase): qresultset = self.dbclient.execute( "select vnet from op_dc_vnet_alloc where physical_network_id=\ - (select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_network.id + (select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id ) vlans = qresultset vlan_1 = int(vlans[0][0]) @@ -369,7 +369,7 @@ class TestPrivateGwACL(cloudstackTestCase): self.fail("No Physical Networks found!") qresultset = self.dbclient.execute( "select vnet from op_dc_vnet_alloc where physical_network_id=\ - (select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_network.id + (select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id ) vlans = qresultset vlan_1 = int(vlans[0][0]) diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py index a15150d40a2..93563e29818 100644 --- a/test/integration/smoke/test_routers_network_ops.py +++ b/test/integration/smoke/test_routers_network_ops.py @@ -16,6 +16,7 @@ # under the License. # Import Local Modules +from marvin.codes import PASS, FAILED from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase from marvin.cloudstackAPI import (stopVirtualMachine, @@ -27,6 +28,7 @@ from marvin.lib.utils import (cleanup_resources, from marvin.lib.base import (ServiceOffering, VirtualMachine, Account, + Template, ServiceOffering, NATRule, NetworkACL, @@ -52,6 +54,7 @@ from marvin.lib.common import (get_zone, import time import logging + def check_router_command(virtual_machine, public_ip, ssh_command, check_string, test_case, retries=5): result = 'failed' try: @@ -63,6 +66,58 @@ def check_router_command(virtual_machine, public_ip, ssh_command, check_string, logging.debug("Result from SSH into the Virtual Machine: %s" % result) return result.count(check_string) + +class Templates: + """Test data for templates + """ + + def __init__(self): + self.templates = { + "macchinina": { + "kvm": { + "name": "tiny-kvm", + "displaytext": "macchinina kvm", + "format": "qcow2", + "hypervisor": "kvm", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", + "requireshvm": "True", + "ispublic": "True", + }, + "xenserver": { + "name": "tiny-xen", + "displaytext": "macchinina xen", + "format": "vhd", + "hypervisor": "xen", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", + "requireshvm": "True", + "ispublic": "True", + }, + "hyperv": { + "name": "tiny-hyperv", + "displaytext": "macchinina xen", + "format": "vhd", + "hypervisor": "hyperv", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", + "requireshvm": "True", + "ispublic": "True", + }, + "vmware": { + "name": "tiny-vmware", + "displaytext": "macchinina vmware", + "format": "ova", + "hypervisor": "vmware", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", + "requireshvm": "True", + "ispublic": "True", + }, + } + } + + class TestRedundantIsolateNetworks(cloudstackTestCase): @classmethod @@ -81,12 +136,20 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"] - ) + + macchinina = Templates().templates["macchinina"] + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.logger.debug("Downloading Template: %s from: %s" % (macchinina[cls.hypervisor.lower()], + macchinina[cls.hypervisor.lower()]["url"])) + cls.template = Template.register(cls.api_client, macchinina[cls.hypervisor.lower()], + cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id) + cls.template.download(cls.api_client) + + if cls.template == FAILED: + assert False, "get_template() failed to return template" + cls.services["virtual_machine"]["zoneid"] = cls.zone.id + cls.services["virtual_machine"]["template"] = cls.template.id # Create an account, network, VM and IP addresses cls.account = Account.create( @@ -122,7 +185,8 @@ class TestRedundantIsolateNetworks(cloudstackTestCase): cls._cleanup = [ cls.service_offering, - cls.account + cls.account, + cls.template ] return diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 7cd56c8ff72..29a2d7286d8 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -22,6 +22,7 @@ from marvin.lib.utils import (cleanup_resources, is_snapshot_on_nfs) from marvin.lib.base import (VirtualMachine, Account, + Template, ServiceOffering, Snapshot) from marvin.lib.common import (get_domain, @@ -32,6 +33,57 @@ from marvin.lib.common import (get_domain, from marvin.lib.decoratorGenerators import skipTestIf +class Templates: + """Test data for templates + """ + + def __init__(self): + self.templates = { + "macchinina": { + "kvm": { + "name": "tiny-kvm", + "displaytext": "macchinina kvm", + "format": "qcow2", + "hypervisor": "kvm", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", + "requireshvm": "True", + "ispublic": "True", + }, + "xenserver": { + "name": "tiny-xen", + "displaytext": "macchinina xen", + "format": "vhd", + "hypervisor": "xen", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", + "requireshvm": "True", + "ispublic": "True", + }, + "hyperv": { + "name": "tiny-hyperv", + "displaytext": "macchinina xen", + "format": "vhd", + "hypervisor": "hyperv", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", + "requireshvm": "True", + "ispublic": "True", + }, + "vmware": { + "name": "tiny-vmware", + "displaytext": "macchinina vmware", + "format": "ova", + "hypervisor": "vmware", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", + "requireshvm": "True", + "ispublic": "True", + }, + } + } + + class TestSnapshotRootDisk(cloudstackTestCase): @classmethod @@ -52,18 +104,18 @@ class TestSnapshotRootDisk(cloudstackTestCase): cls._cleanup = [] if not cls.hypervisorNotSupported: - template = get_template( - cls.apiclient, - cls.zone.id, - cls.services["ostype"] - ) - if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services[ - "ostype"] + macchinina = Templates().templates["macchinina"] + cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()], + cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id) + cls.template.download(cls.apiclient) + + if cls.template == FAILED: + assert False, "get_template() failed to return template" + cls.services["domainid"] = cls.domain.id cls.services["small"]["zoneid"] = cls.zone.id - cls.services["templates"]["ostypeid"] = template.ostypeid + cls.services["templates"]["ostypeid"] = cls.template.ostypeid cls.services["zoneid"] = cls.zone.id # Create VMs, NAT Rules etc @@ -72,23 +124,26 @@ class TestSnapshotRootDisk(cloudstackTestCase): cls.services["account"], domainid=cls.domain.id ) - cls._cleanup.append(cls.account) cls.service_offering = ServiceOffering.create( cls.apiclient, cls.services["service_offerings"]["tiny"] ) - cls._cleanup.append(cls.service_offering) cls.virtual_machine = cls.virtual_machine_with_disk = \ VirtualMachine.create( cls.apiclient, cls.services["small"], - templateid=template.id, + templateid=cls.template.id, accountid=cls.account.name, domainid=cls.account.domainid, zoneid=cls.zone.id, serviceofferingid=cls.service_offering.id, mode=cls.services["mode"] ) + + cls._cleanup.append(cls.virtual_machine) + cls._cleanup.append(cls.service_offering) + cls._cleanup.append(cls.account) + cls._cleanup.append(cls.template) return @classmethod diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index 9e4038a32d6..2c7f4aeac61 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -18,6 +18,7 @@ """ Test redundancy features for VPC routers """ +from marvin.codes import PASS, FAILED from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.base import (stopRouter, @@ -25,6 +26,7 @@ from marvin.lib.base import (stopRouter, destroyRouter, rebootRouter, Account, + Template, VpcOffering, VPC, ServiceOffering, @@ -191,8 +193,49 @@ class Services: "publicport": 22, "protocol": 'TCP', }, - "ostype": 'CentOS 5.3 (64-bit)', "timeout": 10, + "template": { + "kvm": { + "name": "tiny-kvm", + "displaytext": "macchinina kvm", + "format": "qcow2", + "hypervisor": "kvm", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", + "requireshvm": "True", + "ispublic": "True", + }, + "xenserver": { + "name": "tiny-xen", + "displaytext": "macchinina xen", + "format": "vhd", + "hypervisor": "xen", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", + "requireshvm": "True", + "ispublic": "True", + }, + "hyperv": { + "name": "tiny-hyperv", + "displaytext": "macchinina xen", + "format": "vhd", + "hypervisor": "hyperv", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", + "requireshvm": "True", + "ispublic": "True", + }, + "vmware": { + "name": "tiny-vmware", + "displaytext": "macchinina vmware", + "format": "ova", + "hypervisor": "vmware", + "ostype": "Other Linux (64-bit)", + "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", + "requireshvm": "True", + "ispublic": "True", + } + } } @@ -210,17 +253,22 @@ class TestVPCRedundancy(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) - cls.template = get_template( - cls.api_client, - cls.zone.id, - cls.services["ostype"]) + + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.template = Template.register(cls.api_client, cls.services["template"][cls.hypervisor.lower( + )], cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id) + cls.template.download(cls.api_client) + + if cls.template == FAILED: + assert False, "get_template() failed to return template" + cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"]) - cls._cleanup = [cls.service_offering] + cls._cleanup = [cls.service_offering, cls.template] cls.logger = logging.getLogger('TestVPCRedundancy') cls.stream_handler = logging.StreamHandler() @@ -592,7 +640,7 @@ class TestVPCRedundancy(cloudstackTestCase): gc_interval = Configurations.list(self.apiclient, name="network.gc.interval") self.logger.debug("network.gc.wait is ==> %s" % gc_wait) - self.logger.debug("network.gc.interval is ==> %s" % gc_wait) + self.logger.debug("network.gc.interval is ==> %s" % gc_interval) total_sleep = 120 if gc_wait and gc_interval: diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index a0639d52263..966f40d4071 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -222,7 +222,7 @@ class Services: "displaytext": "macchinina kvm", "format": "qcow2", "hypervisor": "kvm", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", "requireshvm": "True", }, @@ -232,7 +232,7 @@ class Services: "displaytext": "macchinina xen", "format": "vhd", "hypervisor": "xen", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", "requireshvm": "True", }, @@ -242,7 +242,7 @@ class Services: "displaytext": "macchinina xen", "format": "vhd", "hypervisor": "hyperv", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", "requireshvm": "True", }, @@ -252,7 +252,7 @@ class Services: "displaytext": "macchinina vmware", "format": "ova", "hypervisor": "vmware", - "ostype": "Other PV (64-bit)", + "ostype": "Other Linux (64-bit)", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", "requireshvm": "True", } diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 91e7fdcee21..3b81b978e4b 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -1250,7 +1250,7 @@ class Template: if isinstance(template_response, list): template = template_response[0] - if retries >=0 and not hasattr(template, 'status'): + if not hasattr(template, 'status') or not template or not template.status: retries = retries - 1 continue @@ -1390,9 +1390,10 @@ class Iso: if isinstance(iso_response, list): response = iso_response[0] - if retries >= 0 and not hasattr(response, 'status'): + if not hasattr(response, 'status') or not response or not response.status: retries = retries - 1 continue + # Check whether download is in progress(for Ex:10% Downloaded) # or ISO is 'Successfully Installed' if response.status == 'Successfully Installed' and response.isready: From 93ac134f1e5c4c4c22029eca241f75362303837a Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Wed, 5 Oct 2016 14:52:06 +0530 Subject: [PATCH 15/16] CLOUDSTACK-9533: gateway of public IP is not handled correctly when parsing the cmd_line.json to create ips.json databag using 'gateway' in cmd_line for the public ip gateway while creating ips.json databag --- systemvm/patches/debian/config/opt/cloud/bin/merge.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/systemvm/patches/debian/config/opt/cloud/bin/merge.py b/systemvm/patches/debian/config/opt/cloud/bin/merge.py index 76c0ffb8c02..aab29e8a4cd 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/merge.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/merge.py @@ -222,10 +222,13 @@ class updateDataBag: dp['source_nat'] = False dp['add'] = True dp['one_to_one_nat'] = False - if('localgw' in self.qFile.data['cmd_line']): - dp['gateway'] = self.qFile.data['cmd_line']['localgw'] + if nw_type == "public": + dp['gateway'] = self.qFile.data['cmd_line']['gateway'] else: - dp['gateway'] = 'None' + if('localgw' in self.qFile.data['cmd_line']): + dp['gateway'] = self.qFile.data['cmd_line']['localgw'] + else: + dp['gateway'] = 'None' dp['nic_dev_id'] = num dp['nw_type'] = nw_type qf = QueueFile() From 409e504f6f96c19dd934f69049aec82e40c755cd Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 6 Oct 2016 15:33:09 +0530 Subject: [PATCH 16/16] CLOUDSTACK-9529: Cleanup resources after marvin test completes - Cleans up volumes, snapshots and VM after running test_snapshots Signed-off-by: Rohit Yadav --- test/integration/smoke/test_snapshots.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 29a2d7286d8..638b66cac40 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -196,6 +196,7 @@ class TestSnapshotRootDisk(cloudstackTestCase): account=self.account.name, domainid=self.account.domainid ) + self.cleanup.append(snapshot) self.debug("Snapshot created: ID - %s" % snapshot.id) snapshots = list_snapshots(