File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -502,6 +502,23 @@ def test_04_change_offering_small(self):
502502 self .skipTest ("Skipping this test for {} due to bug CS-38153" .format (self .hypervisor ))
503503 try :
504504 self .medium_virtual_machine .stop (self .apiclient )
505+ timeout = self .services ["timeout" ]
506+ while True :
507+ time .sleep (self .services ["sleep" ])
508+ # Ensure that VM is in stopped state
509+ list_vm_response = list_virtual_machines (
510+ self .apiclient ,
511+ id = self .medium_virtual_machine .id
512+ )
513+ if isinstance (list_vm_response , list ):
514+ vm = list_vm_response [0 ]
515+ if vm .state == 'Stopped' :
516+ self .debug ("VM state: %s" % vm .state )
517+ break
518+ if timeout == 0 :
519+ raise Exception (
520+ "Failed to stop VM (ID: %s) in change service offering" % vm .id )
521+ timeout = timeout - 1
505522 except Exception as e :
506523 self .fail ("Failed to stop VM: %s" % e )
507524
Original file line number Diff line number Diff line change @@ -454,6 +454,30 @@ def test_change_service_offering_for_vm_with_snapshots(self):
454454 self .debug ("Stopping VM - ID: %s" % virtual_machine .id )
455455 try :
456456 virtual_machine .stop (self .apiclient )
457+ timeout = self .services ["timeout" ]
458+
459+ while True :
460+ time .sleep (self .services ["sleep" ])
461+
462+ # Ensure that VM is in stopped state
463+ list_vm_response = list_virtual_machines (
464+ self .apiclient ,
465+ id = virtual_machine .id
466+ )
467+
468+ if isinstance (list_vm_response , list ):
469+
470+ vm = list_vm_response [0 ]
471+ if vm .state == 'Stopped' :
472+ self .debug ("VM state: %s" % vm .state )
473+ break
474+
475+ if timeout == 0 :
476+ raise Exception (
477+ "Failed to stop VM (ID: %s) in change service offering" % vm .id )
478+
479+ timeout = timeout - 1
480+
457481 except Exception as e :
458482 self .fail ("Failed to stop VM: %s" % e )
459483
You can’t perform that action at this time.
0 commit comments