diff --git a/test/integration/component/maint/test_redundant_router.py b/test/integration/component/maint/test_redundant_router.py index e28227298d8..245ce37f08f 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( diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index 45df9118184..b478ab8bd57 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 diff --git a/test/integration/component/test_base_image_updation.py b/test/integration/component/test_base_image_updation.py index 2d6c83b874b..c663fe099b4 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" % ( diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index 1ecbc7793ae..d00218e611d 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" % ( diff --git a/test/integration/component/test_deploy_vm_userdata_reg.py b/test/integration/component/test_deploy_vm_userdata_reg.py index fa0a88c03a0..321bc330efa 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") diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py index 368db60ee10..4fbac87282d 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: diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py index 5f3cea2e0c9..c3be27352ff 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" % ( diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py index 6babe7e7653..8a168fbce09 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" % ( diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py index 31af7fca6e7..65e6d45d1c2 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" %( diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py index 4432e905733..c7fc1c10abd 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: diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py index d67c55d9367..b03f8cca4b2 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: diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index e3edd177535..0dac5f49d48 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 diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index aa23029f6e7..c0c6f13e928 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