@@ -22,23 +22,53 @@ def try_to_create_sr_with_missing_device(sr_type, label, host):
2222 return
2323 assert False , 'SR creation should not have succeeded!'
2424
25- def cold_migration_then_come_back (vm , prov_host , dest_host , dest_sr ):
25+ def cold_migration_then_come_back (vm : VM , prov_host : Host , dest_host : Host , dest_sr : SR ):
2626 """ Storage migration of a shutdown VM, then migrate it back. """
2727 prov_sr = vm .get_sr ()
28+ vdi_name = None
29+
30+ if not vm .is_windows :
31+ # the vdi will be destroyed with the vm
32+ vdi = prov_sr .create_vdi (virtual_size = 1 * GiB )
33+ vdi_name = vdi .name ()
34+ vm .connect_vdi (vdi , 'xvdb' )
35+ vm .start ()
36+ vm .wait_for_vm_running_and_ssh_up ()
37+ install_randstream (vm )
38+ logging .info ("Generate /dev/xvdb content" )
39+ vm .ssh ("randstream generate -v /dev/xvdb" )
40+ logging .info ("Validate /dev/xvdb" )
41+ vm .ssh ("randstream validate -v --expected-checksum 65280014 /dev/xvdb" )
42+ vm .shutdown (verify = True )
43+
2844 assert vm .is_halted ()
45+
2946 # Move the VM to another host of the pool
3047 vm .migrate (dest_host , dest_sr )
3148 wait_for (lambda : vm .all_vdis_on_sr (dest_sr ), "Wait for all VDIs on destination SR" )
49+
3250 # Start VM to make sure it works
3351 vm .start (on = dest_host .uuid )
34- vm .wait_for_os_booted ()
52+ if vm .is_windows :
53+ vm .wait_for_os_booted ()
54+ else :
55+ vm .wait_for_vm_running_and_ssh_up ()
56+ logging .info ("Validate /dev/xvdb" )
57+ vm .ssh ("randstream validate -v --expected-checksum 65280014 /dev/xvdb" )
3558 vm .shutdown (verify = True )
59+
3660 # Migrate it back to the provenance SR
3761 vm .migrate (prov_host , prov_sr )
3862 wait_for (lambda : vm .all_vdis_on_sr (prov_sr ), "Wait for all VDIs back on provenance SR" )
63+
3964 # Start VM to make sure it works
4065 vm .start (on = prov_host .uuid )
41- vm .wait_for_os_booted ()
66+ if vm .is_windows :
67+ vm .wait_for_os_booted ()
68+ else :
69+ vm .wait_for_vm_running_and_ssh_up ()
70+ logging .info ("Validate /dev/xvdb" )
71+ vm .ssh ("randstream validate -v --expected-checksum 65280014 /dev/xvdb" )
4272 vm .shutdown (verify = True )
4373
4474 if vdi_name is not None :
0 commit comments