mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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
This commit is contained in:
parent
d06f2b6a70
commit
bf77e9d669
@ -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(
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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" % (
|
||||
|
||||
@ -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" % (
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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" % (
|
||||
|
||||
@ -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" % (
|
||||
|
||||
@ -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" %(
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user