@@ -531,29 +531,19 @@ def test_08_migrate_vm(self):
531531
532532 self .vm_to_migrate .migrate (self .apiclient , migrate_host .id )
533533
534- list_vm_response = VirtualMachine .list (
535- self .apiclient ,
536- id = self .vm_to_migrate .id
537- )
538- self .assertNotEqual (
539- list_vm_response ,
540- None ,
541- "Check virtual machine is listed"
542- )
543-
544- vm_response = list_vm_response [0 ]
545-
546- self .assertEqual (
547- vm_response .id ,
548- self .vm_to_migrate .id ,
549- "Check virtual machine ID of migrated VM"
550- )
551-
552- self .assertEqual (
553- vm_response .hostid ,
554- migrate_host .id ,
555- "Check destination hostID of migrated VM"
556- )
534+ retries_cnt = 3
535+ while retries_cnt >= 0 :
536+ list_vm_response = VirtualMachine .list (self .apiclient ,
537+ id = self .vm_to_migrate .id )
538+ self .assertNotEqual (
539+ list_vm_response ,
540+ None ,
541+ "Check virtual machine is listed"
542+ )
543+ vm_response = list_vm_response [0 ]
544+ self .assertEqual (vm_response .id ,self .vm_to_migrate .id ,"Check virtual machine ID of migrated VM" )
545+ self .assertEqual (vm_response .hostid ,migrate_host .id ,"Check destination hostID of migrated VM" )
546+ retries_cnt = retries_cnt - 1
557547 return
558548
559549 @attr (configuration = "expunge.interval" )
@@ -592,19 +582,15 @@ def test_09_expunge_vm(self):
592582 self .apiclient ,
593583 id = self .small_virtual_machine .id
594584 )
595- if list_vm_response :
596- time .sleep (expunge_cycle )
597- wait_time = wait_time - expunge_cycle
598- else :
585+ if not list_vm_response :
599586 break
587+ self .debug ("Waiting for VM to expunge" )
588+ time .sleep (expunge_cycle )
589+ wait_time = wait_time - expunge_cycle
600590
601591 self .debug ("listVirtualMachines response: %s" % list_vm_response )
602592
603- self .assertEqual (
604- list_vm_response ,
605- None ,
606- "Check Expunged virtual machine is in listVirtualMachines response"
607- )
593+ self .assertEqual (list_vm_response ,None ,"Check Expunged virtual machine is in listVirtualMachines response" )
608594 return
609595
610596 @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" , "sg" , "provisioning" ])
0 commit comments