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]
|
zone = config.zones[0]
|
||||||
assert zone is not None
|
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)
|
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||||
testClient = super(TestMigrateVolumeToAnotherPool, cls).getClsTestClient()
|
testClient = super(TestMigrateVolumeToAnotherPool, cls).getClsTestClient()
|
||||||
cls.apiclient = testClient.getApiClient()
|
cls.apiclient = testClient.getApiClient()
|
||||||
@ -103,11 +109,8 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
|||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.apiclient)
|
cls.domain = get_domain(cls.apiclient)
|
||||||
|
|
||||||
td = TestData()
|
storpool_primary_storage = sp_pools[0]
|
||||||
cls.testdata = td.testdata
|
cls.template_name = storpool_primary_storage["name"]
|
||||||
cls.helper = StorPoolHelper()
|
|
||||||
storpool_primary_storage = cls.testdata[TestData.primaryStorage]
|
|
||||||
cls.template_name = storpool_primary_storage.get("name")
|
|
||||||
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
||||||
|
|
||||||
nfs_service_offerings = cls.testdata[TestData.serviceOfferingsPrimary]
|
nfs_service_offerings = cls.testdata[TestData.serviceOfferingsPrimary]
|
||||||
@ -283,12 +286,6 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def cleanUpCloudStack(cls):
|
def cleanUpCloudStack(cls):
|
||||||
try:
|
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,
|
cls.storage_pool = StoragePool.update(cls.apiclient,
|
||||||
id=cls.storage_pool.id,
|
id=cls.storage_pool.id,
|
||||||
tags = ["ssd"])
|
tags = ["ssd"])
|
||||||
|
|||||||
@ -97,9 +97,18 @@ class TestEncryptedVolumes(cloudstackTestCase):
|
|||||||
|
|
||||||
zone = config.zones[0]
|
zone = config.zones[0]
|
||||||
assert zone is not None
|
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.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||||
cls.helper = StorPoolHelper()
|
cls.helper = StorPoolHelper()
|
||||||
@ -118,48 +127,43 @@ class TestEncryptedVolumes(cloudstackTestCase):
|
|||||||
td = TestData()
|
td = TestData()
|
||||||
cls.testdata = td.testdata
|
cls.testdata = td.testdata
|
||||||
|
|
||||||
cls.sp_template_1 = "ssd"
|
storpool_primary_storage = sp_pools[0]
|
||||||
storpool_primary_storage = {
|
cls.template_name = storpool_primary_storage["name"]
|
||||||
"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
|
|
||||||
|
|
||||||
storage_pool = list_storage_pools(
|
storage_pool = list_storage_pools(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name=storpool_primary_storage["name"]
|
name=cls.template_name
|
||||||
)
|
)
|
||||||
|
|
||||||
if storage_pool is None:
|
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)
|
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||||
else:
|
else:
|
||||||
storage_pool = storage_pool[0]
|
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
|
cls.primary_storage = storage_pool
|
||||||
|
|
||||||
storpool_service_offerings_ssd = {
|
storpool_primary_storage = sp_pools[1]
|
||||||
"name": "ssd-encrypted",
|
cls.template_name = storpool_primary_storage["name"]
|
||||||
"displaytext": "SP_CO_2 (Min IOPS = 10,000; Max IOPS = 15,000)",
|
|
||||||
"cpunumber": 1,
|
storage_pool = list_storage_pools(
|
||||||
"cpuspeed": 500,
|
cls.apiclient,
|
||||||
"memory": 512,
|
name=cls.template_name
|
||||||
"storagetype": "shared",
|
)
|
||||||
"customizediops": False,
|
if storage_pool is None:
|
||||||
"hypervisorsnapshotreserve": 200,
|
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||||
"encryptroot": True,
|
else:
|
||||||
"tags": cls.sp_template_1
|
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(
|
service_offerings_ssd = list_service_offering(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
@ -174,69 +178,6 @@ class TestEncryptedVolumes(cloudstackTestCase):
|
|||||||
cls.service_offering = service_offerings_ssd
|
cls.service_offering = service_offerings_ssd
|
||||||
cls.debug(pprint.pformat(cls.service_offering))
|
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.disk_offering_ssd_encrypted = list_disk_offering(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name=cls.testdata[TestData.diskOfferingEncrypted]["name"]
|
name=cls.testdata[TestData.diskOfferingEncrypted]["name"]
|
||||||
|
|||||||
@ -32,6 +32,7 @@ from marvin.lib.base import (Account,
|
|||||||
Volume,
|
Volume,
|
||||||
SecurityGroup,
|
SecurityGroup,
|
||||||
Role,
|
Role,
|
||||||
|
DiskOffering,
|
||||||
)
|
)
|
||||||
from marvin.lib.common import (get_zone,
|
from marvin.lib.common import (get_zone,
|
||||||
get_domain,
|
get_domain,
|
||||||
@ -79,17 +80,24 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
def setUpCloudStack(cls):
|
def setUpCloudStack(cls):
|
||||||
config = cls.getClsConfig()
|
config = cls.getClsConfig()
|
||||||
StorPoolHelper.logger = cls
|
StorPoolHelper.logger = cls
|
||||||
|
cls.logger = StorPoolHelper.logger
|
||||||
|
|
||||||
zone = config.zones[0]
|
zone = config.zones[0]
|
||||||
assert zone is not None
|
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)
|
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||||
testClient = super(TestStoragePool, cls).getClsTestClient()
|
testClient = super(TestStoragePool, cls).getClsTestClient()
|
||||||
|
|
||||||
cls._cleanup = []
|
cls._cleanup = []
|
||||||
|
|
||||||
cls.apiclient = testClient.getApiClient()
|
cls.apiclient = testClient.getApiClient()
|
||||||
cls.helper = StorPoolHelper()
|
|
||||||
|
|
||||||
cls.unsupportedHypervisor = False
|
cls.unsupportedHypervisor = False
|
||||||
cls.hypervisor = testClient.getHypervisorInfo()
|
cls.hypervisor = testClient.getHypervisorInfo()
|
||||||
@ -106,34 +114,11 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
cls.debug(list_zones(cls.apiclient, name=zone.name))
|
||||||
assert cls.zone is not None
|
assert cls.zone is not None
|
||||||
|
|
||||||
cls.sp_template_1 = "ssd"
|
cls.sp_template_1 = cls.testdata[TestData.sp_template_1]["tags"]
|
||||||
storpool_primary_storage = {
|
storpool_primary_storage = sp_pools[0]
|
||||||
"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
|
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)
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
storpool_service_offerings_ssd = {
|
storpool_service_offerings_ssd = {
|
||||||
@ -150,7 +135,7 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
|
|
||||||
service_offerings_ssd = list_service_offering(
|
service_offerings_ssd = list_service_offering(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name=storpool_service_offerings_ssd["name"]
|
name=cls.sp_template_1
|
||||||
)
|
)
|
||||||
|
|
||||||
if service_offerings_ssd is None:
|
if service_offerings_ssd is None:
|
||||||
@ -162,36 +147,12 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.debug(pprint.pformat(cls.service_offering))
|
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 = {
|
storpool_primary_storage2 = sp_pools[1]
|
||||||
"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
|
cls.primary_storage2 = cls.create_pool_if_not_exists(storpool_primary_storage2)
|
||||||
storage_pool = list_storage_pools(
|
cls.helper.updateStoragePoolTags(cls.apiclient, cls.primary_storage2.id, cls.sp_template_2)
|
||||||
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 = {
|
storpool_service_offerings_ssd2 = {
|
||||||
"name": cls.sp_template_2,
|
"name": cls.sp_template_2,
|
||||||
@ -216,25 +177,11 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
|
|
||||||
cls.service_offering2 = service_offerings_ssd2
|
cls.service_offering2 = service_offerings_ssd2
|
||||||
|
|
||||||
disk_offerings = list_disk_offering(
|
cls.disk_offerings = cls.create_do_if_not_exists(cls.testdata[TestData.diskOfferingSmall])
|
||||||
cls.apiclient,
|
|
||||||
name="Small"
|
|
||||||
)
|
|
||||||
|
|
||||||
disk_offering_20 = list_disk_offering(
|
cls.disk_offering_20 = cls.create_do_if_not_exists(cls.testdata[TestData.diskOfferingMedium])
|
||||||
cls.apiclient,
|
|
||||||
name="Medium"
|
|
||||||
)
|
|
||||||
|
|
||||||
disk_offering_100 = list_disk_offering(
|
cls.disk_offering_100 = cls.create_do_if_not_exists(cls.testdata[TestData.diskOfferingLarge])
|
||||||
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]
|
|
||||||
|
|
||||||
#The version of CentOS has to be supported
|
#The version of CentOS has to be supported
|
||||||
template = get_template(
|
template = get_template(
|
||||||
@ -253,14 +200,14 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.services["zoneid"] = cls.zone.id
|
cls.services["zoneid"] = cls.zone.id
|
||||||
cls.services["diskofferingid"] = cls.disk_offerings.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
|
# Create VMs, VMs etc
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.services["account"],
|
cls.services["account"],
|
||||||
domainid=cls.domain.id,
|
domainid=cls.domain.id,
|
||||||
roleid = role[0].id
|
roleid = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
|
securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
|
||||||
@ -271,7 +218,7 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
{"diskname":"StorPoolDisk-1" },
|
{"diskname":"StorPoolDisk-1" },
|
||||||
zoneid=cls.zone.id,
|
zoneid=cls.zone.id,
|
||||||
diskofferingid=disk_offerings[0].id,
|
diskofferingid=cls.disk_offerings.id,
|
||||||
account=cls.account.name,
|
account=cls.account.name,
|
||||||
domainid=cls.account.domainid,
|
domainid=cls.account.domainid,
|
||||||
)
|
)
|
||||||
@ -280,7 +227,7 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
{"diskname":"StorPoolDisk-2" },
|
{"diskname":"StorPoolDisk-2" },
|
||||||
zoneid=cls.zone.id,
|
zoneid=cls.zone.id,
|
||||||
diskofferingid=disk_offerings[0].id,
|
diskofferingid=cls.disk_offerings.id,
|
||||||
account=cls.account.name,
|
account=cls.account.name,
|
||||||
domainid=cls.account.domainid,
|
domainid=cls.account.domainid,
|
||||||
)
|
)
|
||||||
@ -289,7 +236,7 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
{"diskname":"StorPoolDisk-3" },
|
{"diskname":"StorPoolDisk-3" },
|
||||||
zoneid=cls.zone.id,
|
zoneid=cls.zone.id,
|
||||||
diskofferingid=disk_offerings[0].id,
|
diskofferingid=cls.disk_offerings.id,
|
||||||
account=cls.account.name,
|
account=cls.account.name,
|
||||||
domainid=cls.account.domainid,
|
domainid=cls.account.domainid,
|
||||||
)
|
)
|
||||||
@ -337,6 +284,34 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
cls.random_data = "random.data"
|
cls.random_data = "random.data"
|
||||||
return
|
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
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
cls.cleanUpCloudStack()
|
cls.cleanUpCloudStack()
|
||||||
@ -406,6 +381,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
self.assertIsNotNone(template, "Template is None")
|
self.assertIsNotNone(template, "Template is None")
|
||||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||||
self._cleanup.append(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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
def test_02_snapshot_to_template_bypass_secondary(self):
|
def test_02_snapshot_to_template_bypass_secondary(self):
|
||||||
@ -487,6 +464,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
self.assertIsNotNone(template, "Template is None")
|
self.assertIsNotNone(template, "Template is None")
|
||||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||||
self._cleanup.append(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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
def test_03_snapshot_volume_with_secondary(self):
|
def test_03_snapshot_volume_with_secondary(self):
|
||||||
@ -1016,6 +995,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
ssh_client = vm.get_ssh_client(reconnect=True)
|
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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
@ -1825,6 +1806,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
self.assertIsNotNone(snapshot, "Snapshot is None")
|
self.assertIsNotNone(snapshot, "Snapshot is None")
|
||||||
|
|
||||||
self.assertEqual(list_volumes_of_vm[0].id, snapshot.volumeid, "Snapshot is not for the same volume")
|
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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
@ -1860,6 +1843,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
self.assertIsNotNone(template, "Template is None")
|
self.assertIsNotNone(template, "Template is None")
|
||||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||||
self._cleanup.append(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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
def test_24_migrate_vm_to_another_storage(self):
|
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, 'virtualmachineid') , "Volume is not detached")
|
||||||
|
|
||||||
self.assertFalse(hasattr(self.volume, 'storageid') , "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(
|
volume = Volume.migrate(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
volumeid = self.volume.id,
|
volumeid = self.volume.id,
|
||||||
@ -1901,6 +1888,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
self.assertIsNotNone(volume, "Volume is None")
|
self.assertIsNotNone(volume, "Volume is None")
|
||||||
|
|
||||||
self.assertEqual(volume.storageid, self.primary_storage2.id, "Storage is the same")
|
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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
def test_26_create_vm_on_another_storpool_storage(self):
|
def test_26_create_vm_on_another_storpool_storage(self):
|
||||||
@ -1916,6 +1905,8 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
rootdisksize=10
|
rootdisksize=10
|
||||||
)
|
)
|
||||||
self.assertIsNotNone(virtual_machine, "Could not create virtual machine on another Storpool primary storage")
|
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")
|
@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.assertIsNotNone(volume, "Could not create volume from snapshot")
|
||||||
self.assertIsInstance(volume, Volume, "Volume is not instance of Volume")
|
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")
|
@attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
|
||||||
def test_28_download_volume(self):
|
def test_28_download_volume(self):
|
||||||
@ -2041,6 +2034,10 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
self.assertIsNotNone(template, "Template is None")
|
self.assertIsNotNone(template, "Template is None")
|
||||||
self.assertIsInstance(template, Template, "Template is instance of template")
|
self.assertIsInstance(template, Template, "Template is instance of template")
|
||||||
self._cleanup.append(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
|
@classmethod
|
||||||
def create_volume(self, apiclient, zoneid=None, snapshotid=None, account=None, domainid=None):
|
def create_volume(self, apiclient, zoneid=None, snapshotid=None, account=None, domainid=None):
|
||||||
|
|||||||
@ -44,6 +44,7 @@ from marvin.lib.base import (Account,
|
|||||||
VmSnapshot,
|
VmSnapshot,
|
||||||
Volume,
|
Volume,
|
||||||
SecurityGroup,
|
SecurityGroup,
|
||||||
|
DiskOffering,
|
||||||
)
|
)
|
||||||
from marvin.lib.common import (get_zone,
|
from marvin.lib.common import (get_zone,
|
||||||
get_domain,
|
get_domain,
|
||||||
@ -79,10 +80,16 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
def setUpCloudStack(cls):
|
def setUpCloudStack(cls):
|
||||||
config = cls.getClsConfig()
|
config = cls.getClsConfig()
|
||||||
StorPoolHelper.logger = cls
|
StorPoolHelper.logger = cls
|
||||||
|
td = TestData()
|
||||||
|
cls.testdata = td.testdata
|
||||||
|
cls.helper = StorPoolHelper()
|
||||||
|
|
||||||
zone = config.zones[0]
|
zone = config.zones[0]
|
||||||
assert zone is not None
|
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)
|
cls.spapi = spapi.Api(host=zone.spEndpoint, port=zone.spEndpointPort, auth=zone.spAuthToken, multiCluster=True)
|
||||||
testClient = super(TestStoragePool, cls).getClsTestClient()
|
testClient = super(TestStoragePool, cls).getClsTestClient()
|
||||||
cls.apiclient = testClient.getApiClient()
|
cls.apiclient = testClient.getApiClient()
|
||||||
@ -98,16 +105,9 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.apiclient)
|
cls.domain = get_domain(cls.apiclient)
|
||||||
cls.zone = list_zones(cls.apiclient, name=zone.name)[0]
|
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
|
assert cls.zone is not None
|
||||||
|
|
||||||
td = TestData()
|
|
||||||
cls.testdata = td.testdata
|
|
||||||
cls.helper = StorPoolHelper()
|
|
||||||
|
|
||||||
cls.account = cls.helper.create_account(
|
cls.account = cls.helper.create_account(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.services["account"],
|
cls.services["account"],
|
||||||
@ -120,34 +120,39 @@ class TestStoragePool(cloudstackTestCase):
|
|||||||
securitygroup = SecurityGroup.list(cls.apiclient, account = cls.account.name, domainid= cls.account.domainid)[0]
|
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)
|
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_primary_storage = sp_pools[0]
|
||||||
|
cls.template_name = storpool_primary_storage["name"]
|
||||||
storpool_service_offerings = cls.testdata[TestData.serviceOffering]
|
|
||||||
|
|
||||||
cls.template_name = storpool_primary_storage.get("name")
|
|
||||||
|
|
||||||
storage_pool = list_storage_pools(
|
storage_pool = list_storage_pools(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name=cls.template_name
|
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(
|
service_offerings = list_service_offering(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name=cls.template_name
|
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:
|
if service_offerings is None:
|
||||||
service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
|
service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -29,6 +29,7 @@ from marvin.lib.base import (Account,
|
|||||||
User,
|
User,
|
||||||
Volume,
|
Volume,
|
||||||
SecurityGroup,
|
SecurityGroup,
|
||||||
|
DiskOffering,
|
||||||
)
|
)
|
||||||
from marvin.lib.common import (get_zone,
|
from marvin.lib.common import (get_zone,
|
||||||
get_domain,
|
get_domain,
|
||||||
@ -76,6 +77,8 @@ class TestVmSnapshot(cloudstackTestCase):
|
|||||||
cls.testdata = td.testdata
|
cls.testdata = td.testdata
|
||||||
cls.helper = StorPoolHelper()
|
cls.helper = StorPoolHelper()
|
||||||
|
|
||||||
|
sp_pools = cls.helper.get_pool(zone)
|
||||||
|
assert sp_pools is not None
|
||||||
|
|
||||||
cls.services = testClient.getParsedTestDataConfig()
|
cls.services = testClient.getParsedTestDataConfig()
|
||||||
# Get Zone, Domain and templates
|
# 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]
|
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)
|
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]
|
serviceOffering = cls.testdata[TestData.serviceOffering]
|
||||||
storage_pool = list_storage_pools(
|
storage_pool = list_storage_pools(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name = primarystorage.get("name")
|
name = primarystorage["name"]
|
||||||
)
|
)
|
||||||
cls.primary_storage = storage_pool[0]
|
cls.primary_storage = storage_pool[0]
|
||||||
|
|
||||||
disk_offering = list_disk_offering(
|
disk_offering = list_disk_offering(
|
||||||
cls.apiclient,
|
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(
|
service_offering_only = list_service_offering(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name="ssd"
|
name=primarystorage["name"]
|
||||||
)
|
)
|
||||||
if service_offering_only is not None:
|
if service_offering_only is not None:
|
||||||
cls.service_offering_only = service_offering_only[0]
|
cls.service_offering_only = service_offering_only[0]
|
||||||
@ -143,8 +149,6 @@ class TestVmSnapshot(cloudstackTestCase):
|
|||||||
serviceOffering)
|
serviceOffering)
|
||||||
assert cls.service_offering_only is not None
|
assert cls.service_offering_only is not None
|
||||||
|
|
||||||
cls.disk_offering = disk_offering[0]
|
|
||||||
|
|
||||||
# Create 1 data volume_1
|
# Create 1 data volume_1
|
||||||
cls.volume = Volume.create(
|
cls.volume = Volume.create(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
|
|||||||
@ -84,6 +84,10 @@ class TestData():
|
|||||||
diskOfferingTier1Template = "diskOfferingTier1Template"
|
diskOfferingTier1Template = "diskOfferingTier1Template"
|
||||||
diskOfferingTier2Template = "diskOfferingTier2Template"
|
diskOfferingTier2Template = "diskOfferingTier2Template"
|
||||||
diskOfferingWithTagsAndTempl = "diskOfferingWithTagsAndTempl"
|
diskOfferingWithTagsAndTempl = "diskOfferingWithTagsAndTempl"
|
||||||
|
diskOfferingSmall = "diskOfferingSmall"
|
||||||
|
diskOfferingMedium = "diskOfferingMedium"
|
||||||
|
diskOfferingLarge = "diskOfferingLarge"
|
||||||
|
diskOfferingCustom = "diskOfferingCustom"
|
||||||
domainId = "domainId"
|
domainId = "domainId"
|
||||||
hypervisor = "hypervisor"
|
hypervisor = "hypervisor"
|
||||||
login = "login"
|
login = "login"
|
||||||
@ -100,6 +104,7 @@ class TestData():
|
|||||||
serviceOfferingsPrimary = "serviceOfferingsPrimary"
|
serviceOfferingsPrimary = "serviceOfferingsPrimary"
|
||||||
serviceOfferingsIops = "serviceOfferingsIops"
|
serviceOfferingsIops = "serviceOfferingsIops"
|
||||||
serviceOfferingsCeph = "serviceOfferingsCeph"
|
serviceOfferingsCeph = "serviceOfferingsCeph"
|
||||||
|
serviceOfferingEncrypted = "serviceOfferingEncrypted"
|
||||||
scope = "scope"
|
scope = "scope"
|
||||||
StorPool = "StorPool"
|
StorPool = "StorPool"
|
||||||
storageTag = ["ssd", "ssd2"]
|
storageTag = ["ssd", "ssd2"]
|
||||||
@ -114,6 +119,8 @@ class TestData():
|
|||||||
volume_6 = "volume_6"
|
volume_6 = "volume_6"
|
||||||
volume_7 = "volume_7"
|
volume_7 = "volume_7"
|
||||||
zoneId = "zoneId"
|
zoneId = "zoneId"
|
||||||
|
sp_template_1 = 'sp_template_1'
|
||||||
|
sp_template_2 = 'sp_template_2'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
sp_template_1 = 'ssd'
|
sp_template_1 = 'ssd'
|
||||||
@ -221,6 +228,18 @@ class TestData():
|
|||||||
"customizediops": True,
|
"customizediops": True,
|
||||||
"tags": sp_template_1,
|
"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: {
|
TestData.diskOffering: {
|
||||||
"name": "SP_DO_1",
|
"name": "SP_DO_1",
|
||||||
"displaytext": "SP_DO_1 (5GB Min IOPS = 300; Max IOPS = 500)",
|
"displaytext": "SP_DO_1 (5GB Min IOPS = 300; Max IOPS = 500)",
|
||||||
@ -323,6 +342,38 @@ class TestData():
|
|||||||
TestData.tags: sp_template_1,
|
TestData.tags: sp_template_1,
|
||||||
"storagetype": "shared"
|
"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.volume_1: {
|
||||||
TestData.diskName: "test-volume-1",
|
TestData.diskName: "test-volume-1",
|
||||||
},
|
},
|
||||||
@ -344,6 +395,12 @@ class TestData():
|
|||||||
TestData.volume_7: {
|
TestData.volume_7: {
|
||||||
TestData.diskName: "test-volume-7",
|
TestData.diskName: "test-volume-7",
|
||||||
},
|
},
|
||||||
|
TestData.sp_template_1: {
|
||||||
|
"tags": "ssd"
|
||||||
|
},
|
||||||
|
TestData.sp_template_2: {
|
||||||
|
"tags": "ssd2"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
class StorPoolHelper():
|
class StorPoolHelper():
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
@ -847,3 +904,24 @@ class StorPoolHelper():
|
|||||||
break
|
break
|
||||||
|
|
||||||
return destinationHost
|
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.qos = "SP_QOSCLASS"
|
||||||
cls.spTemplate = "SP_TEMPLATE"
|
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,
|
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,
|
cls.disk_offerings_tier2_tags_template = cls.getDiskOffering(disk_offerings_tier2_tags_template, cls.spTemplate,
|
||||||
"virtual")
|
cls.testdata[TestData.sp_template_2]["tags"])
|
||||||
cls.resourceDetails(cls.qos, cls.disk_offerings_tier2_tags_template.id, "virtual")
|
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.account = cls.helper.create_account(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
@ -115,33 +115,35 @@ class TestStorPoolTiers(cloudstackTestCase):
|
|||||||
cls.helper.set_securityGroups(cls.apiclient, account=cls.account.name, domainid=cls.account.domainid,
|
cls.helper.set_securityGroups(cls.apiclient, account=cls.account.name, domainid=cls.account.domainid,
|
||||||
id=securitygroup.id)
|
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]
|
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(
|
storage_pool = list_storage_pools(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
name=cls.template_name
|
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:
|
if storage_pool is None:
|
||||||
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
storage_pool = StoragePool.create(cls.apiclient, storpool_primary_storage)
|
||||||
else:
|
else:
|
||||||
storage_pool = storage_pool[0]
|
storage_pool = storage_pool[0]
|
||||||
cls.storage_pool = storage_pool
|
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.debug(pprint.pformat(storage_pool))
|
||||||
|
|
||||||
|
|
||||||
|
service_offerings = list_service_offering(
|
||||||
|
cls.apiclient,
|
||||||
|
name=cls.template_name
|
||||||
|
)
|
||||||
|
|
||||||
if service_offerings is None:
|
if service_offerings is None:
|
||||||
service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
|
service_offerings = ServiceOffering.create(cls.apiclient, storpool_service_offerings)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user