|
13 | 13 | from lib.vm import VM |
14 | 14 | from tests.storage import ( |
15 | 15 | MAX_VDI_SIZE, |
| 16 | + CBTTest, |
16 | 17 | CoalesceOperation, |
17 | 18 | ImageFormat, |
18 | 19 | XVACompression, |
| 20 | + assert_cbt_log_does_not_exist_file_sr, |
| 21 | + assert_cbt_log_exists_file_sr, |
19 | 22 | coalesce_integrity, |
20 | 23 | full_vdi_write, |
21 | 24 | vdi_export_import, |
|
29 | 32 | # - one XCP-ng host >= 8.2 with an additional unused disk for the SR |
30 | 33 | # - access to XCP-ng RPM repository from the host |
31 | 34 |
|
| 35 | + |
32 | 36 | @pytest.mark.usefixtures("sr_disk_wiped") |
33 | 37 | class TestZFSSRCreateDestroy: |
34 | 38 | """ |
@@ -66,6 +70,7 @@ def test_create_and_destroy_sr(self, host: Host, image_format: ImageFormat) -> N |
66 | 70 | vm.destroy(verify=True) |
67 | 71 | sr.destroy(verify=True) |
68 | 72 |
|
| 73 | + |
69 | 74 | @pytest.mark.usefixtures("zpool_vol0") |
70 | 75 | class TestZFSSR: |
71 | 76 | @pytest.mark.quicktest |
@@ -119,7 +124,7 @@ def test_invalid_vdi_size(self, zfs_sr: SR, image_format: ImageFormat): |
119 | 124 |
|
120 | 125 | @pytest.mark.small_vm |
121 | 126 | @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)\ |
123 | 128 | -> None: |
124 | 129 | xva_export_import(vm_on_zfs_sr, compression, temp_large_dir, defer) |
125 | 130 |
|
@@ -197,3 +202,59 @@ def test_zfs_unmounted(self, host: Host, zfs_sr: SR) -> None: |
197 | 202 | host.ssh(f'zpool import {POOL_NAME}') |
198 | 203 |
|
199 | 204 | # *** 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