@@ -20,23 +20,51 @@ def try_to_create_sr_with_missing_device(sr_type, label, host):
2020 return
2121 assert False , 'SR creation should not have succeeded!'
2222
23- def cold_migration_then_come_back (vm , prov_host , dest_host , dest_sr ):
23+ def cold_migration_then_come_back (vm : VM , prov_host : Host , dest_host : Host , dest_sr : SR ):
2424 """ Storage migration of a shutdown VM, then migrate it back. """
2525 prov_sr = vm .get_sr ()
26+
27+ if not vm .is_windows :
28+ # the vdi will be destroyed with the vm
29+ vdi = prov_sr .create_vdi (virtual_size = '1GiB' )
30+ vm .connect_vdi (vdi , 'xvdb' )
31+ vm .start ()
32+ vm .wait_for_vm_running_and_ssh_up ()
33+ install_randstream (vm )
34+ logging .info ("Generate /dev/xvdb content" )
35+ vm .ssh ("randstream generate -v /dev/xvdb" )
36+ logging .info ("Validate /dev/xvdb" )
37+ vm .ssh ("randstream validate -v --expected-checksum 65280014 /dev/xvdb" )
38+ vm .shutdown (verify = True )
39+
2640 assert vm .is_halted ()
41+
2742 # Move the VM to another host of the pool
2843 vm .migrate (dest_host , dest_sr )
2944 wait_for (lambda : vm .all_vdis_on_sr (dest_sr ), "Wait for all VDIs on destination SR" )
45+
3046 # Start VM to make sure it works
3147 vm .start (on = dest_host .uuid )
32- vm .wait_for_os_booted ()
48+ if vm .is_windows :
49+ vm .wait_for_os_booted ()
50+ else :
51+ vm .wait_for_vm_running_and_ssh_up ()
52+ logging .info ("Validate /dev/xvdb" )
53+ vm .ssh ("randstream validate -v --expected-checksum 65280014 /dev/xvdb" )
3354 vm .shutdown (verify = True )
55+
3456 # Migrate it back to the provenance SR
3557 vm .migrate (prov_host , prov_sr )
3658 wait_for (lambda : vm .all_vdis_on_sr (prov_sr ), "Wait for all VDIs back on provenance SR" )
59+
3760 # Start VM to make sure it works
3861 vm .start (on = prov_host .uuid )
39- vm .wait_for_os_booted ()
62+ if vm .is_windows :
63+ vm .wait_for_os_booted ()
64+ else :
65+ vm .wait_for_vm_running_and_ssh_up ()
66+ logging .info ("Validate /dev/xvdb" )
67+ vm .ssh ("randstream validate -v --expected-checksum 65280014 /dev/xvdb" )
4068 vm .shutdown (verify = True )
4169
4270def live_storage_migration_then_come_back (vm : VM , prov_host : Host , dest_host : Host , dest_sr : SR ):
0 commit comments