You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/12/17 12:59:09 UTC

[1/4] git commit: updated refs/heads/4.5 to ed5bc1c

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 9fb654cba -> ed5bc1c7e


CLOUDSTACK-8074: Fixed maint/test_multiple_ip_ranges.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/4.5
Commit: c3508f61a18384e9201d3d1dc87c35c67e200039
Parents: 9fb654c
Author: Ashutosh K <as...@clogeny.com>
Authored: Tue Dec 16 17:13:05 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:25 2014 +0530

----------------------------------------------------------------------
 .../component/maint/test_multiple_ip_ranges.py  | 972 ++++++++++---------
 1 file changed, 510 insertions(+), 462 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3508f61/test/integration/component/maint/test_multiple_ip_ranges.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_multiple_ip_ranges.py b/test/integration/component/maint/test_multiple_ip_ranges.py
index 982dd7c..f73c470 100644
--- a/test/integration/component/maint/test_multiple_ip_ranges.py
+++ b/test/integration/component/maint/test_multiple_ip_ranges.py
@@ -16,117 +16,72 @@
 # under the License.
 """ Tests for Multiple IP Ranges feature
 """
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.cloudstackException import CloudstackAPIException
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-# from netaddr import *
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.utils import cleanup_resources, get_process_status
+from marvin.lib.base import (Account,
+                             DiskOffering,
+                             VirtualMachine,
+                             Router,
+                             ServiceOffering,
+                             PublicIpRange)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               list_routers,
+                               list_hosts,
+                               get_pod,
+                               get_template)
 import netaddr
 from nose.plugins.attrib import attr
+from netaddr import IPNetwork, IPAddress
+from marvin.sshClient import SshClient
+import random
 
-class Services:
-    """Test Multiple IP Ranges
-    """
-    def __init__(self):
-        self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                        },
-                        "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 200,  # in MHz
-                                    "memory": 256,  # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small Disk",
-                                    "name": "Small Disk",
-                                    "disksize": 1
-                        },
-                        "templates": {
-                                    "displaytext": 'Template',
-                                    "name": 'Template',
-                                    "ostype": "CentOS 5.3 (64-bit)",
-                                    "templatefilter": 'self',
-                        },
-                        "vlan_ip_range": {
-                                           "startip": "10.147.43.130",
-                                           "endip": "10.147.43.135",
-                                           "netmask": "255.255.255.192",
-                                           "gateway": "10.147.43.129",
-                                           "forvirtualnetwork": "false",
-                                           "vlan": "untagged",
-                        },
-                        "server_without_disk": {
-                                        "displayname": "Test VM-No Disk",
-                                        "username": "root",
-                                        "password": "password",
-                                        "hypervisor": 'XenServer',
-                        },
-                        "host": {
-				"publicport": 22,
-	                        "username": "root",    # Host creds for SSH
-				"password": "password",
-                        },
-			"ostype": "CentOS 5.3 (64-bit)",
-                        "sleep": 60,
-                        "timeout": 10,
-          }
 
 class TestMultipleIpRanges(cloudstackTestCase):
+
     """Test Multiple IP Ranges for guest network
     """
     @classmethod
     def setUpClass(cls):
-        cls.testClient = super(TestEgressAfterHostMaintenance, cls).getClsTestClient()
+        cls.testClient = super(TestMultipleIpRanges, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
         cls.dbclient = cls.testClient.getDbConnection()
 
-        cls.services = Services().services
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.pod = get_pod(cls.api_client, cls.zone.id)
-        cls.services['mode'] = cls.zone.networktype
-        cls.services["domainid"] = cls.domain.id
-        cls.services["zoneid"] = cls.zone.id
+        cls.testdata['mode'] = cls.zone.networktype
+        cls.testdata["domainid"] = cls.domain.id
+        cls.testdata["zoneid"] = cls.zone.id
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
-        cls.services["account"] = cls.account.name
+            cls.api_client,
+            cls.testdata["account"],
+            domainid=cls.domain.id
+        )
+        cls.testdata["account"] = cls.account.name
         cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
