Skip to content

Commit c4d4a5c

Browse files
committed
storage: Avoid writing the whole device in cold migration tests
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent a391440 commit c4d4a5c

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

tests/storage/storage.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def cold_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Host, dest
5353
vdi_name = None
5454
integrity_check = not vm.is_windows
5555
dev = ""
56-
checksum = ""
56+
checksums = ('', '', '')
5757

5858
if integrity_check:
5959
# the vdi will be destroyed with the vm
@@ -64,10 +64,8 @@ def cold_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Host, dest
6464
vm.wait_for_vm_running_and_ssh_up()
6565
install_randstream(vm)
6666
dev = f'/dev/{vbd.param_get("device")}'
67-
logging.info(f"Generate {dev} content")
68-
checksum = randstream(vm, f'generate {dev}')
69-
logging.info(f"Validate {dev}")
70-
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
67+
checksums = partially_populate_device(vm, dev, config.volume_size)
68+
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
7169
vm.shutdown(verify=True)
7270

7371
assert vm.is_halted()
@@ -81,8 +79,7 @@ def cold_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Host, dest
8179
vm.wait_for_os_booted()
8280
if integrity_check:
8381
vm.wait_for_vm_running_and_ssh_up()
84-
logging.info(f"Validate {dev}")
85-
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
82+
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
8683
vm.shutdown(verify=True)
8784

8885
# Migrate it back to the provenance SR
@@ -94,8 +91,7 @@ def cold_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Host, dest
9491
vm.wait_for_os_booted()
9592
if integrity_check:
9693
vm.wait_for_vm_running_and_ssh_up()
97-
logging.info(f"Validate {dev}")
98-
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
94+
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
9995
vm.shutdown(verify=True)
10096

10197
if vdi_name is not None:

0 commit comments

Comments
 (0)