Skip to content

Commit caadb1e

Browse files
committed
storage: test full device write
With most test now writing only a small amount of data to the devices, we need this new test to validate that we can write on the whole device. Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent 0985dab commit caadb1e

9 files changed

Lines changed: 47 additions & 0 deletions

File tree

tests/storage/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
XVACompression,
55
coalesce_integrity,
66
cold_migration_then_come_back,
7+
full_vdi_write,
78
install_randstream,
89
live_storage_migration_then_come_back,
910
randstream,

tests/storage/ext/test_ext_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ImageFormat,
1717
XVACompression,
1818
coalesce_integrity,
19+
full_vdi_write,
1920
try_to_create_sr_with_missing_device,
2021
vdi_export_import,
2122
vdi_is_open,
@@ -101,6 +102,10 @@ def test_vdi_export_import(self, storage_test_vm: VM, ext_sr: SR, image_format:
101102
defer: Defer) -> None:
102103
vdi_export_import(storage_test_vm, ext_sr, image_format, temp_large_dir, defer)
103104

105+
@pytest.mark.small_vm
106+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_ext_sr: VDI, defer: Defer):
107+
full_vdi_write(storage_test_vm, vdi_on_ext_sr, defer)
108+
104109
# *** tests with reboots (longer tests).
105110

106111
@pytest.mark.small_vm

tests/storage/lvm/test_lvm_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ImageFormat,
1717
XVACompression,
1818
coalesce_integrity,
19+
full_vdi_write,
1920
try_to_create_sr_with_missing_device,
2021
vdi_export_import,
2122
vdi_is_open,
@@ -147,6 +148,10 @@ def test_failing_resize_on_inflate_after_setSizePhys(
147148
def test_coalesce(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, vdi_op: CoalesceOperation, defer: Defer) -> None:
148149
coalesce_integrity(storage_test_vm, vdi_on_lvm_sr, vdi_op, defer)
149150

151+
@pytest.mark.small_vm
152+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, defer: Defer):
153+
full_vdi_write(storage_test_vm, vdi_on_lvm_sr, defer)
154+
150155
@pytest.mark.small_vm
151156
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
152157
def test_xva_export_import(self, vm_on_lvm_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer) \

tests/storage/lvmoiscsi/test_lvmoiscsi_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
ImageFormat,
1111
XVACompression,
1212
coalesce_integrity,
13+
full_vdi_write,
1314
vdi_export_import,
1415
vdi_is_open,
1516
xva_export_import,
@@ -73,6 +74,10 @@ def test_coalesce(self, storage_test_vm: 'VM', vdi_on_lvmoiscsi_sr: 'VDI', vdi_o
7374
defer: Defer) -> None:
7475
coalesce_integrity(storage_test_vm, vdi_on_lvmoiscsi_sr, vdi_op, defer)
7576

77+
@pytest.mark.small_vm
78+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_lvmoiscsi_sr: VDI, defer: Defer):
79+
full_vdi_write(storage_test_vm, vdi_on_lvmoiscsi_sr, defer)
80+
7681
@pytest.mark.small_vm
7782
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
7883
def test_xva_export_import(self, vm_on_lvmoiscsi_sr: VM, compression: XVACompression, temp_large_dir: str,

tests/storage/nfs/test_nfs_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
ImageFormat,
1414
XVACompression,
1515
coalesce_integrity,
16+
full_vdi_write,
1617
vdi_export_import,
1718
vdi_is_open,
1819
xva_export_import,
@@ -119,6 +120,10 @@ def test_snapshot(self, dispatch_nfs: VM) -> None:
119120
def test_coalesce(self, storage_test_vm: VM, dispatch_nfs: VDI, vdi_op: CoalesceOperation, defer: Defer) -> None:
120121
coalesce_integrity(storage_test_vm, dispatch_nfs, vdi_op, defer)
121122

123+
@pytest.mark.small_vm
124+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_nfs_sr: VDI, defer: Defer):
125+
full_vdi_write(storage_test_vm, vdi_on_nfs_sr, defer)
126+
122127
@pytest.mark.small_vm
123128
# Make sure this fixture is called before the parametrized one
124129
@pytest.mark.usefixtures('vm_ref')

