@@ -634,9 +634,16 @@ def test_08_resize_volume(self):
634634 # resize the data disk
635635 self .debug ("Resize Volume ID: %s" % self .volume .id )
636636
637+ self .services ["disk_offering" ]["disksize" ] = 20
638+ disk_offering_20_GB = DiskOffering .create (
639+ self .apiclient ,
640+ self .services ["disk_offering" ]
641+ )
642+ self .cleanup .append (disk_offering_20_GB )
643+
637644 cmd = resizeVolume .resizeVolumeCmd ()
638645 cmd .id = self .volume .id
639- cmd .diskofferingid = self . services [ 'customresizeddiskofferingid' ]
646+ cmd .diskofferingid = disk_offering_20_GB . id
640647
641648 self .apiClient .resizeVolume (cmd )
642649
@@ -649,7 +656,7 @@ def test_08_resize_volume(self):
649656 type = 'DATADISK'
650657 )
651658 for vol in list_volume_response :
652- if vol .id == self .volume .id and vol .size == 3221225472L and vol .state == 'Ready' :
659+ if vol .id == self .volume .id and int ( vol .size ) == ( int ( disk_offering_20_GB . disksize ) * ( 1024 ** 3 )) and vol .state == 'Ready' :
653660 success = True
654661 if success :
655662 break
@@ -663,22 +670,16 @@ def test_08_resize_volume(self):
663670 "Check if the data volume resized appropriately"
664671 )
665672
666- # resize the root disk
667- self .debug ("Resize Root for : %s" % self .virtual_machine .id )
668-
669- # get root vol from created vm
670- list_volume_response = Volume .list (
671- self .apiClient ,
672- virtualmachineid = self .virtual_machine .id ,
673- type = 'ROOT' ,
674- listall = True
675- )
676-
677- rootvolume = list_volume_response [0 ]
673+ self .services ["disk_offering" ]["disksize" ] = 10
674+ disk_offering_10_GB = DiskOffering .create (
675+ self .apiclient ,
676+ self .services ["disk_offering" ]
677+ )
678+ self .cleanup .append (disk_offering_10_GB )
678679
679680 cmd = resizeVolume .resizeVolumeCmd ()
680- cmd .id = rootvolume .id
681- cmd .size = 10
681+ cmd .id = self . volume .id
682+ cmd .diskofferingid = disk_offering_10_GB . id
682683 cmd .shrinkok = "true"
683684
684685 self .apiClient .resizeVolume (cmd )
@@ -688,10 +689,10 @@ def test_08_resize_volume(self):
688689 while count < 3 :
689690 list_volume_response = Volume .list (
690691 self .apiClient ,
691- id = rootvolume .id
692+ id = self . volume .id
692693 )
693694 for vol in list_volume_response :
694- if vol .id == rootvolume . id and vol .size == 10737418240L and vol .state == 'Ready' :
695+ if vol .id == self . volume . id and int ( vol .size ) == ( int ( disk_offering_10_GB . disksize ) * ( 1024 ** 3 )) and vol .state == 'Ready' :
695696 success = True
696697 if success :
697698 break
0 commit comments