+            cls.api_client,
+            cls.testdata["disk_offering"]
+        )
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.testdata["service_offering"]
+        )
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        cls.services["templates"]["ostypeid"] = cls.template.ostypeid
-        cls.services["diskoffering"] = cls.disk_offering.id
+            cls.api_client,
+            cls.zone.id,
+            cls.testdata["ostype"]
+        )
+        cls.testdata["diskoffering"] = cls.disk_offering.id
         cls.dc_id = cls.dbclient.execute(
-                                      "select id from data_center where uuid = '%s';" % str(cls.services["zoneid"])
-                                      )
+            "select id from data_center where uuid = '%s';" % str(
+                cls.testdata["zoneid"]))
         cls.dc_id = cls.dc_id[0][0]
         cls.ids = cls.dbclient.execute(
-                            "select id from user_ip_address where allocated is null and data_center_id = '%s';" % str(cls.dc_id)
-                            )
+            "select id from user_ip_address where allocated is null and data_center_id = '%s';" % str(
+                cls.dc_id))
         cls.id_list = []
         for i in range(len(cls.ids)):
             cls.id_list.append(cls.ids[i][0])
@@ -142,45 +97,76 @@ class TestMultipleIpRanges(cloudstackTestCase):
             cls.id_list = cls.id_list[:-2]
         for id in cls.id_list:
             cls.dbclient.execute(
-                                 "update user_ip_address set allocated=now() where id = '%s';" % str(id)
-                                 )
-        # Add IP range in the new CIDR
-        cls.services["vlan_ip_range"]["zoneid"] = cls.zone.id
-        cls.services["vlan_ip_range"]["podid"] = cls.pod.id
+                "update user_ip_address set allocated=now() where id = '%s';" %
+                str(id))
         # create new vlan ip range
         # Before creating ip range check the zone's network type
-        if cls.zone.networktype == 'Basic':
-            cls.new_vlan = PublicIpRange.create(cls.api_client, cls.services["vlan_ip_range"])
+        if cls.zone.networktype.lower() == 'basic':
+            cls.new_vlan = cls.createNewVlanRange()
         else:
-            raise unittest.SkipTest("These tests can be run only on basic zone. So skipping the tests")
+            raise unittest.SkipTest(
+                "These tests can be run only on basic zone.\
+                        So skipping the tests")
         # Deploy vm in existing subnet if VR is not present
-        if cls.vr_state is False :
+        if cls.vr_state is False:
             cls.vm_res = VirtualMachine.create(
-                                            cls.api_client,
-                                            cls.services["server_without_disk"],
-                                            templateid=cls.template.id,
-                                            accountid=cls.account.name,
-                                            domainid=cls.services["domainid"],
-                                            zoneid=cls.services["zoneid"],
-                                            serviceofferingid=cls.service_offering.id,
-                                            mode=cls.services["mode"],
-                                            )
+                cls.api_client,
+                cls.testdata["server_without_disk"],
+                templateid=cls.template.id,
+                accountid=cls.account.name,
+                domainid=cls.testdata["domainid"],
+                zoneid=cls.testdata["zoneid"],
+                serviceofferingid=cls.service_offering.id,
+                mode=cls.testdata["mode"],
+            )
         cls._cleanup = [
-                        cls.new_vlan,
-                        cls.account,
-                        ]
+            cls.new_vlan,
+            cls.account,
+        ]
         return
 
     @classmethod
