MCPcopy Create free account
hub / github.com/apache/cloudstack / setUpClass

Method setUpClass

test/integration/component/test_volumes.py:51–130  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

49
50 @classmethod
51 def setUpClass(cls):
52 cls.testClient = super(TestAttachVolume, cls).getClsTestClient()
53 cls.api_client = cls.testClient.getApiClient()
54 cls.testdata = cls.testClient.getParsedTestDataConfig()
55
56 # Get Zone, Domain and templates
57 cls.domain = get_domain(cls.api_client)
58 cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
59 cls.pod = get_pod(cls.api_client, cls.zone.id)
60 cls.testdata['mode'] = cls.zone.networktype
61 cls._cleanup = []
62 cls.unsupportedStorageType = False
63 cls.hypervisor = cls.testClient.getHypervisorInfo()
64 if cls.hypervisor.lower() == 'lxc':
65 if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
66 cls.unsupportedStorageType = True
67 return
68 cls.disk_offering = DiskOffering.create(
69 cls.api_client,
70 cls.testdata["disk_offering"]
71 )
72 cls._cleanup.append(cls.disk_offering)
73 cls.template = get_template(
74 cls.api_client,
75 cls.zone.id,
76 cls.testdata["ostype"]
77 )
78 # get max data volumes limit based on the hypervisor type and version
79 listHost = Host.list(
80 cls.api_client,
81 type='Routing',
82 zoneid=cls.zone.id,
83 podid=cls.pod.id,
84 )
85 ver = listHost[0].hypervisorversion
86 hv = listHost[0].hypervisor
87 cmd = listHypervisorCapabilities.listHypervisorCapabilitiesCmd()
88 cmd.hypervisor = hv
89 res = cls.api_client.listHypervisorCapabilities(cmd)
90 cls.debug('Hypervisor Capabilities: {}'.format(res))
91 for i in range(len(res)):
92 if res[i].hypervisorversion == ver:
93 break
94 cls.max_data_volumes = int(res[i].maxdatavolumeslimit)
95 if 'kvm' in cls.hypervisor:
96 cls.max_data_volumes = 24
97 cls.debug('max data volumes:{}'.format(cls.max_data_volumes))
98 cls.testdata["volume"]["max"] = cls.max_data_volumes
99 # Create VMs, NAT Rules etc
100 cls.account = Account.create(
101 cls.api_client,
102 cls.testdata["account"],
103 domainid=cls.domain.id
104 )
105 cls._cleanup.append(cls.account)
106 update_resource_limit(
107 cls.api_client,
108 2, # Instance

Callers

nothing calls this directly

Calls 15

get_domainFunction · 0.90
get_zoneFunction · 0.90
get_podFunction · 0.90
find_storage_pool_typeFunction · 0.90
get_templateFunction · 0.90
update_resource_limitFunction · 0.90
intFunction · 0.85
getClsTestClientMethod · 0.80
getApiClientMethod · 0.80
getZoneForTestsMethod · 0.80
getHypervisorInfoMethod · 0.80

Tested by

no test coverage detected