Skip to content

Commit a4ee596

Browse files
committed
storage: optimize live migration tests to avoid full device writes
Use partial device population in live migration tests to speed up testing while maintaining integrity verification across multiple migrations. Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent 9f77f46 commit a4ee596

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
@@ -102,7 +102,7 @@ def live_storage_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Ho
102102
vdi_name: str | None = None
103103
integrity_check = not vm.is_windows
104104
dev = ""
105-
checksum = ""
105+
checksums = ('', '', '')
106106
vbd = None
107107

108108
if integrity_check:
@@ -118,26 +118,22 @@ def live_storage_migration_then_come_back(vm: VM, prov_host: Host, dest_host: Ho
118118
install_randstream(vm)
119119
assert vbd is not None
120120
dev = f'/dev/{vbd.param_get("device")}'
121-
logging.info(f"Generate {dev} content")
122-
randstream(vm, f'generate {dev}')
123-
logging.info(f"Validate {dev}")
124-
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
121+
checksums = partially_populate_device(vm, dev, config.volume_size)
122+
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
125123

126124
# Move the VM to another host of the pool
127125
vm.migrate(dest_host, dest_sr)
128126
wait_for(lambda: vm.all_vdis_on_sr(dest_sr), "Wait for all VDIs on destination SR")
129127
wait_for(lambda: vm.is_running_on_host(dest_host), "Wait for VM to be running on destination host")
130128
if integrity_check:
131-
logging.info(f"Validate {dev}")
132-
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
129+
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
133130

134131
# Migrate it back to the provenance SR
135132
vm.migrate(prov_host, prov_sr)
136133
wait_for(lambda: vm.all_vdis_on_sr(prov_sr), "Wait for all VDIs back on provenance SR")
137134
wait_for(lambda: vm.is_running_on_host(prov_host), "Wait for VM to be running on provenance host")
138135
if integrity_check:
139-
logging.info(f"Validate {dev}")
140-
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
136+
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
141137

142138
vm.shutdown(verify=True)
143139

0 commit comments

Comments
 (0)