cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject git commit: updated refs/heads/master to 9b783d1
Date Wed, 03 Sep 2014 07:01:49 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 396f29c13 -> 9b783d19a


CLOUDSTACK-7228 Only shrink disk when CLVM is in use.

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


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

Branch: refs/heads/master
Commit: 9b783d19ad7e784d3751f4eaa2a672401d122a01
Parents: 396f29c
Author: John Dilley <john.dilley@citrix.com>
Authored: Thu Aug 14 10:38:08 2014 +0000
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Wed Sep 3 12:30:59 2014 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_volumes.py | 79 +++++++++++++++++------------
 1 file changed, 47 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b783d19/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 579b0ae..bc0dcbb 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -30,7 +30,8 @@ from marvin.lib.base import (ServiceOffering,
                              Account,
                              Volume,
                              Host,
-                             DiskOffering)
+                             DiskOffering,
+                             StoragePool)
 from marvin.lib.common import (get_domain,
                                 get_zone,
                                 get_template)
@@ -660,41 +661,55 @@ class TestVolumes(cloudstackTestCase):
                          "Check if the data volume resized appropriately"
                          )
 
-        self.services["disk_offering"]["disksize"] = 10
-        disk_offering_10_GB = DiskOffering.create(
-                                    self.apiclient,
-                                    self.services["disk_offering"]
-                                    )
-        self.cleanup.append(disk_offering_10_GB)
+        can_shrink = False
 
-        cmd                = resizeVolume.resizeVolumeCmd()
-        cmd.id             = self.volume.id
-        cmd.diskofferingid = disk_offering_10_GB.id
-        cmd.shrinkok       = "true"
+        list_volume_response = Volume.list(
+                                            self.apiClient,
+                                            id=self.volume.id,
+                                            type='DATADISK'
+                                            )
+        storage_pool_id = [x.storageid for x in list_volume_response if x.id == self.volume.id][0]
+        storage = StoragePool.list(self.apiclient, id=storage_pool_id)[0]
+        # At present only CLVM supports shrinking volumes
+        if storage.type.lower() == "clvm":
+            can_shrink = True
+
+        if can_shrink:
+            self.services["disk_offering"]["disksize"] = 10
+            disk_offering_10_GB = DiskOffering.create(
+                                        self.apiclient,
+                                        self.services["disk_offering"]
+                                        )
+            self.cleanup.append(disk_offering_10_GB)
 
-        self.apiClient.resizeVolume(cmd)
+            cmd                = resizeVolume.resizeVolumeCmd()
+            cmd.id             = self.volume.id
+            cmd.diskofferingid = disk_offering_10_GB.id
+            cmd.shrinkok       = "true"
 
-        count = 0
-        success = False
-        while count < 3:
-            list_volume_response = Volume.list(
-                                                self.apiClient,
-                                                id=self.volume.id
-                                                )
-            for vol in list_volume_response:
-                if vol.id == self.volume.id and int(vol.size) == (int(disk_offering_10_GB.disksize)
* (1024 ** 3)) and vol.state == 'Ready':
-                    success = True
-            if success:
-                break
-            else:
-                time.sleep(10)
-                count += 1
+            self.apiClient.resizeVolume(cmd)
 
-        self.assertEqual(
-                         success,
-                         True,
-                         "Check if the root volume resized appropriately"
-                         )
+            count = 0
+            success = False
+            while count < 3:
+                list_volume_response = Volume.list(
+                                                    self.apiClient,
+                                                    id=self.volume.id
+                                                    )
+                for vol in list_volume_response:
+                    if vol.id == self.volume.id and int(vol.size) == (int(disk_offering_10_GB.disksize)
* (1024 ** 3)) and vol.state == 'Ready':
+                        success = True
+                if success:
+                    break
+                else:
+                    time.sleep(10)
+                    count += 1
+
+            self.assertEqual(
+                             success,
+                             True,
+                             "Check if the root volume resized appropriately"
+                             )
 
         #start the vm if it is on xenserver
 


Mime
View raw message