+    def createNewVlanRange(cls):
+        """ Increment current cidr of vlan range present in network
+            and create new range
+        """
+        publicIpRange = PublicIpRange.list(cls.api_client)
+        cls.startIp = publicIpRange[0].startip
+        cls.endIp = publicIpRange[0].endip
+        cls.gateway = publicIpRange[0].gateway
+        cls.netmask = publicIpRange[0].netmask
+        # Pass ip address and mask length to IPNetwork to findout the CIDR
+        ip = IPNetwork(cls.startIp + "/" + cls.netmask)
+        # Take random increment factor to avoid adding the same vlan ip range
+        # in each test case
+        networkIncrementFactor = random.randint(1,255)
+        new_cidr = ip.__iadd__(networkIncrementFactor)
+        ip2 = IPNetwork(new_cidr)
+        test_nw = ip2.network
+        ip = IPAddress(test_nw)
+        # Add IP range(5 IPs) in the new CIDR
+        test_gateway = ip.__add__(1)
+        test_startIp = ip.__add__(3)
+        test_endIp = ip.__add__(10)
+        # Populating services with new IP range
+        cls.testdata["vlan_ip_range"]["startip"] = test_startIp
+        cls.testdata["vlan_ip_range"]["endip"] = test_endIp
+        cls.testdata["vlan_ip_range"]["gateway"] = test_gateway
+        cls.testdata["vlan_ip_range"]["netmask"] = cls.netmask
+        cls.testdata["vlan_ip_range"]["zoneid"] = cls.zone.id
+        cls.testdata["vlan_ip_range"]["podid"] = cls.pod.id
+
+        return PublicIpRange.create(
+                cls.api_client,
+                cls.testdata["vlan_ip_range"])
+
+    @classmethod
     def tearDownClass(cls):
         try:
             for id in cls.id_list:
                 cls.dbclient.execute(
-                                     "update user_ip_address set allocated=default where id = '%s';" % str(id)
-                                     )
-            # Wait for expunge interval to cleanup VMs
-            wait_for_cleanup(cls.api_client, ["expunge.delay", "expunge.interval"])
-            time.sleep(30)
+                    "update user_ip_address set allocated=default where id = '%s';" %
+                    str(id))
             # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
@@ -190,48 +176,55 @@ class TestMultipleIpRanges(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = [ ]
+        self.cleanup = []
         # Deploy guest vm
-        try :
+        try:
             self.virtual_machine = VirtualMachine.create(
-                                            self.apiclient,
-                                            self.services["server_without_disk"],
-                                            templateid=self.template.id,
-                                            accountid=self.account.name,
-                                            domainid=self.services["domainid"],
-                                            zoneid=self.services["zoneid"],
-                                            serviceofferingid=self.service_offering.id,
-                                            mode=self.services["mode"],
-                                            )
-        except Exception as e :
-            raise Exception("Warning: Exception during vm deployment: {}".format(e))
+                self.apiclient,
+                self.testdata["server_without_disk"],
+                templateid=self.template.id,
+                accountid=self.account.name,
+                domainid=self.testdata["domainid"],
+                zoneid=self.testdata["zoneid"],
+                serviceofferingid=self.service_offering.id,
+                mode=self.testdata["mode"],
+            )
+        except Exception as e:
+            raise Exception(
+                "Warning: Exception during vm deployment: {}".format(e))
         self.vm_response = VirtualMachine.list(
-                                               self.apiclient,
-                                               id=self.virtual_machine.id
-                                               )
+            self.apiclient,
+            id=self.virtual_machine.id
+        )
         self.assertEqual(
             isinstance(self.vm_response, list),
             True,
             "Check VM list response returned a valid list"
-            )
-        self.ip_range = list(netaddr.iter_iprange(unicode(self.services["vlan_ip_range"]["startip"]), unicode(self.services["vlan_ip_range"]["endip"])))
-        self.nic_ip = netaddr.IPAddress(unicode(self.vm_response[0].nic[0].ipaddress))
+        )
+        self.ip_range = list(
+            netaddr.iter_iprange(
+                unicode(
+                    self.testdata["vlan_ip_range"]["startip"]), unicode(
+                    self.testdata["vlan_ip_range"]["endip"])))
+        self.nic_ip = netaddr.IPAddress(
+            unicode(
+                self.vm_response[0].nic[0].ipaddress))
         self.debug("vm got {} as ip address".format(self.nic_ip))
         self.assertIn(
-              self.nic_ip,
-              self.ip_range,
-              "VM did not get the ip address from the new ip range"
-              )
+            self.nic_ip,
+            self.ip_range,
+            "VM did not get the ip address from the new ip range"
+        )
         ip_alias = self.dbclient.execute(
-                              "select ip4_address from nic_ip_alias;"
-                              )
+            "select ip4_address from nic_ip_alias;"
+        )
         self.alias_ip = str(ip_alias[0][0])
         self.debug("alias ip : %s" % self.alias_ip)
         self.assertNotEqual(
-                            self.alias_ip,
-                            None,
-                            "Error in creating ip alias. Please check MS logs"
-			    )
+            self.alias_ip,
+            None,
+            "Error in creating ip alias. Please check MS logs"
+        )
         self.cleanup.append(self.virtual_machine)
         return
 