tests/storage/storage.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,14 @@ def vdi_export_import(vm: VM, sr: SR, image_format: ImageFormat, temp_large_dir:
335335
dev = f'/dev/{vbd.param_get("device")}'
336336

337337
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
338+
339+
def full_vdi_write(vm: VM, vdi: VDI, defer: Defer):
340+
vdi.get_virtual_size()
341+
vbd = vm.connect_vdi(vdi)
342+
defer(lambda: vm.disconnect_vdi(vdi))
343+
344+
dev = f'/dev/{vbd.param_get("device")}'
345+
install_randstream(vm)
346+
347+
checksum = randstream(vm, f'generate {dev}')
348+
randstream(vm, f'validate --expected-checksum {checksum} {dev}')

tests/storage/xfs/test_xfs_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ImageFormat,
1717
XVACompression,
1818
coalesce_integrity,
19+
full_vdi_write,
1920
vdi_export_import,
2021
vdi_is_open,
2122
xva_export_import,
@@ -107,6 +108,10 @@ def test_snapshot(self, vm_on_xfs_sr: VM) -> None:
107108
def test_coalesce(self, storage_test_vm: VM, vdi_on_xfs_sr: VDI, vdi_op: CoalesceOperation, defer: Defer) -> None:
108109
coalesce_integrity(storage_test_vm, vdi_on_xfs_sr, vdi_op, defer)
109110

111+
@pytest.mark.small_vm
112+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_xfs_sr: VDI, defer: Defer):
113+
full_vdi_write(storage_test_vm, vdi_on_xfs_sr, defer)
114+
110115
@pytest.mark.small_vm
111116
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
112117
def test_xva_export_import(self, vm_on_xfs_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer) \

tests/storage/zfs/test_zfs_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ImageFormat,
1717
XVACompression,
1818
coalesce_integrity,
19+
full_vdi_write,
1920
vdi_export_import,
2021
vdi_is_open,
2122
xva_export_import,
@@ -104,6 +105,10 @@ def test_snapshot(self, vm_on_zfs_sr: VM) -> None:
104105
def test_coalesce(self, storage_test_vm: VM, vdi_on_zfs_sr: VDI, vdi_op: CoalesceOperation, defer: Defer) -> None:
105106
coalesce_integrity(storage_test_vm, vdi_on_zfs_sr, vdi_op, defer)
106107

108+
@pytest.mark.small_vm
109+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_zfs_sr: VDI, defer: Defer):
110+
full_vdi_write(storage_test_vm, vdi_on_zfs_sr, defer)
111+
107112
@pytest.mark.small_vm
108113
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
109114
def test_xva_export_import(self, vm_on_zfs_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer) \

tests/storage/zfsvol/test_zfsvol_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ImageFormat,
1616
XVACompression,
1717
coalesce_integrity,
18+
full_vdi_write,
1819
vdi_export_import,
1920
xva_export_import,
2021
)
@@ -78,6 +79,10 @@ def test_coalesce(self, storage_test_vm: VM, vdi_on_zfsvol_sr: VDI, vdi_op: Coal
7879
-> None:
7980
coalesce_integrity(storage_test_vm, vdi_on_zfsvol_sr, vdi_op, defer)
8081

82+
@pytest.mark.small_vm
83+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_zfsvol_sr: VDI, defer: Defer):
84+
full_vdi_write(storage_test_vm, vdi_on_zfsvol_sr, defer)
85+
8186
@pytest.mark.small_vm
8287
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
8388
def test_xva_export_import(self, vm_on_zfsvol_sr: VM, compression: XVACompression, temp_large_dir: str,

0 commit comments

Comments
 (0)