Creating custom disk does not work as expected

This commit is contained in:
sanjeev 2014-09-23 14:15:39 +05:30
parent 49de3ab037
commit 0d5a435f76
2 changed files with 67 additions and 4 deletions

View File

@ -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

View File

@ -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"]