@@ -246,35 +239,38 @@ class TestMultipleIpRanges(cloudstackTestCase):
     def verify_vlan_range(self, vlan, services):
         # compare vlan_list response with configured values
         self.assertEqual(
-                         isinstance(vlan, list),
-                         True,
-                         "Check list response returned a valid list"
-                         )
+            isinstance(vlan, list),
+            True,
+            "Check list response returned a valid list"
+        )
         self.assertNotEqual(
-                             len(vlan),
-                             0,
-                             "check list vlan response"
-                             )
+            len(vlan),
+            0,
+            "check list vlan response"
+        )
         self.assertEqual(
-                         str(vlan[0].startip),
-                         str(services["startip"]),
-                         "Start IP in vlan ip range is not matched with the configured start ip"
-                         )
+            str(vlan[0].startip),
+            str(services["startip"]),
+            "Start IP in vlan ip range is not matched with the\
+                    configured start ip"
+        )
         self.assertEqual(
-                         str(vlan[0].endip),
-                         str(services["endip"]),
-                         "End IP in vlan ip range is not matched with the configured end ip"
-                        )
+            str(vlan[0].endip),
+            str(services["endip"]),
+            "End IP in vlan ip range is not matched with the configured end ip"
+        )
         self.assertEqual(
-                         str(vlan[0].gateway),
-                         str(services["gateway"]),
-                         "gateway in vlan ip range is not matched with the configured gateway"
-                         )
+            str(vlan[0].gateway),
+            str(services["gateway"]),
+            "gateway in vlan ip range is not matched with the\
+                    configured gateway"
+        )
         self.assertEqual(
-                         str(vlan[0].netmask),
-                         str(services["netmask"]),
-                         "netmask in vlan ip range is not matched with the configured netmask"
-                         )
+            str(vlan[0].netmask),
+            str(services["netmask"]),
+            "netmask in vlan ip range is not matched with\
+                    the configured netmask"
+        )
         return
 
     @attr(tags=["sg"])
