Repository: cloudstack
Updated Branches:
  refs/heads/master 49de3ab03 -> 0d5a435f7


Creating custom disk does not work as expected


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

Branch: refs/heads/master
Commit: 0d5a435f7669eddd44a6b62317fe26bb1d96e96c
Parents: 49de3ab
Author: sanjeev <[email protected]>
Authored: Tue Sep 23 14:15:39 2014 +0530
Committer: sanjeev <[email protected]>
Committed: Tue Sep 23 14:15:39 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_volumes.py       | 68 +++++++++++++++++++-
 tools/marvin/marvin/lib/base.py                 |  3 -
 2 files changed, 67 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0d5a435f/test/integration/component/test_escalations_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_volumes.py 
b/test/integration/component/test_escalations_volumes.py
index 0d78c58..8d6ba99 100644
--- a/test/integration/component/test_escalations_volumes.py
+++ b/test/integration/component/test_escalations_volumes.py
@@ -19,7 +19,7 @@
 from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.cloudstackAPI import createVolume, createTemplate
 from marvin.lib.utils import (cleanup_resources,
-                              random_gen)
+                              random_gen,validateList)
 from marvin.lib.base import (Account,
                              VirtualMachine,
                              ServiceOffering,
@@ -32,6 +32,7 @@ from marvin.lib.common import (get_domain,
                                get_zone,
                                get_template)
 from nose.plugins.attrib import attr
+from marvin.codes import PASS
 
 
 class TestVolumes(cloudstackTestCase):
@@ -1793,3 +1794,68 @@ class TestVolumes(cloudstackTestCase):
             "upload volume failed"
         )
         return
+
+    @attr(tags=["advanced","basic","sg"], required_hardware="true")
+    def test_13_volume_custom_disk_size(self):
+        """
+        @Desc:Create volume from custom disk offering does not work as expected
+        Step1:Create custom disk offering
+        Step2:Create Volume with size x
+        Step3:Attach that volume to a vm
+        Step4:Create another volume with size y
+        Step5:Verify that the new volume is created with size Y but not with 
size X
+        """
+        disk_offering = DiskOffering.create(
+            self.api_client,
+            self.services["disk_offering"],
+            custom=True
+        )
+        self.assertIsNotNone(disk_offering,"Failed to create custom disk 
offering")
+        self.cleanup.append(disk_offering)
+        self.services["custom_volume"]["customdisksize"]=2
+        vol1 = Volume.create_custom_disk(
+            self.userapiclient,
+            self.services["custom_volume"],
+            account=self.account.name,
+            domainid=self.domain.id,
+            diskofferingid=disk_offering.id
+        )
+        self.assertIsNotNone(vol1,"Volume creation failed with custom disk 
size")
+        vol1_res = Volume.list(
+            self.userapiclient,
+            id=vol1.id
+        )
+        self.assertEqual(validateList(vol1_res)[0],PASS,"Volume list returned 
invalid response")
+        self.cleanup.append(vol1)
+        vol1_size = vol1_res[0].size
+        try:
+            self.virtual_machine.attach_volume(self.userapiclient,vol1)
+        except Exception as e:
+            self.fail("Attaching custom data disk to vm failed with 
error{}".format(e))
+        self.services["custom_volume"]["customdisksize"]=3
+        vol2 = Volume.create_custom_disk(
+            self.userapiclient,
+            self.services["custom_volume"],
+            account=self.account.name,
+            domainid=self.domain.id,
+            diskofferingid=disk_offering.id
+        )
+        self.assertIsNotNone(vol2,"Failed to create custom data disk with size 
%s" %
+                             self.services["custom_volume"]["customdisksize"])
+        self.cleanup.append(vol2)
+        vol2_res = Volume.list(
+            self.userapiclient,
+            id=vol2.id
+        )
+        self.assertEqual(validateList(vol2_res)[0],PASS,"Volume list returned 
invalid response")
+        vol2_size=vol2_res[0].size
+        self.assertNotEqual(
+            vol1_size,
+            vol2_size,
+            "Creating volume from custom disk offering does not work as 
expected"
+        )
+        try:
+            self.virtual_machine.detach_volume(self.userapiclient,vol1)
+        except Exception as e:
+            self.fail("Detaching volume failed with error %s" % e)
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0d5a435f/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index b0dd6e2..528fc78 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1971,9 +1971,6 @@ class DiskOffering:
         if "customizediops" in services:
             cmd.customizediops = services["customizediops"]
 
-        if "disksize" in services:
-            cmd.disksize = services["disksize"]
-
         if "maxiops" in services:
             cmd.maxiops = services["maxiops"]
 

Reply via email to