mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Refactoring StorPool tests (#11107)
* Refactor StorPool smoke tests * Marvin confing template for StorPool tests
This commit is contained in:
parent
bcd738caa6
commit
5aa15187b6
@ -84,6 +84,12 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
cls.helper = StorPoolHelper()
|
||||
sp_pools = cls.helper.get_pool(zone)
|
||||
assert sp_pools is not None
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
testClient = super(TestMigrateVolumeToAnotherPool, cls).getClsTestClient()
|
||||
cls.apiclient = testClient.getApiClient()
|
||||
@ -103,11 +109,8 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
cls.helper = StorPoolHelper()
|
||||
storpool_primary_storage = cls.testdata[TestData.primaryStorage]
|
||||
cls.template_name = storpool_primary_storage.get("name")
|
||||
storpool_primary_storage = sp_pools[0]
|
||||
cls.template_name = storpool_primary_storage["name"]
|
||||
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
||||
|
||||
nfs_service_offerings = cls.testdata[TestData.serviceOfferingsPrimary]
|
||||
@ -283,12 +286,6 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
||||
@classmethod
|
||||
def cleanUpCloudStack(cls):
|
||||
try:
|
||||
if cls.nfs_storage_pool.state is not "Maintenance":
|
||||
cls.nfs_storage_pool = StoragePool.enableMaintenance(cls.apiclient, cls.nfs_storage_pool.id)
|
||||
|
||||
if cls.ceph_storage_pool.state is not "Maintenance":
|
||||
cls.ceph_storage_pool = StoragePool.enableMaintenance(cls.apiclient, cls.ceph_storage_pool.id)
|
||||
|
||||
cls.storage_pool = StoragePool.update(cls.apiclient,
|
||||
id=cls.storage_pool.id,
|
||||
tags = ["ssd"])
|
||||
|
||||
@ -97,9 +97,18 @@ class TestEncryptedVolumes(cloudstackTestCase):
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
|
||||
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||
storage_pools = zone.primaryStorages
|
||||
sp_pools = []
|
||||
for storage in storage_pools:
|
||||
if storage['provider'] and "StorPool" in storage['provider']:
|
||||
sp_pools.append(storage)
|
||||
|
||||
if len(sp_pools) < 2:
|
||||
cls.debug("Cannot perform the tests because there aren't the required count of StorPool storage pools %s" % sp_pools)
|
||||
return
|
||||
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
cls.helper = StorPoolHelper()
|
||||
@ -118,48 +127,43 @@ class TestEncryptedVolumes(cloudstackTestCase):
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
|
||||
cls.sp_template_1 = "ssd"
|
||||
storpool_primary_storage = {
|
||||
"name": cls.sp_template_1,
|
||||
"zoneid": cls.zone.id,
|
||||
"url": "SP_API_HTTP=%s:%s;SP_AUTH_TOKEN=%s;SP_TEMPLATE=%s" % (zone.spEndpoint, zone.spEndpointPort, zone.spAuthToken, cls.sp_template_1),
|
||||
"scope": "zone",
|
||||
"capacitybytes": 564325555333,
|
||||
"capacityiops": 155466,
|
||||
"hypervisor": "kvm",
|
||||
"provider": "StorPool",
|
||||
"tags": cls.sp_template_1
|
||||
}
|
||||
|
||||
cls.storpool_primary_storage = storpool_primary_storage
|
||||
storpool_primary_storage = sp_pools[0]
|
||||
cls.template_name = storpool_primary_storage["name"]
|
||||
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=storpool_primary_storage["name"]
|
||||
name=cls.template_name
|
||||
)
|
||||
|
||||
if storage_pool is None:
|
||||
newTemplate = sptypes.VolumeTemplateCreateDesc(name=storpool_primary_storage["name"], placeAll="virtual",
|
||||
placeTail="virtual", placeHead="virtual", replication=1)
|
||||
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)
|
||||
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.storage_pool = storage_pool
|
||||
cls.helper.updateStoragePoolTags(cls.apiclient, cls.storage_pool.id, cls.testdata[TestData.sp_template_1]["tags"])
|
||||
|
||||
cls.debug(pprint.pformat(storage_pool))
|
||||
|
||||
cls.primary_storage = storage_pool
|
||||
|
||||
storpool_service_offerings_ssd = {
|
||||
"name": "ssd-encrypted",
|
||||
"displaytext": "SP_CO_2 (Min IOPS = 10,000; Max IOPS = 15,000)",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 500,
|
||||
"memory": 512,
|
||||
"storagetype": "shared",
|
||||
"customizediops": False,
|
||||
"hypervisorsnapshotreserve": 200,
|
||||
"encryptroot": True,
|
||||
"tags": cls.sp_template_1
|
||||
}
|
||||
storpool_primary_storage = sp_pools[1]
|
||||
cls.template_name = storpool_primary_storage["name"]
|
||||
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
if storage_pool is None:
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.storage_pool = storage_pool
|
||||
cls.helper.updateStoragePoolTags(cls.apiclient, cls.storage_pool.id, cls.testdata[TestData.sp_template_2]["tags"])
|
||||
|
||||
cls.debug(pprint.pformat(storage_pool))
|
||||
|
||||
cls.primary_storage2 = storage_pool
|
||||
|
||||
storpool_service_offerings_ssd = cls.testdata[TestData.serviceOfferingEncrypted]
|
||||
|
||||
service_offerings_ssd = list_service_offering(
|
||||
cls.apiclient,
|
||||
@ -174,69 +178,6 @@ class TestEncryptedVolumes(cloudstackTestCase):
|
||||
cls.service_offering = service_offerings_ssd
|
||||
cls.debug(pprint.pformat(cls.service_offering))
|
||||
|
||||
cls.sp_template_2 = "ssd2"
|
||||
|
||||
storpool_primary_storage2 = {
|
||||
"name": cls.sp_template_2,
|
||||
"zoneid": cls.zone.id,
|
||||
"url": "SP_API_HTTP=%s:%s;SP_AUTH_TOKEN=%s;SP_TEMPLATE=%s" % (zone.spEndpoint, zone.spEndpointPort, zone.spAuthToken, cls.sp_template_2),
|
||||
"scope": "zone",
|
||||
"capacitybytes": 564325555333,
|
||||
"capacityiops": 1554,
|
||||
"hypervisor": "kvm",
|
||||
"provider": "StorPool",
|
||||
"tags": cls.sp_template_2
|
||||
}
|
||||
|
||||
cls.storpool_primary_storage2 = storpool_primary_storage2
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=storpool_primary_storage2["name"]
|
||||
)
|
||||
|
||||
if storage_pool is None:
|
||||
newTemplate = sptypes.VolumeTemplateCreateDesc(name=storpool_primary_storage2["name"], placeAll="virtual",
|
||||
placeTail="virtual", placeHead="virtual", replication=1)
|
||||
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage2)
|
||||
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.primary_storage2 = storage_pool
|
||||
|
||||
storpool_service_offerings_ssd2 = {
|
||||
"name": "ssd2-encrypted",
|
||||
"displaytext": "SP_CO_2",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 500,
|
||||
"memory": 512,
|
||||
"storagetype": "shared",
|
||||
"customizediops": False,
|
||||
"encryptroot": True,
|
||||
"tags": cls.sp_template_2
|
||||
}
|
||||
|
||||
service_offerings_ssd2 = list_service_offering(
|
||||
cls.apiclient,
|
||||
name=storpool_service_offerings_ssd2["name"]
|
||||
)
|
||||
|
||||
if service_offerings_ssd2 is None:
|
||||
service_offerings_ssd2 = ServiceOffering.create(cls.apiclient, storpool_service_offerings_ssd2, encryptroot=True)
|
||||
else:
|
||||
service_offerings_ssd2 = service_offerings_ssd2[0]
|
||||
|
||||
cls.service_offering2 = service_offerings_ssd2
|
||||
|
||||
cls.disk_offerings_ssd2_encrypted = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name=cls.testdata[TestData.diskOfferingEncrypted2]["name"]
|
||||
)
|
||||
if cls.disk_offerings_ssd2_encrypted is None:
|
||||
cls.disk_offerings_ssd2_encrypted = DiskOffering.create(cls.apiclient, cls.testdata[TestData.diskOfferingEncrypted2], encrypt=True)
|
||||
else:
|
||||
cls.disk_offerings_ssd2_encrypted = cls.disk_offerings_ssd2_encrypted[0]
|
||||
|
||||
cls.disk_offering_ssd_encrypted = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name=cls.testdata[TestData.diskOfferingEncrypted]["name"]
|
||||
|
||||
@ -32,6 +32,7 @@ from marvin.lib.base import (Account,
|
||||
Volume,
|
||||
SecurityGroup,
|
||||
Role,
|
||||
DiskOffering,
|
||||
)
|
||||
from marvin.lib.common import (get_zone,
|
||||
get_domain,
|
||||
@ -79,17 +80,24 @@ class TestStoragePool(cloudstackTestCase):
|
||||
def setUpCloudStack(cls):
|
||||
config = cls.getClsConfig()
|
||||
StorPoolHelper.logger = cls
|
||||
cls.logger = StorPoolHelper.logger
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
cls.helper = StorPoolHelper()
|
||||
|
||||
sp_pools = cls.helper.get_pool(zone)
|
||||
assert sp_pools is not None
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
testClient = super(TestStoragePool, cls).getClsTestClient()
|
||||
|
||||
cls._cleanup = []
|
||||
|
||||
cls.apiclient = testClient.getApiClient()
|
||||
cls.helper = StorPoolHelper()
|
||||
|
||||
cls.unsupportedHypervisor = False
|
||||
cls.hypervisor = testClient.getHypervisorInfo()
|
||||
@ -106,34 +114,11 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
||||
assert cls.zone is not None
|
||||
|
||||
cls.sp_template_1 = "ssd"
|
||||
storpool_primary_storage = {
|
||||
"name" : cls.sp_template_1,
|
||||
"zoneid": cls.zone.id,
|
||||
"url": "SP_API_HTTP=%s:%s;SP_AUTH_TOKEN=%s;SP_TEMPLATE=%s" % (zone.spEndpoint, zone.spEndpointPort, zone.spAuthToken, cls.sp_template_1),
|
||||
"scope": "zone",
|
||||
"capacitybytes": 564325555333,
|
||||
"capacityiops": 155466,
|
||||
"hypervisor": "kvm",
|
||||
"provider": "StorPool",
|
||||
"tags": cls.sp_template_1
|
||||
}
|
||||
cls.sp_template_1 = cls.testdata[TestData.sp_template_1]["tags"]
|
||||
storpool_primary_storage = sp_pools[0]
|
||||
|
||||
cls.storpool_primary_storage = storpool_primary_storage
|
||||
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=storpool_primary_storage["name"]
|
||||
)
|
||||
|
||||
if storage_pool is None:
|
||||
newTemplate = sptypes.VolumeTemplateCreateDesc(name = storpool_primary_storage["name"],placeAll = "virtual", placeTail = "virtual", placeHead = "virtual", replication=1)
|
||||
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)
|
||||
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.primary_storage = storage_pool
|
||||
cls.primary_storage = cls.create_pool_if_not_exists(storpool_primary_storage)
|
||||
cls.helper.updateStoragePoolTags(cls.apiclient, cls.primary_storage.id, cls.sp_template_1)
|
||||
|
||||
|
||||
storpool_service_offerings_ssd = {
|
||||
@ -150,7 +135,7 @@ class TestStoragePool(cloudstackTestCase):
|
||||
|
||||
service_offerings_ssd = list_service_offering(
|
||||
cls.apiclient,
|
||||
name=storpool_service_offerings_ssd["name"]
|
||||
name=cls.sp_template_1
|
||||
)
|
||||
|
||||
if service_offerings_ssd is None:
|
||||
@ -162,36 +147,12 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.debug(pprint.pformat(cls.service_offering))
|
||||
|
||||
|
||||
cls.sp_template_2 = "ssd2"
|
||||
cls.sp_template_2 = cls.testdata[TestData.sp_template_2]["tags"]
|
||||
|
||||
storpool_primary_storage2 = {
|
||||
"name" : cls.sp_template_2,
|
||||
"zoneid": cls.zone.id,
|
||||
"url": "SP_API_HTTP=%s:%s;SP_AUTH_TOKEN=%s;SP_TEMPLATE=%s" % (zone.spEndpoint, zone.spEndpointPort, zone.spAuthToken, cls.sp_template_2),
|
||||
"scope": "zone",
|
||||
"capacitybytes": 564325555333,
|
||||
"capacityiops": 1554,
|
||||
"hypervisor": "kvm",
|
||||
"provider": "StorPool",
|
||||
"tags": cls.sp_template_2
|
||||
}
|
||||
storpool_primary_storage2 = sp_pools[1]
|
||||
|
||||
cls.storpool_primary_storage2 = storpool_primary_storage2
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=storpool_primary_storage2["name"]
|
||||
)
|
||||
|
||||
if storage_pool is None:
|
||||
newTemplate = sptypes.VolumeTemplateCreateDesc(name = storpool_primary_storage2["name"],placeAll = "virtual", placeTail = "virtual", placeHead = "virtual", replication=1)
|
||||
|
||||
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)
|
||||
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage2)
|
||||
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.primary_storage2 = storage_pool
|
||||
cls.primary_storage2 = cls.create_pool_if_not_exists(storpool_primary_storage2)
|
||||
cls.helper.updateStoragePoolTags(cls.apiclient, cls.primary_storage2.id, cls.sp_template_2)
|
||||
|
||||
storpool_service_offerings_ssd2 = {
|
||||
"name": cls.sp_template_2,
|
||||
@ -216,25 +177,11 @@ class TestStoragePool(cloudstackTestCase):
|
||||
|
||||
cls.service_offering2 = service_offerings_ssd2
|
||||
|
||||
disk_offerings = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name="Small"
|
||||
)
|
||||
cls.disk_offerings = cls.create_do_if_not_exists(cls.testdata[TestData.diskOfferingSmall])
|
||||
|
||||
disk_offering_20 = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name="Medium"
|
||||
)
|
||||
cls.disk_offering_20 = cls.create_do_if_not_exists(cls.testdata[TestData.diskOfferingMedium])
|
||||
|
||||
disk_offering_100 = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name="Large"
|
||||
)
|
||||
|
||||
|
||||
cls.disk_offerings = disk_offerings[0]
|
||||
cls.disk_offering_20 = disk_offering_20[0]
|
||||
cls.disk_offering_100 = disk_offering_100[0]
|
||||
cls.disk_offering_100 = cls.create_do_if_not_exists(cls.testdata[TestData.diskOfferingLarge])
|
||||
|
||||
#The version of CentOS has to be supported
|
||||
template = get_template(
|
||||
@ -253,14 +200,14 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.services["zoneid"] = cls.zone.id
|
||||
cls.services["diskofferingid"] = cls.disk_offerings.id
|
||||
|
||||
role = Role.list(cls.apiclient, name='Admin')
|
||||
role = Role.list(cls.apiclient, name='Root Admin')
|
||||
|
||||
# Create VMs, VMs etc
|
||||
cls.account = Account.create(
|
||||
cls.apiclient,
|
||||
cls.services["account"],
|
||||
domainid=cls.domain.id,
|
||||
roleid = role[0].id
|
||||
roleid = 1
|
||||
)
|
||||
|
||||
securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
|
||||
@ -271,7 +218,7 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.apiclient,
|
||||
{"diskname":"StorPoolDisk-1" },
|
||||
zoneid=cls.zone.id,
|
||||
diskofferingid=disk_offerings[0].id,
|
||||
diskofferingid=cls.disk_offerings.id,
|
||||
account=cls.account.name,
|
||||
domainid=cls.account.domainid,
|
||||
)
|
||||
@ -280,7 +227,7 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.apiclient,
|
||||
{"diskname":"StorPoolDisk-2" },
|
||||
zoneid=cls.zone.id,
|
||||
diskofferingid=disk_offerings[0].id,
|
||||
diskofferingid=cls.disk_offerings.id,
|
||||
account=cls.account.name,
|
||||
domainid=cls.account.domainid,
|
||||
)
|
||||
@ -289,7 +236,7 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.apiclient,
|
||||
{"diskname":"StorPoolDisk-3" },
|
||||
zoneid=cls.zone.id,
|
||||
diskofferingid=disk_offerings[0].id,
|
||||
diskofferingid=cls.disk_offerings.id,
|
||||
account=cls.account.name,
|
||||
domainid=cls.account.domainid,
|
||||
)
|
||||
@ -337,6 +284,34 @@ class TestStoragePool(cloudstackTestCase):
|
||||
cls.random_data = "random.data"
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def create_do_if_not_exists(cls, data):
|
||||
disk_offerings = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name=data["name"]
|
||||
)
|
||||
if disk_offerings is None:
|
||||
disk_offerings = DiskOffering.create(cls.apiclient, data)
|
||||
else:
|
||||
disk_offerings = disk_offerings[0]
|
||||
return disk_offerings
|
||||
|
||||
@classmethod
|
||||
def create_pool_if_not_exists(cls, storpool_primary_storage):
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=storpool_primary_storage["name"]
|
||||
)
|
||||
if storage_pool is None:
|
||||
newTemplate = sptypes.VolumeTemplateCreateDesc(name=storpool_primary_storage["name"], placeAll="virtual",
|
||||
placeTail="virtual", placeHead="virtual", replication=1)
|
||||
template_on_local = cls.spapi.volumeTemplateCreate(newTemplate)
|
||||
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
return storage_pool
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.cleanUpCloudStack()
|
||||
@ -406,6 +381,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertIsNotNone(template, "Template is None")
|
||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||
self._cleanup.append(template)
|
||||
virtual_machine.stop(self.apiclient, forced=True)
|
||||
virtual_machine.delete(self.apiclient, expunge=True)
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
def test_02_snapshot_to_template_bypass_secondary(self):
|
||||
@ -487,6 +464,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertIsNotNone(template, "Template is None")
|
||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||
self._cleanup.append(template)
|
||||
virtual_machine.stop(self.apiclient, forced=True)
|
||||
virtual_machine.delete(self.apiclient, expunge=True)
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
def test_03_snapshot_volume_with_secondary(self):
|
||||
@ -1016,6 +995,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
)
|
||||
|
||||
ssh_client = vm.get_ssh_client(reconnect=True)
|
||||
vm.stop(self.apiclient, forced=True)
|
||||
vm.delete(self.apiclient, expunge=True)
|
||||
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
@ -1825,6 +1806,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertIsNotNone(snapshot, "Snapshot is None")
|
||||
|
||||
self.assertEqual(list_volumes_of_vm[0].id, snapshot.volumeid, "Snapshot is not for the same volume")
|
||||
vm.stop(self.apiclient, forced=True)
|
||||
vm.delete(self.apiclient, expunge=True)
|
||||
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
@ -1860,6 +1843,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertIsNotNone(template, "Template is None")
|
||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||
self._cleanup.append(template)
|
||||
virtual_machine.stop(self.apiclient, forced=True)
|
||||
virtual_machine.delete(self.apiclient, expunge=True)
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
def test_24_migrate_vm_to_another_storage(self):
|
||||
@ -1892,6 +1877,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertFalse(hasattr(self.volume, 'virtualmachineid') , "Volume is not detached")
|
||||
|
||||
self.assertFalse(hasattr(self.volume, 'storageid') , "Volume is not detached")
|
||||
|
||||
self.helper.updateStoragePoolTags(apiclient=self.apiclient, poolId=self.primary_storage2.id, tags=self.testdata[TestData.sp_template_1]["tags"])
|
||||
volume = Volume.migrate(
|
||||
self.apiclient,
|
||||
volumeid = self.volume.id,
|
||||
@ -1901,6 +1888,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertIsNotNone(volume, "Volume is None")
|
||||
|
||||
self.assertEqual(volume.storageid, self.primary_storage2.id, "Storage is the same")
|
||||
self.helper.updateStoragePoolTags(apiclient=self.apiclient, poolId=self.primary_storage2.id, tags=self.testdata[TestData.sp_template_2]["tags"])
|
||||
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
def test_26_create_vm_on_another_storpool_storage(self):
|
||||
@ -1916,6 +1905,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
rootdisksize=10
|
||||
)
|
||||
self.assertIsNotNone(virtual_machine, "Could not create virtual machine on another Storpool primary storage")
|
||||
virtual_machine.stop(self.apiclient, forced=True)
|
||||
virtual_machine.delete(self.apiclient, expunge=True)
|
||||
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
@ -1958,6 +1949,8 @@ class TestStoragePool(cloudstackTestCase):
|
||||
|
||||
self.assertIsNotNone(volume, "Could not create volume from snapshot")
|
||||
self.assertIsInstance(volume, Volume, "Volume is not instance of Volume")
|
||||
virtual_machine.stop(self.apiclient, forced=True)
|
||||
virtual_machine.delete(self.apiclient, expunge=True)
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||
def test_28_download_volume(self):
|
||||
@ -2041,6 +2034,10 @@ class TestStoragePool(cloudstackTestCase):
|
||||
self.assertIsNotNone(template, "Template is None")
|
||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||
self._cleanup.append(template)
|
||||
virtual_machine.stop(self.apiclient, forced=True)
|
||||
virtual_machine.delete(self.apiclient, expunge=True)
|
||||
virtual_machine2.stop(self.apiclient, forced=True)
|
||||
virtual_machine2.delete(self.apiclient, expunge=True)
|
||||
|
||||
@classmethod
|
||||
def create_volume(self, apiclient, zoneid=None, snapshotid=None, account=None, domainid=None):
|
||||
|
||||
@ -44,6 +44,7 @@ from marvin.lib.base import (Account,
|
||||
VmSnapshot,
|
||||
Volume,
|
||||
SecurityGroup,
|
||||
DiskOffering,
|
||||
)
|
||||
from marvin.lib.common import (get_zone,
|
||||
get_domain,
|
||||
@ -79,10 +80,16 @@ class TestStoragePool(cloudstackTestCase):
|
||||
def setUpCloudStack(cls):
|
||||
config = cls.getClsConfig()
|
||||
StorPoolHelper.logger = cls
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
cls.helper = StorPoolHelper()
|
||||
|
||||
zone = config.zones[0]
|
||||
assert zone is not None
|
||||
|
||||
sp_pools = cls.helper.get_pool(zone)
|
||||
assert sp_pools is not None
|
||||
|
||||
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||
testClient = super(TestStoragePool, cls).getClsTestClient()
|
||||
cls.apiclient = testClient.getApiClient()
|
||||
@ -98,16 +105,9 @@ class TestStoragePool(cloudstackTestCase):
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
||||
cls.debug(cls.zone)
|
||||
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
||||
assert cls.zone is not None
|
||||
|
||||
assert cls.zone is not None
|
||||
|
||||
td = TestData()
|
||||
cls.testdata = td.testdata
|
||||
cls.helper = StorPoolHelper()
|
||||
|
||||
cls.account = cls.helper.create_account(
|
||||
cls.apiclient,
|
||||
cls.services["account"],
|
||||
@ -120,34 +120,39 @@ class TestStoragePool(cloudstackTestCase):
|
||||
securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
|
||||
cls.helper.set_securityGroups(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid, id = securitygroup.id)
|
||||
|
||||
storpool_primary_storage = cls.testdata[TestData.primaryStorage]
|
||||
|
||||
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
||||
|
||||
cls.template_name = storpool_primary_storage.get("name")
|
||||
|
||||
storpool_primary_storage = sp_pools[0]
|
||||
cls.template_name = storpool_primary_storage["name"]
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
if storage_pool is None:
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.storage_pool = storage_pool
|
||||
cls.helper.updateStoragePoolTags(cls.apiclient, cls.storage_pool.id, cls.testdata[TestData.sp_template_1]["tags"])
|
||||
|
||||
cls.debug(pprint.pformat(storage_pool))
|
||||
|
||||
|
||||
disk_offerings = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
if disk_offerings is None:
|
||||
offering = cls.testdata[TestData.diskOfferingCustom]
|
||||
cls.disk_offerings = DiskOffering.create(cls.apiclient, services=offering, custom=True)
|
||||
else:
|
||||
cls.disk_offerings = disk_offerings[0]
|
||||
|
||||
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
||||
|
||||
service_offerings = list_service_offering(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
|
||||
disk_offerings = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name="ssd"
|
||||
)
|
||||
|
||||
cls.disk_offerings = disk_offerings[0]
|
||||
if storage_pool is None:
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.storage_pool = storage_pool
|
||||
cls.debug(pprint.pformat(storage_pool))
|
||||
if service_offerings is None:
|
||||
service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
|
||||
else:
|
||||
|
||||
@ -29,6 +29,7 @@ from marvin.lib.base import (Account,
|
||||
User,
|
||||
Volume,
|
||||
SecurityGroup,
|
||||
DiskOffering,
|
||||
)
|
||||
from marvin.lib.common import (get_zone,
|
||||
get_domain,
|
||||
@ -76,6 +77,8 @@ class TestVmSnapshot(cloudstackTestCase):
|
||||
cls.testdata = td.testdata
|
||||
cls.helper = StorPoolHelper()
|
||||
|
||||
sp_pools = cls.helper.get_pool(zone)
|
||||
assert sp_pools is not None
|
||||
|
||||
cls.services = testClient.getParsedTestDataConfig()
|
||||
# Get Zone, Domain and templates
|
||||
@ -114,26 +117,29 @@ class TestVmSnapshot(cloudstackTestCase):
|
||||
securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
|
||||
cls.helper.set_securityGroups(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid, id = securitygroup.id)
|
||||
|
||||
primarystorage = cls.testdata[TestData.primaryStorage]
|
||||
primarystorage = sp_pools[0]
|
||||
|
||||
serviceOffering = cls.testdata[TestData.serviceOffering]
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name = primarystorage.get("name")
|
||||
name = primarystorage["name"]
|
||||
)
|
||||
cls.primary_storage = storage_pool[0]
|
||||
|
||||
disk_offering = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name="ssd"
|
||||
name=primarystorage["name"]
|
||||
)
|
||||
|
||||
assert disk_offering is not None
|
||||
|
||||
if disk_offering is None:
|
||||
offering = cls.testdata[TestData.diskOfferingCustom]
|
||||
cls.disk_offering = DiskOffering.create(cls.apiclient, services=offering, custom=True)
|
||||
else:
|
||||
cls.disk_offering = disk_offering[0]
|
||||
|
||||
service_offering_only = list_service_offering(
|
||||
cls.apiclient,
|
||||
name="ssd"
|
||||
name=primarystorage["name"]
|
||||
)
|
||||
if service_offering_only is not None:
|
||||
cls.service_offering_only = service_offering_only[0]
|
||||
@ -143,8 +149,6 @@ class TestVmSnapshot(cloudstackTestCase):
|
||||
serviceOffering)
|
||||
assert cls.service_offering_only is not None
|
||||
|
||||
cls.disk_offering = disk_offering[0]
|
||||
|
||||
# Create 1 data volume_1
|
||||
cls.volume = Volume.create(
|
||||
cls.apiclient,
|
||||
|
||||
@ -84,6 +84,10 @@ class TestData():
|
||||
diskOfferingTier1Template = "diskOfferingTier1Template"
|
||||
diskOfferingTier2Template = "diskOfferingTier2Template"
|
||||
diskOfferingWithTagsAndTempl = "diskOfferingWithTagsAndTempl"
|
||||
diskOfferingSmall = "diskOfferingSmall"
|
||||
diskOfferingMedium = "diskOfferingMedium"
|
||||
diskOfferingLarge = "diskOfferingLarge"
|
||||
diskOfferingCustom = "diskOfferingCustom"
|
||||
domainId = "domainId"
|
||||
hypervisor = "hypervisor"
|
||||
login = "login"
|
||||
@ -100,6 +104,7 @@ class TestData():
|
||||
serviceOfferingsPrimary = "serviceOfferingsPrimary"
|
||||
serviceOfferingsIops = "serviceOfferingsIops"
|
||||
serviceOfferingsCeph = "serviceOfferingsCeph"
|
||||
serviceOfferingEncrypted = "serviceOfferingEncrypted"
|
||||
scope = "scope"
|
||||
StorPool = "StorPool"
|
||||
storageTag = ["ssd", "ssd2"]
|
||||
@ -114,6 +119,8 @@ class TestData():
|
||||
volume_6 = "volume_6"
|
||||
volume_7 = "volume_7"
|
||||
zoneId = "zoneId"
|
||||
sp_template_1 = 'sp_template_1'
|
||||
sp_template_2 = 'sp_template_2'
|
||||
|
||||
def __init__(self):
|
||||
sp_template_1 = 'ssd'
|
||||
@ -221,6 +228,18 @@ class TestData():
|
||||
"customizediops": True,
|
||||
"tags": sp_template_1,
|
||||
},
|
||||
TestData.serviceOfferingEncrypted: {
|
||||
"name": "Test-encrypted",
|
||||
"displaytext": "SP Encrypted",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 500,
|
||||
"memory": 512,
|
||||
"storagetype": "shared",
|
||||
"customizediops": False,
|
||||
"hypervisorsnapshotreserve": 200,
|
||||
"encryptroot": True,
|
||||
"tags": sp_template_1
|
||||
},
|
||||
TestData.diskOffering: {
|
||||
"name": "SP_DO_1",
|
||||
"displaytext": "SP_DO_1 (5GB Min IOPS = 300; Max IOPS = 500)",
|
||||
@ -323,6 +342,38 @@ class TestData():
|
||||
TestData.tags: sp_template_1,
|
||||
"storagetype": "shared"
|
||||
},
|
||||
TestData.diskOfferingSmall: {
|
||||
"name": "Test-Small",
|
||||
"displaytext": "Small Disk Offering",
|
||||
"disksize" : 5,
|
||||
"hypervisorsnapshotreserve": 200,
|
||||
TestData.tags: sp_template_1,
|
||||
"storagetype": "shared"
|
||||
},
|
||||
TestData.diskOfferingMedium: {
|
||||
"name": "Test-Medium",
|
||||
"displaytext": "Medium Disk Offering",
|
||||
"disksize": 20,
|
||||
"hypervisorsnapshotreserve": 200,
|
||||
TestData.tags: sp_template_1,
|
||||
"storagetype": "shared"
|
||||
},
|
||||
TestData.diskOfferingLarge: {
|
||||
"name": "Test-Large",
|
||||
"displaytext": "Large Disk Offering",
|
||||
"disksize": 100,
|
||||
"hypervisorsnapshotreserve": 200,
|
||||
TestData.tags: sp_template_1,
|
||||
"storagetype": "shared"
|
||||
},
|
||||
TestData.diskOfferingCustom: {
|
||||
"name": "Test-Custom",
|
||||
"displaytext": "Custom Disk Offering",
|
||||
"custom": True,
|
||||
"hypervisorsnapshotreserve": 200,
|
||||
TestData.tags: sp_template_1,
|
||||
"storagetype": "shared"
|
||||
},
|
||||
TestData.volume_1: {
|
||||
TestData.diskName: "test-volume-1",
|
||||
},
|
||||
@ -344,6 +395,12 @@ class TestData():
|
||||
TestData.volume_7: {
|
||||
TestData.diskName: "test-volume-7",
|
||||
},
|
||||
TestData.sp_template_1: {
|
||||
"tags": "ssd"
|
||||
},
|
||||
TestData.sp_template_2: {
|
||||
"tags": "ssd2"
|
||||
},
|
||||
}
|
||||
class StorPoolHelper():
|
||||
def setUpClass(cls):
|
||||
@ -847,3 +904,24 @@ class StorPoolHelper():
|
||||
break
|
||||
|
||||
return destinationHost
|
||||
|
||||
@classmethod
|
||||
def updateStoragePoolTags(cls, apiclient, poolId, tags):
|
||||
StoragePool.update(
|
||||
apiclient,
|
||||
id=poolId,
|
||||
tags=tags
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_pool(cls, zone):
|
||||
storage_pools = zone.primaryStorages
|
||||
sp_pools = []
|
||||
for storage in storage_pools:
|
||||
if storage['provider'] and "StorPool" in storage['provider']:
|
||||
sp_pools.append(storage)
|
||||
|
||||
if len(sp_pools) < 2:
|
||||
cls.debug("Cannot perform the tests because there aren't the required count of StorPool storage pools %s" % sp_pools)
|
||||
return
|
||||
return sp_pools
|
||||
|
||||
154
test/integration/plugins/storpool/storpool.cfg
Normal file
154
test/integration/plugins/storpool/storpool.cfg
Normal file
@ -0,0 +1,154 @@
|
||||
# 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.
|
||||
|
||||
{
|
||||
"zones": [
|
||||
{
|
||||
"name": "Zone-A",
|
||||
"enabled": "True",
|
||||
"physical_networks": [
|
||||
{
|
||||
"broadcastdomainrange": "Zone",
|
||||
"name": "physical_network",
|
||||
"traffictypes": [
|
||||
{
|
||||
"typ": "Guest"
|
||||
},
|
||||
{
|
||||
"typ": "Management"
|
||||
}
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"broadcastdomainrange": "ZONE",
|
||||
"name": "VirtualRouter"
|
||||
},
|
||||
{
|
||||
"broadcastdomainrange": "Pod",
|
||||
"name": "SecurityGroupProvider"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"primaryStorages": [
|
||||
{
|
||||
"url": "SP_API_HTTP=1.1.1.1:81;SP_AUTH_TOKEN=11111111;SP_TEMPLATE=ssd",
|
||||
"name": "ssd",
|
||||
"provider": "StorPool",
|
||||
"hypervisor": "KVM",
|
||||
"path": "/dev/storpool/",
|
||||
"protocol": "SharedMountPoint",
|
||||
"capacitybytes": 300000000000,
|
||||
"tags": "ssd"
|
||||
},
|
||||
{
|
||||
"url": "SP_API_HTTP=1.1.1.1:81;SP_AUTH_TOKEN=1111111;SP_TEMPLATE=ssd2",
|
||||
"name": "",
|
||||
"provider": "StorPool",
|
||||
"hypervisor": "KVM",
|
||||
"path": "/dev/storpool/",
|
||||
"protocol": "SharedMountPoint",
|
||||
"capacitybytes": 300000000000,
|
||||
"tags": ""
|
||||
},
|
||||
{
|
||||
"url": "nfs://1.1.1.1/export/primary",
|
||||
"name": "primary",
|
||||
"hypervisor": "KVM",
|
||||
"tags": "nfs"
|
||||
},
|
||||
{
|
||||
"url": "rbd://cloudstack:342343223==@1.1.1.1/cloudstack",
|
||||
"hypervisor": "KVM",
|
||||
"name": "ceph",
|
||||
"tags": "ceph"
|
||||
}
|
||||
],
|
||||
"spEndpoint": [SP_API_HTTP_HOST],
|
||||
"spEndpointPort": 81,
|
||||
"spAuthToken": [SP_AUTH_TOKEN]
|
||||
},
|
||||
{
|
||||
"name": "Zone-B",
|
||||
"enabled": "True",
|
||||
"physical_networks": [
|
||||
{
|
||||
"broadcastdomainrange": "Zone",
|
||||
"name": "physical_network",
|
||||
"traffictypes": [
|
||||
{
|
||||
"typ": "Guest"
|
||||
},
|
||||
{
|
||||
"typ": "Management"
|
||||
}
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"broadcastdomainrange": "ZONE",
|
||||
"name": "VirtualRouter"
|
||||
},
|
||||
{
|
||||
"broadcastdomainrange": "Pod",
|
||||
"name": "SecurityGroupProvider"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"primaryStorages": [
|
||||
{
|
||||
"url": "SP_API_HTTP=1.1.1.1:81;SP_AUTH_TOKEN=111111;SP_TEMPLATE=default",
|
||||
"name": "",
|
||||
"provider": "StorPool",
|
||||
"hypervisor": "KVM",
|
||||
"path": "/dev/storpool/",
|
||||
"protocol": "SharedMountPoint",
|
||||
"capacitybytes": 300000000000,
|
||||
"tags": ""
|
||||
},
|
||||
{
|
||||
"url": "nfs://1.1.1.1/export/primary",
|
||||
"name": "",
|
||||
"hypervisor": "KVM",
|
||||
"tags": ""
|
||||
}
|
||||
],
|
||||
"spEndpoint": [SP_API_HTTP_HOST],
|
||||
"spEndpointPort": 81,
|
||||
"spAuthToken": [SP_AUTH_TOKEN]
|
||||
}
|
||||
],
|
||||
"dbSvr": {
|
||||
"dbSvr": "127.0.0.1",
|
||||
"passwd": "cloud",
|
||||
"db": "cloud",
|
||||
"port": 3306,
|
||||
"user": "cloud"
|
||||
},
|
||||
"logger": {
|
||||
"LogFolderPath": "/tmp/"
|
||||
},
|
||||
"mgtSvr": [
|
||||
{
|
||||
"mgtSvrIp": "",
|
||||
"port": 8096,
|
||||
"user": "",
|
||||
"passwd": "",
|
||||
"hypervisor": "kvm"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,17 +90,17 @@ class TestStorPoolTiers(cloudstackTestCase):
|
||||
cls.qos = "SP_QOSCLASS"
|
||||
cls.spTemplate = "SP_TEMPLATE"
|
||||
|
||||
cls.disk_offerings_tier1_tags = cls.getDiskOffering(disk_offerings_tier1_tags, cls.qos, "ssd")
|
||||
cls.disk_offerings_tier1_tags = cls.getDiskOffering(disk_offerings_tier1_tags, cls.qos, cls.testdata[TestData.sp_template_1]["tags"])
|
||||
|
||||
cls.disk_offerings_tier2_tags = cls.getDiskOffering(disk_offerings_tier2_tags, cls.qos, "virtual")
|
||||
cls.disk_offerings_tier2_tags = cls.getDiskOffering(disk_offerings_tier2_tags, cls.qos, cls.testdata[TestData.sp_template_2]["tags"])
|
||||
|
||||
cls.disk_offerings_tier1_template = cls.getDiskOffering(disk_offerings_tier1_template, cls.spTemplate, "ssd")
|
||||
cls.disk_offerings_tier1_template = cls.getDiskOffering(disk_offerings_tier1_template, cls.spTemplate, cls.testdata[TestData.sp_template_1]["tags"])
|
||||
|
||||
cls.disk_offerings_tier2_template = cls.getDiskOffering(disk_offerings_tier2_template, cls.spTemplate,
|
||||
"virtual")
|
||||
cls.testdata[TestData.sp_template_2]["tags"])
|
||||
cls.disk_offerings_tier2_tags_template = cls.getDiskOffering(disk_offerings_tier2_tags_template, cls.spTemplate,
|
||||
"virtual")
|
||||
cls.resourceDetails(cls.qos, cls.disk_offerings_tier2_tags_template.id, "virtual")
|
||||
cls.testdata[TestData.sp_template_2]["tags"])
|
||||
cls.resourceDetails(cls.qos, cls.disk_offerings_tier2_tags_template.id, cls.testdata[TestData.sp_template_1]["tags"])
|
||||
|
||||
cls.account = cls.helper.create_account(
|
||||
cls.apiclient,
|
||||
@ -115,33 +115,35 @@ class TestStorPoolTiers(cloudstackTestCase):
|
||||
cls.helper.set_securityGroups(cls.apiclient, account=cls.account.name, domainid=cls.account.domainid,
|
||||
id=securitygroup.id)
|
||||
|
||||
storpool_primary_storage = cls.testdata[TestData.primaryStorage]
|
||||
sp_pools = cls.helper.get_pool(zone)
|
||||
assert sp_pools is not None
|
||||
|
||||
storpool_primary_storage = sp_pools[0]
|
||||
|
||||
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
||||
|
||||
cls.template_name = storpool_primary_storage.get("name")
|
||||
cls.template_name = storpool_primary_storage["name"]
|
||||
|
||||
storage_pool = list_storage_pools(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
|
||||
service_offerings = list_service_offering(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
|
||||
disk_offerings = list_disk_offering(
|
||||
cls.apiclient,
|
||||
name="ssd"
|
||||
)
|
||||
|
||||
if storage_pool is None:
|
||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||
else:
|
||||
storage_pool = storage_pool[0]
|
||||
cls.storage_pool = storage_pool
|
||||
cls.helper.updateStoragePoolTags(cls.apiclient, cls.storage_pool.id, cls.testdata[TestData.sp_template_1]["tags"])
|
||||
|
||||
cls.debug(pprint.pformat(storage_pool))
|
||||
|
||||
|
||||
service_offerings = list_service_offering(
|
||||
cls.apiclient,
|
||||
name=cls.template_name
|
||||
)
|
||||
|
||||
if service_offerings is None:
|
||||
service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user