You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2015/01/16 14:16:40 UTC

git commit: updated refs/heads/master to 3384888

Repository: cloudstack
Updated Branches:
  refs/heads/master 71103772b -> 3384888c3


CLOUDSTACK-8161: mark the data volume related operations on LXC as skipped if RBD storage pool is not available
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3384888c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3384888c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3384888c

Branch: refs/heads/master
Commit: 3384888c39fc3e9d6852e77232a59a977207217d
Parents: 7110377
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Fri Jan 16 18:39:17 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Jan 16 18:46:03 2015 +0530

----------------------------------------------------------------------
 .../component/test_storage_motion.py            |  6 +++++
 test/integration/smoke/test_volumes.py          | 24 ++++++++++++++++++--
 tools/marvin/marvin/lib/common.py               | 19 ++++++++++++++++
 3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3384888c/test/integration/component/test_storage_motion.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_storage_motion.py b/test/integration/component/test_storage_motion.py
index acbf92d..163b447 100644
--- a/test/integration/component/test_storage_motion.py
+++ b/test/integration/component/test_storage_motion.py
@@ -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,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3384888c/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index a6387996..3362396 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -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,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3384888c/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 9e3d40c..28ec024 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -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