Skip to content

Commit d73f62d

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

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,
@@ -103,6 +104,10 @@ def test_vdi_export_import(
103104
):
104105
vdi_export_import(storage_test_vm, ext_sr, image_format, temp_large_dir, defer)
105106

107+
@pytest.mark.small_vm
108+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_ext_sr: VDI, defer: Defer):
109+
full_vdi_write(storage_test_vm, vdi_on_ext_sr, defer)
110+
106111
# *** tests with reboots (longer tests).
107112

108113
@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,
@@ -145,6 +146,10 @@ def test_coalesce(
145146
):
146147
coalesce_integrity(storage_test_vm, vdi_on_lvm_sr, vdi_op, defer)
147148

149+
@pytest.mark.small_vm
150+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, defer: Defer):
151+
full_vdi_write(storage_test_vm, vdi_on_lvm_sr, defer)
152+
148153
@pytest.mark.small_vm
149154
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
150155
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
@@ -9,6 +9,7 @@
99
ImageFormat,
1010
XVACompression,
1111
coalesce_integrity,
12+
full_vdi_write,
1213
vdi_export_import,
1314
vdi_is_open,
1415
xva_export_import,
@@ -73,6 +74,10 @@ def test_coalesce(
7374
):
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(

tests/storage/nfs/test_nfs_sr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
ImageFormat,
1313
XVACompression,
1414
coalesce_integrity,
15+
full_vdi_write,
1516
vdi_export_import,
1617
vdi_is_open,
1718
xva_export_import,
@@ -120,6 +121,10 @@ def test_coalesce(
120121
):
121122
coalesce_integrity(storage_test_vm, dispatch_nfs, vdi_op, defer)
122123

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

tests/storage/storage.py

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

332332
validate_partially_populated_device(vm, dev, config.volume_size, checksums)
333+
334+
def full_vdi_write(vm: VM, vdi: VDI, defer: Defer):
335+
vdi.get_virtual_size()
336+
vbd = vm.connect_vdi(vdi)
337+
defer(lambda: vm.disconnect_vdi(vdi))
338+
339+
dev = f'/dev/{vbd.param_get("device")}'
340+
install_randstream(vm)
341+
342+
checksum = randstream(vm, f'generate {dev}')
343+
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,
@@ -109,6 +110,10 @@ def test_coalesce(
109110
):
110111
coalesce_integrity(storage_test_vm, vdi_on_xfs_sr, vdi_op, defer)
111112

113+
@pytest.mark.small_vm
114+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_xfs_sr: VDI, defer: Defer):
115+
full_vdi_write(storage_test_vm, vdi_on_xfs_sr, defer)
116+
112117
@pytest.mark.small_vm
113118
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
114119
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
@@ -15,6 +15,7 @@
1515
ImageFormat,
1616
XVACompression,
1717
coalesce_integrity,
18+
full_vdi_write,
1819
vdi_export_import,
1920
vdi_is_open,
2021
xva_export_import,
@@ -111,6 +112,10 @@ def test_coalesce(
111112
):
112113
coalesce_integrity(storage_test_vm, vdi_on_zfs_sr, vdi_op, defer)
113114

115+
@pytest.mark.small_vm
116+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_zfs_sr: VDI, defer: Defer):
117+
full_vdi_write(storage_test_vm, vdi_on_zfs_sr, defer)
118+
114119
@pytest.mark.small_vm
115120
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
116121
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(
7879
):
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(

0 commit comments

Comments
 (0)