Skip to content

Commit 804519b

Browse files
committed
Add integrity check in cold migration tests
Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent 676bf3b commit 804519b

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

tests/storage/storage.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,51 @@ 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+
29+
if not vm.is_windows:
30+
# the vdi will be destroyed with the vm
31+
vdi = prov_sr.create_vdi(virtual_size='1GiB')
32+
vm.connect_vdi(vdi, 'xvdb')
33+
vm.start()
34+
vm.wait_for_vm_running_and_ssh_up()
35+
install_randstream(vm)
36+
logging.info("Generate /dev/xvdb content")
37+
vm.ssh("randstream generate -v /dev/xvdb")
38+
logging.info("Validate /dev/xvdb")
39+
vm.ssh("randstream validate -v --expected-checksum 65280014 /dev/xvdb")
40+
vm.shutdown(verify=True)
41+
2842
assert vm.is_halted()
43+
2944
# Move the VM to another host of the pool
3045
vm.migrate(dest_host, dest_sr)
3146
wait_for(lambda: vm.all_vdis_on_sr(dest_sr), "Wait for all VDIs on destination SR")
47+
3248
# Start VM to make sure it works
3349
vm.start(on=dest_host.uuid)
34-
vm.wait_for_os_booted()
50+
if vm.is_windows:
51+
vm.wait_for_os_booted()
52+
else:
53+
vm.wait_for_vm_running_and_ssh_up()
54+
logging.info("Validate /dev/xvdb")
55+
vm.ssh("randstream validate -v --expected-checksum 65280014 /dev/xvdb")
3556
vm.shutdown(verify=True)
57+
3658
# Migrate it back to the provenance SR
3759
vm.migrate(prov_host, prov_sr)
3860
wait_for(lambda: vm.all_vdis_on_sr(prov_sr), "Wait for all VDIs back on provenance SR")
61+
3962
# Start VM to make sure it works
4063
vm.start(on=prov_host.uuid)
41-
vm.wait_for_os_booted()
64+
if vm.is_windows:
65+
vm.wait_for_os_booted()
66+
else:
67+
vm.wait_for_vm_running_and_ssh_up()
68+
logging.info("Validate /dev/xvdb")
69+
vm.ssh("randstream validate -v --expected-checksum 65280014 /dev/xvdb")
4270
vm.shutdown(verify=True)
4371

4472
def live_storage_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Host, dest_sr: SR):

0 commit comments

Comments
 (0)