Skip to content

Commit 71b7668

Browse files
committed
implement cbt_tests on ZFSsr
Signed-off-by: Goulven Riou <goulven.riou@vates.tech>
1 parent ee64129 commit 71b7668

1 file changed

Lines changed: 62 additions & 1 deletion

File tree

tests/storage/zfs/test_zfs_sr.py

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
from lib.vm import VM
1414
from tests.storage import (
1515
MAX_VDI_SIZE,
16+
CBTTest,
1617
CoalesceOperation,
1718
ImageFormat,
1819
XVACompression,
20+
assert_cbt_log_does_not_exist_file_sr,
21+
assert_cbt_log_exists_file_sr,
1922
coalesce_integrity,
2023
full_vdi_write,
2124
vdi_export_import,
@@ -29,6 +32,7 @@
2932
# - one XCP-ng host >= 8.2 with an additional unused disk for the SR
3033
# - access to XCP-ng RPM repository from the host
3134

35+
3236
@pytest.mark.usefixtures("sr_disk_wiped")
3337
class TestZFSSRCreateDestroy:
3438
"""
@@ -66,6 +70,7 @@ def test_create_and_destroy_sr(self, host: Host, image_format: ImageFormat) -> N
6670
vm.destroy(verify=True)
6771
sr.destroy(verify=True)
6872

73+
6974
@pytest.mark.usefixtures("zpool_vol0")
7075
class TestZFSSR:
7176
@pytest.mark.quicktest
@@ -119,7 +124,7 @@ def test_invalid_vdi_size(self, zfs_sr: SR, image_format: ImageFormat):
119124

120125
@pytest.mark.small_vm
121126
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
122-
def test_xva_export_import(self, vm_on_zfs_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer) \
127+
def test_xva_export_import(self, vm_on_zfs_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer)\
123128
-> None:
124129
xva_export_import(vm_on_zfs_sr, compression, temp_large_dir, defer)
125130

@@ -197,3 +202,59 @@ def test_zfs_unmounted(self, host: Host, zfs_sr: SR) -> None:
197202
host.ssh(f'zpool import {POOL_NAME}')
198203

199204
# *** End of tests with reboots
205+
206+
207+
class TestZFSCBT(CBTTest):
208+
"""Test CBT functionality on ZFS SR"""
209+
210+
@staticmethod
211+
def assert_cbt_log_exists(host: Host, sr: SR, vdi: VDI) -> None:
212+
assert_cbt_log_exists_file_sr(host, sr, vdi)
213+
214+
@staticmethod
215+
def assert_cbt_log_does_not_exist(host: Host, sr: SR, vdi: VDI) -> None:
216+
assert_cbt_log_does_not_exist_file_sr(host, sr, vdi)
217+
218+
def test_enable_disable_cbt(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
219+
self._test_enable_disable_cbt(host, zfs_sr, vdi_on_zfs_sr)
220+
221+
def test_cbt_log_creation(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
222+
self._test_cbt_log_creation(host, zfs_sr, vdi_on_zfs_sr)
223+
224+
def test_snapshot_with_cbt(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
225+
self._test_snapshot_with_cbt(host, zfs_sr, vdi_on_zfs_sr)
226+
227+
@pytest.mark.small_vm
228+
def test_changed_blocks_tracking(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, vm_on_zfs_sr: VM) -> None:
229+
self._test_changed_blocks_tracking(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr)
230+
231+
@pytest.mark.small_vm
232+
def test_cbt_after_coalesce(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, vm_on_zfs_sr: VM) -> None:
233+
self._test_cbt_after_coalesce(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr)
234+
235+
@pytest.mark.small_vm
236+
def test_incremental_snap_scenario(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, vm_on_zfs_sr: VM) -> None:
237+
self._test_incremental_snap_scenario(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr)
238+
239+
def test_disable_cbt_removes_log(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
240+
self._test_disable_cbt_removes_log(host, zfs_sr, vdi_on_zfs_sr)
241+
242+
def test_destroy_vdi_removes_cbt_log(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
243+
self._test_destroy_vdi_removes_cbt_log(host, zfs_sr, vdi_on_zfs_sr)
244+
245+
def test_cbt_persist_after_sr_reboot(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
246+
self._test_cbt_persist_after_sr_reboot(host, zfs_sr, vdi_on_zfs_sr)
247+
248+
def test_cbt_on_snapshot_chain(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
249+
self._test_cbt_on_snapshot_chain(host, zfs_sr, vdi_on_zfs_sr)
250+
251+
def test_cbt_parent_disable_does_not_affect_snapshot(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
252+
self._test_cbt_parent_disable_does_not_affect_snapshot(host, zfs_sr, vdi_on_zfs_sr)
253+
254+
@pytest.mark.small_vm
255+
def test_cbt_bitmap_non_zero_after_write(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI,
256+
vm_on_zfs_sr: VM) -> None:
257+
self._test_cbt_bitmap_non_zero_after_write(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr)
258+
259+
def test_cbt_data_destroy(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None:
260+
self._test_cbt_data_destroy(host, zfs_sr, vdi_on_zfs_sr)

0 commit comments

Comments
 (0)