mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7228 Only shrink disk when CLVM is in use.
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
396f29c135
commit
9b783d19ad
@ -30,7 +30,8 @@ from marvin.lib.base import (ServiceOffering,
|
|||||||
Account,
|
Account,
|
||||||
Volume,
|
Volume,
|
||||||
Host,
|
Host,
|
||||||
DiskOffering)
|
DiskOffering,
|
||||||
|
StoragePool)
|
||||||
from marvin.lib.common import (get_domain,
|
from marvin.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template)
|
get_template)
|
||||||
@ -660,41 +661,55 @@ class TestVolumes(cloudstackTestCase):
|
|||||||
"Check if the data volume resized appropriately"
|
"Check if the data volume resized appropriately"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.services["disk_offering"]["disksize"] = 10
|
can_shrink = False
|
||||||
disk_offering_10_GB = DiskOffering.create(
|
|
||||||
self.apiclient,
|
|
||||||
self.services["disk_offering"]
|
|
||||||
)
|
|
||||||
self.cleanup.append(disk_offering_10_GB)
|
|
||||||
|
|
||||||
cmd = resizeVolume.resizeVolumeCmd()
|
list_volume_response = Volume.list(
|
||||||
cmd.id = self.volume.id
|
self.apiClient,
|
||||||
cmd.diskofferingid = disk_offering_10_GB.id
|
id=self.volume.id,
|
||||||
cmd.shrinkok = "true"
|
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
|
||||||
|
|
||||||
self.apiClient.resizeVolume(cmd)
|
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)
|
||||||
|
|
||||||
count = 0
|
cmd = resizeVolume.resizeVolumeCmd()
|
||||||
success = False
|
cmd.id = self.volume.id
|
||||||
while count < 3:
|
cmd.diskofferingid = disk_offering_10_GB.id
|
||||||
list_volume_response = Volume.list(
|
cmd.shrinkok = "true"
|
||||||
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(
|
self.apiClient.resizeVolume(cmd)
|
||||||
success,
|
|
||||||
True,
|
count = 0
|
||||||
"Check if the root volume resized appropriately"
|
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
|
#start the vm if it is on xenserver
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user