@@ -726,67 +726,6 @@ def test_08_resize_volume(self):
726726 time .sleep (30 )
727727 return
728728
729- @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" ], required_hardware = "true" )
730- def test_12_resize_volume_with_only_size_parameter (self ):
731- """Test resize a volume by providing only size parameter, disk offering id is not mandatory"""
732- # Verify the size is the new size is what we wanted it to be.
733- self .debug (
734- "Attaching volume (ID: %s) to VM (ID: %s)" % (
735- self .volume .id ,
736- self .virtual_machine .id
737- ))
738-
739- self .virtual_machine .attach_volume (self .apiClient , self .volume )
740- self .attached = True
741- hosts = Host .list (self .apiClient , id = self .virtual_machine .hostid )
742- self .assertTrue (isinstance (hosts , list ))
743- self .assertTrue (len (hosts ) > 0 )
744- self .debug ("Found %s host" % hosts [0 ].hypervisor )
745-
746- if hosts [0 ].hypervisor == "XenServer" :
747- self .virtual_machine .stop (self .apiClient )
748- elif hosts [0 ].hypervisor .lower () == "hyperv" :
749- self .skipTest ("Resize Volume is unsupported on Hyper-V" )
750-
751- # resize the data disk
752- self .debug ("Resize Volume ID: %s" % self .volume .id )
753-
754- cmd = resizeVolume .resizeVolumeCmd ()
755- cmd .id = self .volume .id
756- cmd .size = 20
757-
758- self .apiClient .resizeVolume (cmd )
759-
760- count = 0
761- success = False
762- while count < 3 :
763- list_volume_response = Volume .list (
764- self .apiClient ,
765- id = self .volume .id ,
766- type = 'DATADISK'
767- )
768- for vol in list_volume_response :
769- if vol .id == self .volume .id and int (vol .size ) == (20 * (1024 ** 3 )) and vol .state == 'Ready' :
770- success = True
771- if success :
772- break
773- else :
774- time .sleep (10 )
775- count += 1
776-
777- self .assertEqual (
778- success ,
779- True ,
780- "Check if the data volume resized appropriately"
781- )
782-
783- # start the vm if it is on xenserver
784-
785- if hosts [0 ].hypervisor == "XenServer" :
786- self .virtual_machine .start (self .apiClient )
787- time .sleep (30 )
788- return
789-
790729 @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" ], required_hardware = "false" )
791730 def test_09_delete_detached_volume (self ):
792731 """Delete a Volume unattached to an VM
@@ -943,6 +882,67 @@ def test_11_attach_volume_with_unstarted_vm(self):
943882
944883 return
945884
885+ @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" ], required_hardware = "true" )
886+ def test_12_resize_volume_with_only_size_parameter (self ):
887+ """Test resize a volume by providing only size parameter, disk offering id is not mandatory"""
888+ # Verify the size is the new size is what we wanted it to be.
889+ self .debug (
890+ "Attaching volume (ID: %s) to VM (ID: %s)" % (
891+ self .volume .id ,
892+ self .virtual_machine .id
893+ ))
894+
895+ self .virtual_machine .attach_volume (self .apiClient , self .volume )
896+ self .attached = True
897+ hosts = Host .list (self .apiClient , id = self .virtual_machine .hostid )
898+ self .assertTrue (isinstance (hosts , list ))
899+ self .assertTrue (len (hosts ) > 0 )
900+ self .debug ("Found %s host" % hosts [0 ].hypervisor )
901+
902+ if hosts [0 ].hypervisor == "XenServer" :
903+ self .virtual_machine .stop (self .apiClient )
904+ elif hosts [0 ].hypervisor .lower () == "hyperv" :
905+ self .skipTest ("Resize Volume is unsupported on Hyper-V" )
906+
907+ # resize the data disk
908+ self .debug ("Resize Volume ID: %s" % self .volume .id )
909+
910+ cmd = resizeVolume .resizeVolumeCmd ()
911+ cmd .id = self .volume .id
912+ cmd .size = 20
913+
914+ self .apiClient .resizeVolume (cmd )
915+
916+ count = 0
917+ success = False
918+ while count < 3 :
919+ list_volume_response = Volume .list (
920+ self .apiClient ,
921+ id = self .volume .id ,
922+ type = 'DATADISK'
923+ )
924+ for vol in list_volume_response :
925+ if vol .id == self .volume .id and int (vol .size ) == (20 * (1024 ** 3 )) and vol .state == 'Ready' :
926+ success = True
927+ if success :
928+ break
929+ else :
930+ time .sleep (10 )
931+ count += 1
932+
933+ self .assertEqual (
934+ success ,
935+ True ,
936+ "Check if the data volume resized appropriately"
937+ )
938+
939+ # start the vm if it is on xenserver
940+
941+ if hosts [0 ].hypervisor == "XenServer" :
942+ self .virtual_machine .start (self .apiClient )
943+ time .sleep (30 )
944+ return
945+
946946 def wait_for_attributes_and_return_root_vol (self ):
947947 def checkVolumeResponse ():
948948 list_volume_response = Volume .list (
@@ -963,7 +963,7 @@ def checkVolumeResponse():
963963 return response
964964
965965 @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" ], required_hardware = "true" )
966- def test_11_migrate_volume_and_change_offering (self ):
966+ def test_13_migrate_volume_and_change_offering (self ):
967967 """
968968 Validates the following
969969 1. Creates a new Volume with a small disk offering
0 commit comments