-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathTestManagedSystemVMs.py
More file actions
626 lines (480 loc) · 24.1 KB
/
Copy pathTestManagedSystemVMs.py
File metadata and controls
626 lines (480 loc) · 24.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import logging
import random
import SignedAPICall
import XenAPI
from solidfire.factory import ElementFactory
from util import sf_util
from marvin.cloudstackAPI import destroySystemVm
# All tests inherit from cloudstackTestCase
from marvin.cloudstackTestCase import cloudstackTestCase
# Import Integration Libraries
# base - contains all resources as entities and defines create, delete, list operations on them
from marvin.lib.base import Account, Router, ServiceOffering, StoragePool, User, VirtualMachine, Zone
# common - commonly used methods for all tests are listed here
from marvin.lib.common import get_domain, get_template, get_zone, list_clusters, list_hosts, list_ssvms, list_routers
# utils - utility classes for common cleanup, external library wrappers, etc.
from marvin.lib.utils import cleanup_resources, wait_until
# Prerequisites:
# * Only use one SolidFire cluster for the two primary storages based on the "SolidFire" storage plug-in.
# * Do not run other workloads on the SolidFire cluster while running this test as this test checks at a certain
# point to make sure no active SolidFire volumes exist.
# * Only one zone
# * Only one secondary storage VM and one console proxy VM running on NFS (no virtual router or user VMs exist)
# * Only one pod
# * Only one cluster
#
# Running the tests:
# Change the "hypervisor_type" variable to control which hypervisor type to test.
# If using XenServer, verify the "xen_server_hostname" variable is correct.
# Set the Global Setting "storage.cleanup.enabled" to true.
# Set the Global Setting "storage.cleanup.interval" to 150.
# Set the Global Setting "storage.cleanup.delay" to 60.
class TestData():
# constants
account = "account"
capacityBytes = "capacitybytes"
capacityIops = "capacityiops"
clusterId = "clusterid"
computeOffering = "computeoffering"
diskOffering = "diskoffering"
domainId = "domainid"
email = "email"
firstname = "firstname"
hypervisor = "hypervisor"
kvm = "kvm"
lastname = "lastname"
max_iops = "maxiops"
min_iops = "miniops"
mvip = "mvip"
name = "name"
password = "password"
port = "port"
primaryStorage = "primarystorage"
provider = "provider"
scope = "scope"
solidFire = "solidfire"
storageTag = "SolidFire_SAN_1"
systemOffering = "systemoffering"
systemOfferingFailure = "systemofferingFailure"
tags = "tags"
url = "url"
user = "user"
username = "username"
virtualMachine = "virtualmachine"
xenServer = "xenserver"
zoneId = "zoneid"
# modify to control which hypervisor type to test
hypervisor_type = xenServer
xen_server_hostname = "XenServer-6.5-1"
def __init__(self):
self.testdata = {
TestData.solidFire: {
TestData.mvip: "10.117.40.120",
TestData.username: "admin",
TestData.password: "admin",
TestData.port: 443,
TestData.url: "https://10.117.40.120:443"
},
TestData.kvm: {
TestData.username: "root",
TestData.password: "solidfire"
},
TestData.xenServer: {
TestData.username: "root",
TestData.password: "solidfire"
},
TestData.account: {
TestData.email: "test@test.com",
TestData.firstname: "John",
TestData.lastname: "Doe",
TestData.username: "test",
TestData.password: "test"
},
TestData.user: {
TestData.email: "user@test.com",
TestData.firstname: "Jane",
TestData.lastname: "Doe",
TestData.username: "testuser",
TestData.password: "password"
},
TestData.primaryStorage: {
TestData.name: TestData.get_name_for_solidfire_storage(),
TestData.scope: "ZONE",
TestData.url: "MVIP=10.117.40.120;SVIP=10.117.41.120;" +
"clusterAdminUsername=admin;clusterAdminPassword=admin;" +
"clusterDefaultMinIops=10000;clusterDefaultMaxIops=15000;" +
"clusterDefaultBurstIopsPercentOfMaxIops=1.5;",
TestData.provider: "SolidFire",
TestData.tags: TestData.storageTag,
TestData.capacityIops: 4500000,
TestData.capacityBytes: 2251799813685248,
TestData.hypervisor: "Any",
TestData.zoneId: 1
},
TestData.virtualMachine: {
TestData.name: "TestVM",
"displayname": "Test VM"
},
TestData.computeOffering: {
TestData.name: "SF_CO_1",
"displaytext": "SF_CO_1 (Min IOPS = 10,000; Max IOPS = 15,000)",
"cpunumber": 1,
"cpuspeed": 100,
"memory": 128,
"storagetype": "shared",
"customizediops": False,
TestData.min_iops: 10000,
TestData.max_iops: 15000,
"hypervisorsnapshotreserve": 200,
TestData.tags: TestData.storageTag
},
TestData.systemOffering: {
TestData.name: "SF_SO_1",
"displaytext": "Managed SO (Min IOPS = 4,000; Max IOPS = 8,000)",
"cpunumber": 1,
"cpuspeed": 100,
"memory": 128,
"storagetype": "shared",
TestData.min_iops: 4000,
TestData.max_iops: 8000,
TestData.tags: TestData.storageTag,
"issystem": True
},
TestData.systemOfferingFailure: {
TestData.name: "SF_SO_2",
"displaytext": "Managed SO (Customized IOPS)",
"cpunumber": 1,
"cpuspeed": 100,
"memory": 128,
"storagetype": "shared",
"customizediops": True,
TestData.tags: TestData.storageTag,
"issystem": True
},
TestData.zoneId: 1,
TestData.clusterId: 1,
TestData.domainId: 1,
TestData.url: "10.117.40.114"
}
@staticmethod
def get_name_for_solidfire_storage():
return "SolidFire-%d" % random.randint(0, 100)
class TestManagedSystemVMs(cloudstackTestCase):
_unique_name_suffix = "-Temp"
_secondary_storage_unique_name = "Cloud.com-SecondaryStorage"
_secondary_storage_temp_unique_name = _secondary_storage_unique_name + _unique_name_suffix
_console_proxy_unique_name = "Cloud.com-ConsoleProxy"
_console_proxy_temp_unique_name = _console_proxy_unique_name + _unique_name_suffix
_virtual_router_unique_name = "Cloud.com-SoftwareRouter"
_virtual_router_temp_unique_name = _virtual_router_unique_name + _unique_name_suffix
@classmethod
def setUpClass(cls):
# Set up API client
testclient = super(TestManagedSystemVMs, cls).getClsTestClient()
cls.apiClient = testclient.getApiClient()
cls.configData = testclient.getParsedTestDataConfig()
cls.dbConnection = testclient.getDbConnection()
cls.testdata = TestData().testdata
cls._connect_to_hypervisor()
# Set up SolidFire connection
solidfire = cls.testdata[TestData.solidFire]
cls.sfe = ElementFactory.create(solidfire[TestData.mvip], solidfire[TestData.username], solidfire[TestData.password])
# Get Resources from Cloud Infrastructure
cls.zone = Zone(get_zone(cls.apiClient, zone_id=cls.testdata[TestData.zoneId]).__dict__)
cls.cluster = list_clusters(cls.apiClient)[0]
cls.template = get_template(cls.apiClient, cls.zone.id, hypervisor=TestData.hypervisor_type)
cls.domain = get_domain(cls.apiClient, cls.testdata[TestData.domainId])
# Create test account
cls.account = Account.create(
cls.apiClient,
cls.testdata["account"],
admin=1
)
# Set up connection to make customized API calls
cls.user = User.create(
cls.apiClient,
cls.testdata["user"],
account=cls.account.name,
domainid=cls.domain.id
)
url = cls.testdata[TestData.url]
api_url = "http://" + url + ":8080/client/api"
userkeys = User.registerUserKeys(cls.apiClient, cls.user.id)
cls.cs_api = SignedAPICall.CloudStack(api_url, userkeys.apikey, userkeys.secretkey)
cls.compute_offering = ServiceOffering.create(
cls.apiClient,
cls.testdata[TestData.computeOffering]
)
systemoffering = cls.testdata[TestData.systemOffering]
systemoffering[TestData.name] = "Managed SSVM"
systemoffering['systemvmtype'] = "secondarystoragevm"
cls.secondary_storage_offering = ServiceOffering.create(
cls.apiClient,
systemoffering
)
systemoffering[TestData.name] = "Managed CPVM"
systemoffering['systemvmtype'] = "consoleproxy"
cls.console_proxy_offering = ServiceOffering.create(
cls.apiClient,
systemoffering
)
systemoffering[TestData.name] = "Managed VR"
systemoffering['systemvmtype'] = "domainrouter"
cls.virtual_router_offering = ServiceOffering.create(
cls.apiClient,
systemoffering
)
# Resources that are to be destroyed
cls._cleanup = [
cls.secondary_storage_offering,
cls.console_proxy_offering,
cls.virtual_router_offering,
cls.compute_offering,
cls.user,
cls.account
]
@classmethod
def tearDownClass(cls):
try:
cleanup_resources(cls.apiClient, cls._cleanup)
except Exception as e:
logging.debug("Exception in tearDownClass(cls): %s" % e)
def setUp(self):
self.cleanup = []
def tearDown(self):
try:
cleanup_resources(self.apiClient, self.cleanup)
sf_util.purge_solidfire_volumes(self.sfe)
except Exception as e:
logging.debug("Exception in tearDownClass(self): %s" % e)
def test_01_create_system_vms_on_managed_storage(self):
self._disable_zone_and_delete_system_vms(None, False)
primary_storage = self.testdata[TestData.primaryStorage]
primary_storage_1 = StoragePool.create(
self.apiClient,
primary_storage
)
self._prepare_to_use_managed_storage_for_system_vms()
enabled = "Enabled"
self.zone.update(self.apiClient, id=self.zone.id, allocationstate=enabled)
system_vms = self._wait_for_and_get_running_system_vms(2)
virtual_machine = VirtualMachine.create(
self.apiClient,
self.testdata[TestData.virtualMachine],
accountid=self.account.name,
zoneid=self.zone.id,
serviceofferingid=self.compute_offering.id,
templateid=self.template.id,
domainid=self.domain.id,
startvm=True
)
# This virtual machine was only created and started so that the virtual router would be created and started.
# Just delete this virtual machine once it has been created and started.
virtual_machine.delete(self.apiClient, True)
virtual_router = list_routers(self.apiClient, listall=True, state="Running")[0]
system_vms.append(virtual_router)
self._check_system_vms(system_vms, primary_storage_1.id)
primary_storage[TestData.name] = TestData.get_name_for_solidfire_storage()
primary_storage_2 = StoragePool.create(
self.apiClient,
primary_storage
)
StoragePool.enableMaintenance(self.apiClient, primary_storage_1.id)
self._wait_for_storage_cleanup_thread(system_vms)
sf_util.purge_solidfire_volumes(self.sfe)
system_vms = self._wait_for_and_get_running_system_vms(2)
virtual_router = list_routers(self.apiClient, listall=True, state="Running")[0]
system_vms.append(virtual_router)
self._check_system_vms(system_vms, primary_storage_2.id)
StoragePool.cancelMaintenance(self.apiClient, primary_storage_1.id)
primary_storage_1.delete(self.apiClient)
self._disable_zone_and_delete_system_vms(virtual_router)
self._wait_for_storage_cleanup_thread(system_vms)
sf_util.purge_solidfire_volumes(self.sfe)
primary_storage_2.delete(self.apiClient)
self._verify_no_active_solidfire_volumes()
self._prepare_to_stop_using_managed_storage_for_system_vms()
self.zone.update(self.apiClient, id=self.zone.id, allocationstate=enabled)
self._wait_for_and_get_running_system_vms(2)
def test_02_failure_to_create_service_offering_with_customized_iops(self):
try:
ServiceOffering.create(
self.apiClient,
self.testdata[TestData.systemOfferingFailure]
)
except:
return
self.assertTrue(False, "The service offering was created, but should not have been.")
def _prepare_to_use_managed_storage_for_system_vms(self):
self._update_system_vm_unique_name(TestManagedSystemVMs._secondary_storage_unique_name, TestManagedSystemVMs._secondary_storage_temp_unique_name)
self._update_system_vm_unique_name(TestManagedSystemVMs._console_proxy_unique_name, TestManagedSystemVMs._console_proxy_temp_unique_name)
self._update_system_vm_unique_name(TestManagedSystemVMs._virtual_router_unique_name, TestManagedSystemVMs._virtual_router_temp_unique_name)
self._update_system_vm_unique_name_based_on_uuid(self.secondary_storage_offering.id, TestManagedSystemVMs._secondary_storage_unique_name)
self._update_system_vm_unique_name_based_on_uuid(self.console_proxy_offering.id, TestManagedSystemVMs._console_proxy_unique_name)
self._update_system_vm_unique_name_based_on_uuid(self.virtual_router_offering.id, TestManagedSystemVMs._virtual_router_unique_name)
def _prepare_to_stop_using_managed_storage_for_system_vms(self):
self._update_system_vm_unique_name_based_on_uuid(self.secondary_storage_offering.id, None)
self._update_system_vm_unique_name_based_on_uuid(self.console_proxy_offering.id, None)
self._update_system_vm_unique_name_based_on_uuid(self.virtual_router_offering.id, None)
self._update_system_vm_unique_name(TestManagedSystemVMs._secondary_storage_temp_unique_name, TestManagedSystemVMs._secondary_storage_unique_name)
self._update_system_vm_unique_name(TestManagedSystemVMs._console_proxy_temp_unique_name, TestManagedSystemVMs._console_proxy_unique_name)
self._update_system_vm_unique_name(TestManagedSystemVMs._virtual_router_temp_unique_name, TestManagedSystemVMs._virtual_router_unique_name)
def _wait_for_storage_cleanup_thread(self, system_vms):
retry_interval = 60
num_tries = 10
wait_result, return_val = wait_until(retry_interval, num_tries, self._check_resource_state, system_vms)
if not wait_result:
raise Exception(return_val)
def _check_resource_state(self, system_vms):
try:
self._verify_system_vms_deleted(system_vms)
return True, None
except:
return False, "The system is not in the necessary state."
def _verify_system_vms_deleted(self, system_vms):
for system_vm in system_vms:
cs_root_volume = self._get_root_volume_for_system_vm(system_vm.id, 'Expunged')
self._verify_managed_system_vm_deleted(cs_root_volume.name)
def _disable_zone_and_delete_system_vms(self, virtual_router, verify_managed_system_vm_deleted=True):
self.zone.update(self.apiClient, id=self.zone.id, allocationstate="Disabled")
if virtual_router is not None:
Router.destroy(self.apiClient, virtual_router.id)
if verify_managed_system_vm_deleted:
cs_root_volume = self._get_root_volume_for_system_vm(virtual_router.id, 'Expunged')
self._verify_managed_system_vm_deleted(cs_root_volume.name)
# list_ssvms lists the secondary storage VM and the console proxy VM
system_vms = list_ssvms(self.apiClient)
for system_vm in system_vms:
destroy_ssvm_cmd = destroySystemVm.destroySystemVmCmd()
destroy_ssvm_cmd.id = system_vm.id
self.apiClient.destroySystemVm(destroy_ssvm_cmd)
if verify_managed_system_vm_deleted:
cs_root_volume = self._get_root_volume_for_system_vm(system_vm.id, 'Expunged')
self._verify_managed_system_vm_deleted(cs_root_volume.name)
def _verify_managed_system_vm_deleted(self, cs_root_volume_name):
sf_not_active_volumes = sf_util.get_not_active_sf_volumes(self.sfe)
sf_root_volume = sf_util.check_and_get_sf_volume(sf_not_active_volumes, cs_root_volume_name, self)
self.assertEqual(
len(sf_root_volume.volume_access_groups),
0,
"The volume should not be in a volume access group."
)
if TestData.hypervisor_type == TestData.xenServer:
sr_name = sf_util.format_iqn(sf_root_volume.iqn)
sf_util.check_xen_sr(sr_name, self.xen_session, self, False)
elif TestData.hypervisor_type == TestData.kvm:
list_hosts_response = list_hosts(
self.apiClient,
type="Routing"
)
kvm_login = self.testdata[TestData.kvm]
sf_util.check_kvm_access_to_volume(sf_root_volume.iqn, list_hosts_response, kvm_login[TestData.username], kvm_login[TestData.password], self, False)
else:
self.assertTrue(False, "Invalid hypervisor type")
def _wait_for_and_get_running_system_vms(self, expected_number_of_system_vms):
retry_interval = 60
num_tries = 10
wait_result, return_val = wait_until(retry_interval, num_tries, self._check_number_of_running_system_vms, expected_number_of_system_vms)
if not wait_result:
raise Exception(return_val)
return return_val
def _check_number_of_running_system_vms(self, expected_number_of_system_vms):
# list_ssvms lists the secondary storage VM and the console proxy VM
system_vms = list_ssvms(self.apiClient, state="Running")
if system_vms is not None and len(system_vms) == expected_number_of_system_vms:
return True, system_vms
return False, "Timed out waiting for running system VMs"
def _verify_no_active_solidfire_volumes(self):
sf_active_volumes = sf_util.get_active_sf_volumes(self.sfe)
sf_util.check_list(sf_active_volumes, 0, self, "There should be no active SolidFire volumes in the cluster.")
def _check_system_vms(self, system_vms, primary_storage_id):
sf_active_volumes = sf_util.get_active_sf_volumes(self.sfe)
sf_vag_id = sf_util.get_vag_id(self.cs_api, self.cluster.id, primary_storage_id, self)
for system_vm in system_vms:
cs_root_volume = self._get_root_volume_for_system_vm(system_vm.id, 'Ready')
sf_root_volume = sf_util.check_and_get_sf_volume(sf_active_volumes, cs_root_volume.name, self)
sf_volume_size = sf_util.get_volume_size_with_hsr(self.cs_api, cs_root_volume, self)
sf_util.check_size_and_iops(sf_root_volume, cs_root_volume, sf_volume_size, self)
self._check_iops_against_iops_of_system_offering(cs_root_volume, self.testdata[TestData.systemOffering])
sf_util.check_vag(sf_root_volume, sf_vag_id, self)
if TestData.hypervisor_type == TestData.xenServer:
sr_name = sf_util.format_iqn(sf_root_volume.iqn)
sf_util.check_xen_sr(sr_name, self.xen_session, self)
elif TestData.hypervisor_type == TestData.kvm:
list_hosts_response = list_hosts(
self.apiClient,
type="Routing"
)
kvm_login = self.testdata[TestData.kvm]
sf_util.check_kvm_access_to_volume(sf_root_volume.iqn, list_hosts_response, kvm_login[TestData.username], kvm_login[TestData.password], self)
else:
self.assertTrue(False, "Invalid hypervisor type")
def _check_iops_against_iops_of_system_offering(self, cs_volume, system_offering):
self.assertEqual(
system_offering[TestData.min_iops],
cs_volume.miniops,
"Check QoS - Min IOPS: of " + cs_volume.name + " should be " + str(system_offering[TestData.min_iops])
)
self.assertEqual(
system_offering[TestData.max_iops],
cs_volume.maxiops,
"Check QoS - Min IOPS: of " + cs_volume.name + " should be " + str(system_offering[TestData.max_iops])
)
def _get_root_volume_for_system_vm(self, system_vm_id, state):
sql_query = "Select id From vm_instance Where uuid = '" + system_vm_id + "'"
# make sure you can connect to MySQL: https://teamtreehouse.com/community/cant-connect-remotely-to-mysql-server-with-mysql-workbench
sql_result = self.dbConnection.execute(sql_query)
instance_id = sql_result[0][0]
sql_query = "Select uuid, name, min_iops, max_iops From volumes Where instance_id = " + str(instance_id) + \
" and state = '" + state + "' Order by removed desc"
# make sure you can connect to MySQL: https://teamtreehouse.com/community/cant-connect-remotely-to-mysql-server-with-mysql-workbench
sql_result = self.dbConnection.execute(sql_query)
uuid = sql_result[0][0]
name = sql_result[0][1]
min_iops = sql_result[0][2]
max_iops = sql_result[0][3]
class CloudStackVolume(object):
pass
cs_volume = CloudStackVolume()
cs_volume.id = uuid
cs_volume.name = name
cs_volume.miniops = min_iops
cs_volume.maxiops = max_iops
return cs_volume
def _update_system_vm_unique_name(self, unique_name, new_unique_name):
sql_query = "Update disk_offering set unique_name = '" + new_unique_name + "' Where unique_name = '" + unique_name + "'"
# make sure you can connect to MySQL: https://teamtreehouse.com/community/cant-connect-remotely-to-mysql-server-with-mysql-workbench
self.dbConnection.execute(sql_query)
def _update_system_vm_unique_name_based_on_uuid(self, uuid, new_unique_name):
if (new_unique_name is None):
sql_query = "Update disk_offering set unique_name = NULL Where uuid = '" + uuid + "'"
else:
sql_query = "Update disk_offering set unique_name = '" + new_unique_name + "' Where uuid = '" + uuid + "'"
# make sure you can connect to MySQL: https://teamtreehouse.com/community/cant-connect-remotely-to-mysql-server-with-mysql-workbench
self.dbConnection.execute(sql_query)
@classmethod
def _connect_to_hypervisor(cls):
if TestData.hypervisor_type == TestData.kvm:
pass
elif TestData.hypervisor_type == TestData.xenServer:
host_ip = "https://" + \
list_hosts(cls.apiClient, clusterid=cls.testdata[TestData.clusterId], name=TestData.xen_server_hostname)[0].ipaddress
cls.xen_session = XenAPI.Session(host_ip)
xen_server = cls.testdata[TestData.xenServer]
cls.xen_session.xenapi.login_with_password(xen_server[TestData.username], xen_server[TestData.password])