Skip to content

Commit aad99de

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 1fc6ec3 commit aad99de

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,
@@ -100,6 +101,10 @@ def test_vdi_export_import(self, storage_test_vm: VM, ext_sr: SR, image_format:
100101
defer: Defer):
101102
vdi_export_import(storage_test_vm, ext_sr, image_format, temp_large_dir, defer)
102103

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

105110
@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,
@@ -143,6 +144,10 @@ def test_failing_resize_on_inflate_after_setSizePhys(self, host, lvm_sr, vm_on_l
143144
def test_coalesce(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, vdi_op: CoalesceOperation, defer: Defer):
144145
coalesce_integrity(storage_test_vm, vdi_on_lvm_sr, vdi_op, defer)
145146

147+
@pytest.mark.small_vm
148+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, defer: Defer):
149+
full_vdi_write(storage_test_vm, vdi_on_lvm_sr, defer)
150+
146151
@pytest.mark.small_vm
147152
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
148153
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,
@@ -67,6 +68,10 @@ def test_snapshot(self, vm_on_lvmoiscsi_sr):
6768
def test_coalesce(self, storage_test_vm: 'VM', vdi_on_lvmoiscsi_sr: 'VDI', vdi_op: CoalesceOperation, defer: Defer):
6869
coalesce_integrity(storage_test_vm, vdi_on_lvmoiscsi_sr, vdi_op, defer)
6970

71+
@pytest.mark.small_vm
72+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_lvmoiscsi_sr: VDI, defer: Defer):
73+
full_vdi_write(storage_test_vm, vdi_on_lvmoiscsi_sr, defer)
74+
7075
@pytest.mark.small_vm
7176
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
7277
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
@@ -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,
@@ -118,6 +119,10 @@ def test_snapshot(self, dispatch_nfs):
118119
def test_coalesce(self, storage_test_vm: VM, dispatch_nfs: VDI, vdi_op: CoalesceOperation, defer: Defer):
119120
coalesce_integrity(storage_test_vm, dispatch_nfs, vdi_op, defer)
120121

122+
@pytest.mark.small_vm
123+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_nfs_sr: VDI, defer: Defer):
124+
full_vdi_write(storage_test_vm, vdi_on_nfs_sr, defer)
125+
121126
@pytest.mark.small_vm
122127
# Make sure this fixture is called before the parametrized one
123128
@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,
@@ -109,6 +110,10 @@ def test_snapshot(self, vm_on_zfs_sr):
109110
def test_coalesce(self, storage_test_vm: VM, vdi_on_zfs_sr: VDI, vdi_op: CoalesceOperation, defer: Defer):
110111
coalesce_integrity(storage_test_vm, vdi_on_zfs_sr, vdi_op, defer)
111112

113+
@pytest.mark.small_vm
114+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_zfs_sr: VDI, defer: Defer):
115+
full_vdi_write(storage_test_vm, vdi_on_zfs_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_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
)
@@ -76,6 +77,10 @@ def test_snapshot(self, vm_on_zfsvol_sr):
7677
def test_coalesce(self, storage_test_vm: VM, vdi_on_zfsvol_sr: VDI, vdi_op: CoalesceOperation, defer: Defer):
7778
coalesce_integrity(storage_test_vm, vdi_on_zfsvol_sr, vdi_op, defer)
7879

80+
@pytest.mark.small_vm
81+
def test_full_vdi_write(self, storage_test_vm: VM, vdi_on_zfsvol_sr: VDI, defer: Defer):
82+
full_vdi_write(storage_test_vm, vdi_on_zfsvol_sr, defer)
83+
7984
@pytest.mark.small_vm
8085
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
8186
def test_xva_export_import(

0 commit comments

Comments
 (0)