|
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, |
@@ -82,7 +85,7 @@ def test_invalid_vdi_size(self, zfs_sr: SR, image_format: ImageFormat): |
82 | 85 |
|
83 | 86 | @pytest.mark.small_vm |
84 | 87 | @pytest.mark.parametrize("compression", ["none", "gzip", "zstd"]) |
85 | | - def test_xva_export_import(self, vm_on_zfs_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer) \ |
| 88 | + def test_xva_export_import(self, vm_on_zfs_sr: VM, compression: XVACompression, temp_large_dir: str, defer: Defer)\ |
86 | 89 | -> None: |
87 | 90 | xva_export_import(vm_on_zfs_sr, compression, temp_large_dir, defer) |
88 | 91 |
|
@@ -160,3 +163,59 @@ def test_zfs_unmounted(self, host: Host, zfs_sr: SR) -> None: |
160 | 163 | host.ssh(f'zpool import {POOL_NAME}') |
161 | 164 |
|
162 | 165 | # *** End of tests with reboots |
| 166 | + |
| 167 | + |
| 168 | +class TestZFSCBT(CBTTest): |
| 169 | + """Test CBT functionality on ZFS SR""" |
| 170 | + |
| 171 | + @staticmethod |
| 172 | + def assert_cbt_log_exists(host: Host, sr: SR, vdi: VDI) -> None: |
| 173 | + assert_cbt_log_exists_file_sr(host, sr, vdi) |
| 174 | + |
| 175 | + @staticmethod |
| 176 | + def assert_cbt_log_does_not_exist(host: Host, sr: SR, vdi: VDI) -> None: |
| 177 | + assert_cbt_log_does_not_exist_file_sr(host, sr, vdi) |
| 178 | + |
| 179 | + def test_enable_disable_cbt(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 180 | + self._test_enable_disable_cbt(host, zfs_sr, vdi_on_zfs_sr) |
| 181 | + |
| 182 | + def test_cbt_log_creation(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 183 | + self._test_cbt_log_creation(host, zfs_sr, vdi_on_zfs_sr) |
| 184 | + |
| 185 | + def test_snapshot_with_cbt(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 186 | + self._test_snapshot_with_cbt(host, zfs_sr, vdi_on_zfs_sr) |
| 187 | + |
| 188 | + @pytest.mark.small_vm |
| 189 | + def test_changed_blocks_tracking(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, vm_on_zfs_sr: VM) -> None: |
| 190 | + self._test_changed_blocks_tracking(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr) |
| 191 | + |
| 192 | + @pytest.mark.small_vm |
| 193 | + def test_cbt_after_coalesce(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, vm_on_zfs_sr: VM) -> None: |
| 194 | + self._test_cbt_after_coalesce(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr) |
| 195 | + |
| 196 | + @pytest.mark.small_vm |
| 197 | + def test_incremental_snap_scenario(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, vm_on_zfs_sr: VM) -> None: |
| 198 | + self._test_incremental_snap_scenario(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr) |
| 199 | + |
| 200 | + def test_disable_cbt_removes_log(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 201 | + self._test_disable_cbt_removes_log(host, zfs_sr, vdi_on_zfs_sr) |
| 202 | + |
| 203 | + def test_destroy_vdi_removes_cbt_log(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 204 | + self._test_destroy_vdi_removes_cbt_log(host, zfs_sr, vdi_on_zfs_sr) |
| 205 | + |
| 206 | + def test_cbt_persist_after_sr_reboot(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 207 | + self._test_cbt_persist_after_sr_reboot(host, zfs_sr, vdi_on_zfs_sr) |
| 208 | + |
| 209 | + def test_cbt_on_snapshot_chain(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 210 | + self._test_cbt_on_snapshot_chain(host, zfs_sr, vdi_on_zfs_sr) |
| 211 | + |
| 212 | + def test_cbt_parent_disable_does_not_affect_snapshot(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 213 | + self._test_cbt_parent_disable_does_not_affect_snapshot(host, zfs_sr, vdi_on_zfs_sr) |
| 214 | + |
| 215 | + @pytest.mark.small_vm |
| 216 | + def test_cbt_bitmap_non_zero_after_write(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI, |
| 217 | + vm_on_zfs_sr: VM) -> None: |
| 218 | + self._test_cbt_bitmap_non_zero_after_write(host, zfs_sr, vdi_on_zfs_sr, vm_on_zfs_sr) |
| 219 | + |
| 220 | + def test_cbt_data_destroy(self, host: Host, zfs_sr: SR, vdi_on_zfs_sr: VDI) -> None: |
| 221 | + self._test_cbt_data_destroy(host, zfs_sr, vdi_on_zfs_sr) |
0 commit comments