@@ -283,14 +279,20 @@ class TestMultipleIpRanges(cloudstackTestCase):
             1.Deploy guest vm
             2.Verify vm gets the ip address from new cidr
         """
-        self.ip_range = list(netaddr.iter_iprange(unicode(self.services["vlan_ip_range"]["startip"]), unicode(self.services["vlan_ip_range"]["endip"])))
-        self.nic_ip = netaddr.IPAddress(unicode(self.vm_response[0].nic[0].ipaddress))
+        self.ip_range = list(
+            netaddr.iter_iprange(
+                unicode(
+                    self.testdata["vlan_ip_range"]["startip"]), unicode(
+                    self.testdata["vlan_ip_range"]["endip"])))
+        self.nic_ip = netaddr.IPAddress(
+            unicode(
+                self.vm_response[0].nic[0].ipaddress))
         self.debug("vm got {} as ip address".format(self.nic_ip))
         self.assertIn(
-              self.nic_ip,
-              self.ip_range,
-              "VM did not get the ip address from the new ip range"
-              )
+            self.nic_ip,
+            self.ip_range,
+            "VM did not get the ip address from the new ip range"
+        )
         return
 
     @attr(tags=["sg"])
@@ -300,51 +302,60 @@ class TestMultipleIpRanges(cloudstackTestCase):
             2.Verify dns service listens on alias ip in VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = self.alias_ip + ":53"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                "netstat -atnp | grep %s" % proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            "netstat -atnp | grep %s" % proc
+        )
         res = str(result)
         self.debug("Dns process status on alias ip: %s" % res)
         self.assertNotEqual(
-                         res.find(proc)
-                         - 1,
-                         "dnsmasq service is not running on alias ip"
-                        )
+            res.find(proc)
+            - 1,
+            "dnsmasq service is not running on alias ip"
+        )
         return
 
     @attr(tags=["sg"])
@@ -354,51 +365,60 @@ class TestMultipleIpRanges(cloudstackTestCase):
             2.Verify password service(socat) listens on alias ip in VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "socat"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                "netstat -atnp | grep %s" % proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            "netstat -atnp | grep %s" % proc
+        )
         res = str(result)
         self.debug("password process status on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "password service is not running on alias ip"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "password service is not running on alias ip"
+        )
         return
 
     @attr(tags=["sg"])
@@ -408,51 +428,60 @@ class TestMultipleIpRanges(cloudstackTestCase):
             2.Verify userdata service(apache2) listens on alias ip in VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "apache2"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                "netstat -atnp | grep %s" % proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            "netstat -atnp | grep %s" % proc
+        )
         res = str(result)
         self.debug("userdata process status on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip + ":80 ")
-                         - 1,
-                         "password service is not running on alias ip"
-                        )
+            res.find(self.alias_ip + ":80 ")
+            - 1,
+            "password service is not running on alias ip"
+        )
         return
 
     @attr(tags=["sg"])
@@ -464,93 +493,94 @@ class TestMultipleIpRanges(cloudstackTestCase):
             4.Verify ip alias removal after vm expunge
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.debug("ip alias configuration on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "ip alias is not created on VR eth0"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "ip alias is not created on VR eth0"
+        )
         self.virtual_machine.delete(self.apiclient)
-        expunge_del = Configurations.list(
-                                          self.apiclient,
-                                          name='expunge.delay'
-                                         )
-        expunge_int = Configurations.list(
-                                          self.apiclient,
-                                          name='expunge.interval'
-                                         )
-        wait_time = int(expunge_del[0].value) + int(expunge_int[0].value) + int(30)
-        self.debug("Waiting for {} seconds for the vm to expunge".format(wait_time))
-        # wait for the vm to expunge
-        time.sleep(wait_time)
-        self.debug("Verify that expunging the last vm in the CIDR should delete the ip alias from VR")
+        self.debug(
+            "Verify that expunging the last vm in the CIDR should\
+                    delete the ip alias from VR")
         ip_alias2 = self.dbclient.execute(
-                              "select ip4_address from nic_ip_alias;"
-                              )
+            "select ip4_address from nic_ip_alias;"
+        )
         self.assertEqual(
-                         isinstance(ip_alias2, list),
-                         True,
-                         "Error in sql query"
-                         )
+            isinstance(ip_alias2, list),
+            True,
+            "Error in sql query"
+        )
         self.assertEqual(
-                         len(ip_alias2),
-                         0,
-                         "Failure in clearing ip alias entry from cloud db"
-			)
+            len(ip_alias2),
+            0,
+            "Failure in clearing ip alias entry from cloud db"
+        )
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.assertEqual(
-                         res.find(self.alias_ip),
-                         - 1,
-                         "Failed to clean up ip alias from VR even after last vm expunge in the CIDR"
-                         )
+            res.find(
+                self.alias_ip),
+            - 1,
+            "Failed to clean up ip alias from VR even after\
+                    last vm expunge in the CIDR")
         self.debug("IP alias got deleted from VR successfully.")
         self.cleanup.remove(self.virtual_machine)
         return
@@ -564,86 +594,95 @@ class TestMultipleIpRanges(cloudstackTestCase):
             4.Verify ip alias on VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.debug("ip alias configuration on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "ip alias is not created on VR eth0"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "ip alias is not created on VR eth0"
+        )
         resp = Router.reboot(
-                             self.apiclient,
-                             router.id
-                             )
+            self.apiclient,
+            router.id
+        )
         self.debug("Reboot router api response: %s" % resp)
         list_router_response = list_routers(
-                                            self.apiclient,
-                                            zoneid=self.zone.id,
-                                            listall=True
-                                            )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Router is not in running state after reboot"
-                        )
+            router.state,
+            'Running',
+            "Router is not in running state after reboot"
+        )
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.assertNotEqual(
-                         res.find(self.alias_ip),
-                         - 1,
-                         "IP alias not present on VR after VR reboot"
-                         )
+            res.find(self.alias_ip),
+            - 1,
+            "IP alias not present on VR after VR reboot"
+        )
         return
 
     @attr(tags=["sg"])
@@ -655,90 +694,99 @@ class TestMultipleIpRanges(cloudstackTestCase):
             4.Verify ip alias on VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.debug("ip alias configuration on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "ip alias is not created on VR eth0"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "ip alias is not created on VR eth0"
+        )
         self.debug("Stopping VR")
-        stop_res = Router.stop(
-                           self.apiclient,
-                           router.id,
-                           )
+        Router.stop(
+            self.apiclient,
+            router.id,
+        )
         self.debug("Starting VR")
-        start_res = Router.start(
-                                 self.apiclient,
-                                 router.id
-                                 )
+        Router.start(
+            self.apiclient,
+            router.id
+        )
         list_router_response = list_routers(
-                                            self.apiclient,
-                                            zoneid=self.zone.id,
-                                            listall=True
-                                            )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Router is not in running state after reboot"
-                        )
+            router.state,
+            'Running',
+            "Router is not in running state after reboot"
+        )
         self.debug("VR is up and Running")
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.assertNotEqual(
-                         res.find(self.alias_ip),
-                         - 1,
-                         "IP alias not present on VR after VR stop and start"
-                         )
+            res.find(self.alias_ip),
+            - 1,
+            "IP alias not present on VR after VR stop and start"
+        )
         return


[3/4] git commit: updated refs/heads/4.5 to ed5bc1c

Posted by ta...@apache.org.
CLOUDSTACK-8055: test_portable_ip.py - Tagging test case which can't be run on simulator

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/4.5
Commit: 94814603db6d825d23710071d4aba1c5893d3360
Parents: daabe92
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 17 14:11:16 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:44 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94814603/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 6bdc61a..83ef6b5 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -1288,7 +1288,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced","swamy"], required_hardware="false")
+    @attr(tags=["advanced","swamy"], required_hardware="true")
     def test_list_portable_ip_range_non_root_admin(self):
         """Test list portable ip ranges with non admin root account
         """


[2/4] git commit: updated refs/heads/4.5 to ed5bc1c

Posted by ta...@apache.org.
CLOUDSTACK-8081: Fixed VM snapshot test cases in test_escalation_instances.py and also dealt cleanup issues

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/4.5
Commit: daabe92a992f072c6305b14b88fcda99e19a7190
Parents: c3508f6
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 17 11:32:49 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:35 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     | 61 +++++++-------------
 1 file changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/daabe92a/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 9f053a1..e79cd3d 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -2113,26 +2113,6 @@ class TestInstances(cloudstackTestCase):
                 cls.api_client,
                 cls.services["service_offerings"]["tiny"]
             )
-            cls.account = Account.create(
-                cls.api_client,
-                cls.services["account"],
-                domainid=cls.domain.id
-            )
-            # Getting authentication for user in newly created Account
-            cls.user = cls.account.user[0]
-            cls.userapiclient = cls.testClient.getUserApiClient(
-                cls.user.username,
-                cls.domain.name)
-            # Updating resource Limits
-            for i in range(0, 8):
-                Resources.updateLimit(
-                    cls.api_client,
-                    account=cls.account.name,
-                    domainid=cls.domain.id,
-                    max=-1,
-                    resourcetype=i
-                )
-            cls._cleanup.append(cls.account)
             cls._cleanup.append(cls.service_offering)
             cls._cleanup.append(cls.disk_offering)
         except Exception as e:
@@ -2144,12 +2124,29 @@ class TestInstances(cloudstackTestCase):
 
         self.apiClient = self.testClient.getApiClient()
         self.cleanup = []
-        self.cleanup_vm = []
+        self.account = Account.create(
+                self.apiClient,
+                self.services["account"],
+                domainid=self.domain.id
+            )
+            # Getting authentication for user in newly created Account
+        self.user = self.account.user[0]
+        self.userapiclient = self.testClient.getUserApiClient(
+                self.user.username,
+                self.domain.name)
+        # Updating resource Limits
+        for i in range(0, 8):
+            Resources.updateLimit(
+                    self.api_client,
+                    account=self.account.name,
+                    domainid=self.domain.id,
+                    max=-1,
+                    resourcetype=i
+            )
+        self.cleanup.append(self.account)
 
     def tearDown(self):
         # Clean up, terminate the created resources
-        for vm in self.cleanup_vm:
-            vm.delete(self.apiClient, expunge=True)
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -2242,7 +2239,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again for matching zone
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2372,7 +2368,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2535,7 +2530,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2568,6 +2562,7 @@ class TestInstances(cloudstackTestCase):
         snapshot1 = VmSnapshot.create(
             self.userapiclient,
             vm_created.id,
+            snapshotmemory=True
         )
         self.assertIsNotNone(
             snapshot1,
@@ -2576,6 +2571,7 @@ class TestInstances(cloudstackTestCase):
         snapshot2 = VmSnapshot.create(
             self.userapiclient,
             vm_created.id,
+            snapshotmemory=True
         )
         self.assertIsNotNone(
             snapshot2,
@@ -2699,7 +2695,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2747,7 +2742,6 @@ class TestInstances(cloudstackTestCase):
                 volume_created,
                 "Volume is not created"
             )
-            self.cleanup.append(volume_created)
             # Attaching all the volumes created to VM
             vm_created.attach_volume(
                 self.userapiclient,
@@ -2943,7 +2937,6 @@ class TestInstances(cloudstackTestCase):
                 vm_created,
                 "VM creation failed"
             )
-            self.cleanup.append(vm_created)
             # Listing details of current Service Offering
             vm_so_list = ServiceOffering.list(
                 self.userapiclient,
@@ -3074,7 +3067,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing details of current Service Offering
         vm_so_list = ServiceOffering.list(
             self.userapiclient,
@@ -3198,7 +3190,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3326,7 +3317,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Verifying the displayname and group details for deployed VM
         self.assertEquals(
             self.services["virtual_machine"]["displayname"],
@@ -3425,7 +3415,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3533,7 +3522,6 @@ class TestInstances(cloudstackTestCase):
                 network,
                 "Network creation failed"
             )
-            self.cleanup.append(network)
             networks_list_size = networks_list_size + 1
 
         # Listing the networks again
@@ -3573,7 +3561,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.insert(-2, vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3693,7 +3680,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup_vm.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3797,8 +3783,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        # self.cleanup.append(vm_created)
-        self.cleanup.append(network)
         # Listing all the VMs for a user again
         vm_response = VirtualMachine.list(
             self.userapiclient,
@@ -3921,7 +3905,6 @@ class TestInstances(cloudstackTestCase):
             vm1, "VM1 creation failed with ip address %s and host name %s" %
             (vm_ip1, name1))
         # self.cleanup.append(vm_created)
-        self.cleanup.append(network)
         # Listing all the VMs for a user again
         vm_response = VirtualMachine.list(
             self.userapiclient,


[4/4] git commit: updated refs/heads/4.5 to ed5bc1c

Posted by ta...@apache.org.
CLOUDSTACK-8071: Fixed api key issue in test_snapshots_improvement.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/4.5
Commit: ed5bc1c7ea1885e95c7cad0045243c7f43e9f516
Parents: 9481460
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Dec 15 15:54:51 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:53 2014 +0530

----------------------------------------------------------------------
 .../component/test_snapshots_improvement.py        | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed5bc1c7/test/integration/component/test_snapshots_improvement.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshots_improvement.py b/test/integration/component/test_snapshots_improvement.py
index 6638ddd..1fd4239 100644
--- a/test/integration/component/test_snapshots_improvement.py
+++ b/test/integration/component/test_snapshots_improvement.py
@@ -303,7 +303,9 @@ class TestCreateSnapshot(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        if cls.hypervisor.lower() in ['hyperv']:
+            raise unittest.SkipTest("Snapshots feature is not supported on Hyper-V")
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -345,13 +347,17 @@ class TestCreateSnapshot(cloudstackTestCase):
                             self.services["account"],
                             domainid=self.domain.id
                             )
+
+        self.apiclient = self.testClient.getUserApiClient(
+                                UserName=self.account.name,
+                                DomainName=self.account.domain)
         self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
         try:
             # Clean up, terminate the created instance, volumes and snapshots
-            cleanup_resources(self.apiclient, self.cleanup)
+            cleanup_resources(self.api_client, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -615,13 +621,8 @@ class TestCreateSnapshot(cloudstackTestCase):
             self.debug("Create a template from snapshot: %s" % snapshot.name)
             jobs.append(self.create_Template_from_Snapshot(snapshot))
 
-
-        userapiclient = self.testClient.getUserApiClient(
-                                UserName=self.account.name,
-                                DomainName=self.account.domain)
-
         # Verify IO usage by submitting the concurrent jobs
-        self.testClient.submitCmdsAndWait(jobs, apiclient=userapiclient)
+        self.testClient.submitCmdsAndWait(jobs)
 
         self.debug("Verifying if templates are created properly or not?")
         templates = Template.list(