@@ -650,9 +650,16 @@ def test_08_resize_volume(self):
650650 # resize the data disk
651651 self .debug ("Resize Volume ID: %s" % self .volume .id )
652652
653+ self .services ["disk_offering" ]["disksize" ] = 20
654+ disk_offering_20_GB = DiskOffering .create (
655+ self .apiclient ,
656+ self .services ["disk_offering" ]
657+ )
658+ self .cleanup .append (disk_offering_20_GB )
659+
653660 cmd = resizeVolume .resizeVolumeCmd ()
654661 cmd .id = self .volume .id
655- cmd .diskofferingid = self . services [ 'customresizeddiskofferingid' ]
662+ cmd .diskofferingid = disk_offering_20_GB . id
656663
657664 self .apiClient .resizeVolume (cmd )
658665
@@ -665,7 +672,7 @@ def test_08_resize_volume(self):
665672 type = 'DATADISK'
666673 )
667674 for vol in list_volume_response :
668- if vol .id == self .volume .id and vol .size == 3221225472L and vol .state == 'Ready' :
675+ if vol .id == self .volume .id and int ( vol .size ) == ( int ( disk_offering_20_GB . disksize ) * ( 1024 ** 3 )) and vol .state == 'Ready' :
669676 success = True
670677 if success :
671678 break
@@ -679,22 +686,16 @@ def test_08_resize_volume(self):
679686 "Check if the data volume resized appropriately"
680687 )
681688
682- # resize the root disk
683- self .debug ("Resize Root for : %s" % self .virtual_machine .id )
684-
685- # get root vol from created vm
686- list_volume_response = Volume .list (
687- self .apiClient ,
688- virtualmachineid = self .virtual_machine .id ,
689- type = 'ROOT' ,
690- listall = True
691- )
692-
693- rootvolume = list_volume_response [0 ]
689+ self .services ["disk_offering" ]["disksize" ] = 10
690+ disk_offering_10_GB = DiskOffering .create (
691+ self .apiclient ,
692+ self .services ["disk_offering" ]
693+ )
694+ self .cleanup .append (disk_offering_10_GB )
694695
695696 cmd = resizeVolume .resizeVolumeCmd ()
696- cmd .id = rootvolume .id
697- cmd .size = 10
697+ cmd .id = self . volume .id
698+ cmd .diskofferingid = disk_offering_10_GB . id
698699 cmd .shrinkok = "true"
699700
700701 self .apiClient .resizeVolume (cmd )
@@ -704,10 +705,10 @@ def test_08_resize_volume(self):
704705 while count < 3 :
705706 list_volume_response = Volume .list (
706707 self .apiClient ,
707- id = rootvolume .id
708+ id = self . volume .id
708709 )
709710 for vol in list_volume_response :
710- if vol .id == rootvolume . id and vol .size == 10737418240L and vol .state == 'Ready' :
711+ if vol .id == self . volume . id and int ( vol .size ) == ( int ( disk_offering_10_GB . disksize ) * ( 1024 ** 3 )) and vol .state == 'Ready' :
711712 success = True
712713 if success :
713714 break
0 commit comments