(cls)
| 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 |
nothing calls this directly
no test coverage detected