mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8161: mark the data volume related operations on LXC as skipped if RBD storage pool is not available
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
71103772b7
commit
3384888c39
|
|
@ -97,6 +97,7 @@ class TestStorageMotion(cloudstackTestCase):
|
|||
domain = get_domain(cls.api_client)
|
||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||
cls.services['mode'] = cls.zone.networktype
|
||||
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -160,6 +161,8 @@ class TestStorageMotion(cloudstackTestCase):
|
|||
# 3. listVM command should return this VM.State of this VM
|
||||
# should be "Running" and the host should be the host
|
||||
# to which the VM was migrated to in a different cluster
|
||||
if self.hypervisor.lower() in ["lxc"]:
|
||||
self.skipTest("Migration across clusters is not supported on LXC")
|
||||
|
||||
hosts = Host.listForMigration(
|
||||
self.apiclient,
|
||||
|
|
@ -179,6 +182,7 @@ class TestStorageMotion(cloudstackTestCase):
|
|||
self.skipTest("No valid hosts for storage motion. Skipping")
|
||||
|
||||
|
||||
|
||||
host = hosts[0]
|
||||
self.debug("Migrating VM-ID: %s to Host: %s" % (
|
||||
self.virtual_machine.id,
|
||||
|
|
@ -238,6 +242,8 @@ class TestStorageMotion(cloudstackTestCase):
|
|||
# 3. Migrate volume of the vm to another pool.
|
||||
# 4. Check volume is present in the new pool and is in Ready state.
|
||||
|
||||
# TODO: add test case for data volume migrate
|
||||
|
||||
list_volumes_response = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=self.virtual_machine.id,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
""" BVT tests for Volumes
|
||||
"""
|
||||
#Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
#from marvin.cloudstackException import *
|
||||
from marvin.cloudstackAPI import (deleteVolume,
|
||||
extractVolume,
|
||||
|
|
@ -34,7 +34,8 @@ from marvin.lib.base import (ServiceOffering,
|
|||
StoragePool,)
|
||||
from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template)
|
||||
get_template,
|
||||
find_storage_pool_type)
|
||||
from marvin.lib.utils import checkVolumeSize
|
||||
from marvin.codes import SUCCESS, FAILED, XEN_SERVER
|
||||
from nose.plugins.attrib import attr
|
||||
|
|
@ -56,7 +57,12 @@ class TestCreateVolume(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
|
||||
cls.hypervisor = testClient.getHypervisorInfo()
|
||||
cls.services['mode'] = cls.zone.networktype
|
||||
#for LXC if the storage pool of type 'rbd' ex: ceph is not available, skip the test
|
||||
if cls.hypervisor.lower() == 'lxc':
|
||||
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
|
||||
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.apiclient,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -263,6 +269,11 @@ class TestVolumes(cloudstackTestCase):
|
|||
cls.domain = get_domain(cls.apiclient)
|
||||
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
|
||||
cls.services['mode'] = cls.zone.networktype
|
||||
cls.hypervisor = testClient.getHypervisorInfo()
|
||||
#for LXC if the storage pool of type 'rbd' ex: ceph is not available, skip the test
|
||||
if cls.hypervisor.lower() == 'lxc':
|
||||
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
|
||||
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.apiclient,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -310,7 +321,16 @@ class TestVolumes(cloudstackTestCase):
|
|||
serviceofferingid=cls.service_offering.id,
|
||||
mode=cls.services["mode"]
|
||||
)
|
||||
pools = StoragePool.list(cls.apiclient)
|
||||
# cls.assertEqual(
|
||||
# validateList(pools)[0],
|
||||
# PASS,
|
||||
# "storage pool list validation failed")
|
||||
|
||||
|
||||
|
||||
if cls.hypervisor.lower() == 'lxc' and cls.storage_pools.type.lower() != 'rbd':
|
||||
raise unittest.SkipTest("Snapshots not supported on Hyper-V or LXC")
|
||||
cls.volume = Volume.create(
|
||||
cls.apiclient,
|
||||
cls.services,
|
||||
|
|
|
|||
|
|
@ -204,6 +204,25 @@ def get_domain(apiclient, domain_id=None, domain_name=None):
|
|||
return cmd_out[0]
|
||||
|
||||
|
||||
def find_storage_pool_type(apiclient, storagetype='NetworkFileSystem'):
|
||||
"""
|
||||
@name : find_storage_pool_type
|
||||
@Desc : Returns true if the given storage pool type exists
|
||||
@Input : type : type of the storage pool[NFS, RBD, etc.,]
|
||||
@Output : True : if the type of storage is found
|
||||
False : if the type of storage is not found
|
||||
FAILED In case the cmd failed
|
||||
"""
|
||||
cmd = listStoragePools.listStoragePoolsCmd()
|
||||
cmd_out = apiclient.listStoragePools(cmd)
|
||||
if validateList(cmd_out)[0] != PASS:
|
||||
return FAILED
|
||||
for storage_pool in cmd_out:
|
||||
if storage_pool.type.lower() == storagetype:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_zone(apiclient, zone_name=None, zone_id=None):
|
||||
'''
|
||||
@name : get_zone
|
||||
|
|
|
|||
Loading…
Reference in New Issue