CLOUDSTACK-6160: Changes to marvin apiclient Removed apiclient.hypervisor references. More details in the bug Few other changes pending for this related to VirtualMachine.create need to be cleaned up
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bf77e9d6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bf77e9d6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bf77e9d6 Branch: refs/heads/master Commit: bf77e9d66931468e785ca48222a564abf557fad7 Parents: d06f2b6 Author: Santhosh Edukulla <[email protected]> Authored: Mon Feb 24 18:56:46 2014 +0530 Committer: Girish Shilamkar <[email protected]> Committed: Mon Feb 24 18:56:46 2014 +0530 ---------------------------------------------------------------------- .../component/maint/test_redundant_router.py | 9 +++++---- test/integration/component/test_accounts.py | 6 +++++- .../component/test_base_image_updation.py | 4 +++- test/integration/component/test_blocker_bugs.py | 5 +++-- .../component/test_deploy_vm_userdata_reg.py | 8 ++++++-- test/integration/component/test_routers.py | 5 +++-- test/integration/component/test_stopped_vm.py | 5 +++-- test/integration/component/test_templates.py | 5 +++-- test/integration/smoke/test_hosts.py | 8 +++++--- test/integration/smoke/test_routers.py | 17 +++++++++-------- test/integration/smoke/test_ssvm.py | 13 +++++++------ tools/marvin/marvin/cloudstackTestClient.py | 14 ++++++++++++++ tools/marvin/marvin/lib/base.py | 14 +++++++------- 13 files changed, 73 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/maint/test_redundant_router.py ---------------------------------------------------------------------- diff --git a/test/integration/component/maint/test_redundant_router.py b/test/integration/component/maint/test_redundant_router.py index e282272..245ce37 100644 --- a/test/integration/component/maint/test_redundant_router.py +++ b/test/integration/component/maint/test_redundant_router.py @@ -685,6 +685,7 @@ class TestRVRInternals(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.account = Account.create( self.apiclient, @@ -846,7 +847,7 @@ class TestRVRInternals(cloudstackTestCase): self.debug(master_router.linklocalip) # Check eth2 port for master router - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': result = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -854,7 +855,7 @@ class TestRVRInternals(cloudstackTestCase): self.apiclient.connection.passwd, master_router.linklocalip, 'ip addr show eth2', - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: result = get_process_status( @@ -882,7 +883,7 @@ class TestRVRInternals(cloudstackTestCase): ) # Check eth2 port for backup router - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': result = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -890,7 +891,7 @@ class TestRVRInternals(cloudstackTestCase): self.apiclient.connction.passwd, backup_router.linklocalip, 'ip addr show eth2', - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: result = get_process_status( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_accounts.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index 45df911..b478ab8 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -729,6 +729,9 @@ class TestTemplateHierarchy(cloudstackTestCase): cls.api_client = super( TestTemplateHierarchy, cls).getClsTestClient().getApiClient() + cls.hypervisor = super( + TestTemplateHierarchy, + cls).getClsTestClient().getHypervisorInfo() cls.services = Services().services # Get Zone settings cls.zone = get_zone(cls.api_client, cls.services) @@ -772,7 +775,8 @@ class TestTemplateHierarchy(cloudstackTestCase): cls.services["template"], zoneid=cls.zone.id, account=cls.account_1.name, - domainid=cls.domain_1.id + domainid=cls.domain_1.id, + hypervisor=cls.hypervisor ) # Wait for template to download http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_base_image_updation.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_base_image_updation.py b/test/integration/component/test_base_image_updation.py index 2d6c83b..c663fe0 100644 --- a/test/integration/component/test_base_image_updation.py +++ b/test/integration/component/test_base_image_updation.py @@ -227,6 +227,7 @@ class TestBaseImageUpdate(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] @@ -416,7 +417,8 @@ class TestBaseImageUpdate(cloudstackTestCase): v, zoneid=self.zone.id, account=self.account.name, - domainid=self.account.domainid + domainid=self.account.domainid, + hypervisor=self.hypervisor ) self.debug( "Registered a template of format: %s with ID: %s" % ( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_blocker_bugs.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index 1ecbc77..d00218e 100644 --- a/test/integration/component/test_blocker_bugs.py +++ b/test/integration/component/test_blocker_bugs.py @@ -95,8 +95,8 @@ class Services: class TestTemplate(cloudstackTestCase): def setUp(self): - self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] return @@ -173,7 +173,8 @@ class TestTemplate(cloudstackTestCase): self.services["template"], zoneid=self.zone.id, account=self.account.name, - domainid=self.account.domainid + domainid=self.account.domainid, + hypervisor=self.hypervisor ) self.debug( "Registered a template of format: %s with ID: %s" % ( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_deploy_vm_userdata_reg.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_deploy_vm_userdata_reg.py b/test/integration/component/test_deploy_vm_userdata_reg.py index fa0a88c..321bc33 100755 --- a/test/integration/component/test_deploy_vm_userdata_reg.py +++ b/test/integration/component/test_deploy_vm_userdata_reg.py @@ -99,6 +99,10 @@ class TestDeployVmWithUserData(cloudstackTestCase): cls.user_data_2kl = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(1900)) + def setUp(self): + self.apiClient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() + @attr(tags=["simulator", "devcloud", "basic", "advanced"]) def test_deployvm_userdata_post(self): @@ -174,7 +178,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): host.passwd="password" cmd="cat /var/www/html/userdata/"+deployVmResponse.ipaddress+"/user-data" - if self.apiClient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': try: result = get_process_status( @@ -184,7 +188,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): self.apiClient.connection.passwd, router.linklocalip, cmd, - hypervisor=self.apiClient.hypervisor + hypervisor=self.hypervisor ) res = str(result) self.assertEqual(res.__contains__(self.userdata),True,"Userdata Not applied Check the failures") http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_routers.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py index 368db60..4fbac87 100644 --- a/test/integration/component/test_routers.py +++ b/test/integration/component/test_routers.py @@ -1122,6 +1122,7 @@ class TestRouterStopCreateFW(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.cleanup = [] return @@ -1267,7 +1268,7 @@ class TestRouterStopCreateFW(cloudstackTestCase): host.user, host.passwd = get_host_credentials(self.config, host.ipaddress) # For DNS and DHCP check 'dnsmasq' process status - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': result = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -1275,7 +1276,7 @@ class TestRouterStopCreateFW(cloudstackTestCase): self.apiclient.connection.passwd, router.linklocalip, 'iptables -t nat -L', - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_stopped_vm.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py index 5f3cea2..c3be273 100644 --- a/test/integration/component/test_stopped_vm.py +++ b/test/integration/component/test_stopped_vm.py @@ -1511,8 +1511,8 @@ class TestDeployVMFromTemplate(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) def setUp(self): - self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.services = Services().services self.services["virtual_machine"]["zoneid"] = self.zone.id @@ -1533,7 +1533,8 @@ class TestDeployVMFromTemplate(cloudstackTestCase): self.services["template"], zoneid=self.zone.id, account=self.account.name, - domainid=self.account.domainid + domainid=self.account.domainid, + hypervisor=self.hypervisor ) self.debug( "Registered a template of format: %s with ID: %s" % ( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/component/test_templates.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py index 6babe7e..8a168fb 100644 --- a/test/integration/component/test_templates.py +++ b/test/integration/component/test_templates.py @@ -101,8 +101,8 @@ class Services: class TestCreateTemplate(cloudstackTestCase): def setUp(self): - self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] return @@ -184,7 +184,8 @@ class TestCreateTemplate(cloudstackTestCase): self.services["templates"][0], zoneid=self.zone.id, account=self.account.name, - domainid=self.account.domainid + domainid=self.account.domainid, + hypervisor=self.hypervisor ) self.debug( "Registered a template of format: %s with ID: %s" % ( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/smoke/test_hosts.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py index 31af7fc..65e6d45 100644 --- a/test/integration/smoke/test_hosts.py +++ b/test/integration/smoke/test_hosts.py @@ -33,8 +33,8 @@ _multiprocess_shared_ = True class TestHosts(cloudstackTestCase): def setUp(self): - self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.services = self.testClient.getParsedTestDataConfig() self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) @@ -69,7 +69,8 @@ class TestHosts(cloudstackTestCase): self.apiclient, v, zoneid=self.zone.id, - podid=self.pod.id + podid=self.pod.id, + hypervisor=self.hypervisor ) self.debug( "Created Cluster for hypervisor type %s & ID: %s" %( @@ -100,7 +101,8 @@ class TestHosts(cloudstackTestCase): cluster, self.services["hosts"][hypervisor_type], zoneid=self.zone.id, - podid=self.pod.id + podid=self.pod.id, + hypervisor=self.hypervisor ) self.debug( "Created host (ID: %s) in cluster ID %s" %( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/smoke/test_routers.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py index 4432e90..c7fc1c1 100644 --- a/test/integration/smoke/test_routers.py +++ b/test/integration/smoke/test_routers.py @@ -95,6 +95,7 @@ class TestRouterServices(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() return @attr(tags = ["advanced", "basic", "sg", "smoke"]) @@ -147,7 +148,7 @@ class TestRouterServices(cloudstackTestCase): "Check list router response for router state" ) - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': result = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -155,7 +156,7 @@ class TestRouterServices(cloudstackTestCase): self.apiclient.connection.passwd, router.linklocalip, "service dnsmasq status", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: @@ -229,7 +230,7 @@ class TestRouterServices(cloudstackTestCase): "Check list router response for router state" ) - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': result = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -237,7 +238,7 @@ class TestRouterServices(cloudstackTestCase): self.apiclient.connection.passwd, router.linklocalip, "service dnsmasq status", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: @@ -261,7 +262,7 @@ class TestRouterServices(cloudstackTestCase): "Check dnsmasq service is running or not" ) - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': result = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -269,7 +270,7 @@ class TestRouterServices(cloudstackTestCase): self.apiclient.connection.passwd, router.linklocalip, "service haproxy status", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: @@ -440,7 +441,7 @@ class TestRouterServices(cloudstackTestCase): ) host = hosts[0] - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': res = get_process_status( self.apiclient.connection.mgtSvr, 22, @@ -448,7 +449,7 @@ class TestRouterServices(cloudstackTestCase): self.apiclient.connection.passwd, router.linklocalip, "uptime", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/test/integration/smoke/test_ssvm.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py index d67c55d..b03f8cc 100644 --- a/test/integration/smoke/test_ssvm.py +++ b/test/integration/smoke/test_ssvm.py @@ -37,6 +37,7 @@ class TestSSVMs(cloudstackTestCase): self.testClient = super(TestSSVMs, cls).getClsTestClient() self.apiclient = self.testClient.getApiClient() + self.hypervisor = self.testClient.getHypervisorInfo() self.cleanup = [] self.services = self.testClient.getParsedTestDataConfig() self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) @@ -320,7 +321,7 @@ class TestSSVMs(cloudstackTestCase): self.debug("Running SSVM check script") - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': #SSH into SSVMs is done via management server for Vmware result = get_process_status( self.apiclient.connection.mgtSvr, @@ -329,7 +330,7 @@ class TestSSVMs(cloudstackTestCase): self.apiclient.connection.passwd, ssvm.privateip, "/usr/local/cloud/systemvm/ssvm-check.sh |grep -e ERROR -e WARNING -e FAIL", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: @@ -360,7 +361,7 @@ class TestSSVMs(cloudstackTestCase): ) #Check status of cloud service - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': #SSH into SSVMs is done via management server for Vmware result = get_process_status( self.apiclient.connection.mgtSvr, @@ -369,7 +370,7 @@ class TestSSVMs(cloudstackTestCase): self.apiclient.connection.passwd, ssvm.privateip, "service cloud status", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: @@ -444,7 +445,7 @@ class TestSSVMs(cloudstackTestCase): self.debug("Checking cloud process status") - if self.apiclient.hypervisor.lower() == 'vmware': + if self.hypervisor.lower() == 'vmware': #SSH into SSVMs is done via management server for vmware result = get_process_status( self.apiclient.connection.mgtSvr, @@ -453,7 +454,7 @@ class TestSSVMs(cloudstackTestCase): self.apiclient.connection.passwd, cpvm.privateip, "service cloud status", - hypervisor=self.apiclient.hypervisor + hypervisor=self.hypervisor ) else: try: http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/tools/marvin/marvin/cloudstackTestClient.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index e3edd17..0dac5f4 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -65,6 +65,7 @@ class CSTestClient(object): self.__userApiClient = None self.__asyncJobMgr = None self.__id = None + self.__hypervisor = None self.__testDataFilePath = test_data_filepath self.__parsedTestDataConfig = None self.__zone = zone @@ -102,6 +103,19 @@ class CSTestClient(object): self.__zone = ret return self.__zone + def getHypervisorInfo(self): + ''' + @Name : getHypervisorInfo + @Desc : Provides the hypervisor Information to test users + ''' + if not self.__hypervisor: + if self.__mgmtDetails.hypervisor: + self.__hypervisor = self.__mgmtDetails.hypervisor + else: + self.__hypervisor = XEN_SERVER + return self.__hypervisor + + def __setHypervisorToClient(self): ''' @Name : ___setHypervisorToClient http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf77e9d6/tools/marvin/marvin/lib/base.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index aa23029..c0c6f13 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -317,7 +317,7 @@ class VirtualMachine: domainid=None, zoneid=None, networkids=None, serviceofferingid=None, securitygroupids=None, projectid=None, startvm=None, diskofferingid=None, affinitygroupnames=None, affinitygroupids=None, group=None, - hostid=None, keypair=None, ipaddress=None, mode='default', method='GET'): + hostid=None, keypair=None, ipaddress=None, mode='default', method='GET',hypervisor=None): """Create the instance""" cmd = deployVirtualMachine.deployVirtualMachineCmd() @@ -880,7 +880,7 @@ class Template: @classmethod def register(cls, apiclient, services, zoneid=None, - account=None, domainid=None): + account=None, domainid=None, hypervisor=None): """Create template from URL""" # Create template from Virtual machine and Volume ID @@ -888,7 +888,7 @@ class Template: cmd.displaytext = services["displaytext"] cmd.name = "-".join([services["name"], random_gen()]) cmd.format = services["format"] - cmd.hypervisor = apiclient.hypervisor + cmd.hypervisor = hypervisor if "ostypeid" in services: cmd.ostypeid = services["ostypeid"] @@ -1731,11 +1731,11 @@ class Cluster: self.__dict__.update(items) @classmethod - def create(cls, apiclient, services, zoneid=None, podid=None): + def create(cls, apiclient, services, zoneid=None, podid=None, hypervisor=None): """Create Cluster""" cmd = addCluster.addClusterCmd() cmd.clustertype = services["clustertype"] - cmd.hypervisor = apiclient.hypervisor + cmd.hypervisor = hypervisor if zoneid: cmd.zoneid = zoneid @@ -1781,11 +1781,11 @@ class Host: self.__dict__.update(items) @classmethod - def create(cls, apiclient, cluster, services, zoneid=None, podid=None): + def create(cls, apiclient, cluster, services, zoneid=None, podid=None, hypervisor=None): """Create Host in cluster""" cmd = addHost.addHostCmd() - cmd.hypervisor = apiclient.hypervisor + cmd.hypervisor = hypervisor cmd.url = services["url"] cmd.clusterid = cluster.id
