Skip to content

Commit 292569b

Browse files
committed
implement cbt tests on XFSSR
Signed-off-by: Goulven Riou <goulven.riou@vates.tech>
1 parent f7fad45 commit 292569b

2 files changed

Lines changed: 123 additions & 0 deletions

File tree

tests/storage/nfs/test_nfs_sr.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
from lib.vm import VM
1212
from tests.storage import (
1313
MAX_VDI_SIZE,
14+
CBTTest,
1415
CoalesceOperation,
1516
ImageFormat,
1617
XVACompression,
18+
assert_cbt_log_does_not_exist_file_sr,
19+
assert_cbt_log_exists_file_sr,
1720
coalesce_integrity,
1821
full_vdi_write,
1922
vdi_export_import,
@@ -24,6 +27,7 @@
2427
# Requirements:
2528
# - one XCP-ng host >= 8.0 with an additional unused disk for the SR
2629

30+
2731
class TestNFSSRCreateDestroy:
2832
@pytest.mark.parametrize('dispatch_nfs', ['nfs_device_config', 'nfs4_device_config'], indirect=True)
2933
def test_create_and_destroy_sr(self, host: Host, dispatch_nfs: dict[str, str]) -> None:
@@ -37,6 +41,8 @@ def test_create_and_destroy_sr(self, host: Host, dispatch_nfs: dict[str, str]) -
3741
sr.destroy(verify=True)
3842

3943
# Make sure this fixture is called before the parametrized one
44+
45+
4046
@pytest.mark.usefixtures('image_format')
4147
class TestNFSSR:
4248
@pytest.mark.quicktest
@@ -172,3 +178,59 @@ def test_reboot(self, host: Host, dispatch_nfs: VM) -> None:
172178
vm.shutdown(verify=True)
173179

174180
# *** End of tests with reboots
181+
182+
183+
class TestNFSCBT(CBTTest):
184+
"""Test CBT functionality on NFS SR"""
185+
186+
@staticmethod
187+
def assert_cbt_log_exists(host: Host, sr: SR, vdi: VDI) -> None:
188+
assert_cbt_log_exists_file_sr(host, sr, vdi)
189+
190+
@staticmethod
191+
def assert_cbt_log_does_not_exist(host: Host, sr: SR, vdi: VDI) -> None:
192+
assert_cbt_log_does_not_exist_file_sr(host, sr, vdi)
193+
194+
def test_enable_disable_cbt(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
195+
self._test_enable_disable_cbt(host, nfs_sr, vdi_on_nfs_sr)
196+
197+
def test_cbt_log_creation(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
198+
self._test_cbt_log_creation(host, nfs_sr, vdi_on_nfs_sr)
199+
200+
def test_snapshot_with_cbt(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
201+
self._test_snapshot_with_cbt(host, nfs_sr, vdi_on_nfs_sr)
202+
203+
@pytest.mark.small_vm
204+
def test_changed_blocks_tracking(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI, vm_on_nfs_sr: VM) -> None:
205+
self._test_changed_blocks_tracking(host, nfs_sr, vdi_on_nfs_sr, vm_on_nfs_sr)
206+
207+
@pytest.mark.small_vm
208+
def test_cbt_after_coalesce(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI, vm_on_nfs_sr: VM) -> None:
209+
self._test_cbt_after_coalesce(host, nfs_sr, vdi_on_nfs_sr, vm_on_nfs_sr)
210+
211+
@pytest.mark.small_vm
212+
def test_incremental_snap_scenario(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI, vm_on_nfs_sr: VM) -> None:
213+
self._test_incremental_snap_scenario(host, nfs_sr, vdi_on_nfs_sr, vm_on_nfs_sr)
214+
215+
def test_disable_cbt_removes_log(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
216+
self._test_disable_cbt_removes_log(host, nfs_sr, vdi_on_nfs_sr)
217+
218+
def test_destroy_vdi_removes_cbt_log(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
219+
self._test_destroy_vdi_removes_cbt_log(host, nfs_sr, vdi_on_nfs_sr)
220+
221+
def test_cbt_persist_after_sr_reboot(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
222+
self._test_cbt_persist_after_sr_reboot(host, nfs_sr, vdi_on_nfs_sr)
223+
224+
def test_cbt_on_snapshot_chain(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
225+
self._test_cbt_on_snapshot_chain(host, nfs_sr, vdi_on_nfs_sr)
226+
227+
def test_cbt_parent_disable_does_not_affect_snapshot(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
228+
self._test_cbt_parent_disable_does_not_affect_snapshot(host, nfs_sr, vdi_on_nfs_sr)
229+
230+
@pytest.mark.small_vm
231+
def test_cbt_bitmap_non_zero_after_write(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI,
232+
vm_on_nfs_sr: VM) -> None:
233+
self._test_cbt_bitmap_non_zero_after_write(host, nfs_sr, vdi_on_nfs_sr, vm_on_nfs_sr)
234+
235+
def test_cbt_data_destroy(self, host: Host, nfs_sr: SR, vdi_on_nfs_sr: VDI) -> None:
236+
self._test_cbt_data_destroy(host, nfs_sr, vdi_on_nfs_sr)

tests/storage/xfs/test_xfs_sr.py

Lines changed: 61 additions & 0 deletions
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,
@@ -27,6 +30,7 @@
2730
# - one XCP-ng host >= 8.2 with an additional unused disk for the SR
2831
# - access to XCP-ng RPM repository from the host
2932

33+
3034
class TestXFSSRCreateDestroy:
3135
"""
3236
Tests that do not use fixtures that setup the SR or import VMs,
@@ -69,6 +73,7 @@ def test_create_and_destroy_sr(self,
6973
vm.destroy(verify=True)
7074
sr.destroy(verify=True)
7175

76+
7277
@pytest.mark.usefixtures("xfs_sr")
7378
class TestXFSSR:
7479
@pytest.mark.quicktest
@@ -171,3 +176,59 @@ def test_xfsprogs_missing(self, host: Host, xfs_sr: SR) -> None:
171176
host.yum_install(['xfsprogs'])
172177

173178
# *** End of tests with reboots
179+
180+
181+
class TestXFSCBT(CBTTest):
182+
"""Test CBT functionality on XFS SR"""
183+
184+
@staticmethod
185+
def assert_cbt_log_exists(host: Host, sr: SR, vdi: VDI) -> None:
186+
assert_cbt_log_exists_file_sr(host, sr, vdi)
187+
188+
@staticmethod
189+
def assert_cbt_log_does_not_exist(host: Host, sr: SR, vdi: VDI) -> None:
190+
assert_cbt_log_does_not_exist_file_sr(host, sr, vdi)
191+
192+
def test_enable_disable_cbt(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
193+
self._test_enable_disable_cbt(host, xfs_sr, vdi_on_xfs_sr)
194+
195+
def test_cbt_log_creation(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
196+
self._test_cbt_log_creation(host, xfs_sr, vdi_on_xfs_sr)
197+
198+
def test_snapshot_with_cbt(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
199+
self._test_snapshot_with_cbt(host, xfs_sr, vdi_on_xfs_sr)
200+
201+
@pytest.mark.small_vm
202+
def test_changed_blocks_tracking(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI, vm_on_xfs_sr: VM) -> None:
203+
self._test_changed_blocks_tracking(host, xfs_sr, vdi_on_xfs_sr, vm_on_xfs_sr)
204+
205+
@pytest.mark.small_vm
206+
def test_cbt_after_coalesce(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI, vm_on_xfs_sr: VM) -> None:
207+
self._test_cbt_after_coalesce(host, xfs_sr, vdi_on_xfs_sr, vm_on_xfs_sr)
208+
209+
@pytest.mark.small_vm
210+
def test_incremental_snap_scenario(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI, vm_on_xfs_sr: VM) -> None:
211+
self._test_incremental_snap_scenario(host, xfs_sr, vdi_on_xfs_sr, vm_on_xfs_sr)
212+
213+
def test_disable_cbt_removes_log(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
214+
self._test_disable_cbt_removes_log(host, xfs_sr, vdi_on_xfs_sr)
215+
216+
def test_destroy_vdi_removes_cbt_log(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
217+
self._test_destroy_vdi_removes_cbt_log(host, xfs_sr, vdi_on_xfs_sr)
218+
219+
def test_cbt_persist_after_sr_reboot(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
220+
self._test_cbt_persist_after_sr_reboot(host, xfs_sr, vdi_on_xfs_sr)
221+
222+
def test_cbt_on_snapshot_chain(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
223+
self._test_cbt_on_snapshot_chain(host, xfs_sr, vdi_on_xfs_sr)
224+
225+
def test_cbt_parent_disable_does_not_affect_snapshot(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
226+
self._test_cbt_parent_disable_does_not_affect_snapshot(host, xfs_sr, vdi_on_xfs_sr)
227+
228+
@pytest.mark.small_vm
229+
def test_cbt_bitmap_non_zero_after_write(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI,
230+
vm_on_xfs_sr: VM) -> None:
231+
self._test_cbt_bitmap_non_zero_after_write(host, xfs_sr, vdi_on_xfs_sr, vm_on_xfs_sr)
232+
233+
def test_cbt_data_destroy(self, host: Host, xfs_sr: SR, vdi_on_xfs_sr: VDI) -> None:
234+
self._test_cbt_data_destroy(host, xfs_sr, vdi_on_xfs_sr)

0 commit comments

Comments
 (0)