1313from lib .vm import VM
1414from 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 try_to_create_sr_with_missing_device ,
2730# Requirements:
2831# - one XCP-ng host with an additional unused disk for the SR
2932
33+
3034class TestEXTSRCreateDestroy :
3135 """
3236 Tests that do not use fixtures that setup the SR or import VMs,
@@ -52,6 +56,7 @@ def test_create_and_destroy_sr(self, host: Host,
5256 vm .destroy (verify = True )
5357 sr .destroy (verify = True )
5458
59+
5560@pytest .mark .usefixtures ("ext_sr" )
5661class TestEXTSR :
5762 @pytest .mark .quicktest
@@ -167,3 +172,59 @@ def test_reboot(self, host: Host, ext_sr: SR, vm_on_ext_sr: VM) -> None:
167172 vm .shutdown (verify = True )
168173
169174 # *** End of tests with reboots
175+
176+
177+ class TestEXTCBT (CBTTest ):
178+ """Test CBT functionality on EXT SR"""
179+
180+ @staticmethod
181+ def assert_cbt_log_exists (host : Host , sr : SR , vdi : VDI ) -> None :
182+ assert_cbt_log_exists_file_sr (host , sr , vdi )
183+
184+ @staticmethod
185+ def assert_cbt_log_does_not_exist (host : Host , sr : SR , vdi : VDI ) -> None :
186+ assert_cbt_log_does_not_exist_file_sr (host , sr , vdi )
187+
188+ def test_enable_disable_cbt (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
189+ self ._test_enable_disable_cbt (host , ext_sr , vdi_on_ext_sr )
190+
191+ def test_cbt_log_creation (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
192+ self ._test_cbt_log_creation (host , ext_sr , vdi_on_ext_sr )
193+
194+ def test_snapshot_with_cbt (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
195+ self ._test_snapshot_with_cbt (host , ext_sr , vdi_on_ext_sr )
196+
197+ @pytest .mark .small_vm
198+ def test_changed_blocks_tracking (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI , vm_on_ext_sr : VM ) -> None :
199+ self ._test_changed_blocks_tracking (host , ext_sr , vdi_on_ext_sr , vm_on_ext_sr )
200+
201+ @pytest .mark .small_vm
202+ def test_cbt_after_coalesce (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI , vm_on_ext_sr : VM ) -> None :
203+ self ._test_cbt_after_coalesce (host , ext_sr , vdi_on_ext_sr , vm_on_ext_sr )
204+
205+ @pytest .mark .small_vm
206+ def test_incremental_snap_scenario (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI , vm_on_ext_sr : VM ) -> None :
207+ self ._test_incremental_snap_scenario (host , ext_sr , vdi_on_ext_sr , vm_on_ext_sr )
208+
209+ def test_disable_cbt_removes_log (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
210+ self ._test_disable_cbt_removes_log (host , ext_sr , vdi_on_ext_sr )
211+
212+ def test_destroy_vdi_removes_cbt_log (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
213+ self ._test_destroy_vdi_removes_cbt_log (host , ext_sr , vdi_on_ext_sr )
214+
215+ def test_cbt_persist_after_sr_reboot (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
216+ self ._test_cbt_persist_after_sr_reboot (host , ext_sr , vdi_on_ext_sr )
217+
218+ def test_cbt_on_snapshot_chain (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
219+ self ._test_cbt_on_snapshot_chain (host , ext_sr , vdi_on_ext_sr )
220+
221+ def test_cbt_parent_disable_does_not_affect_snapshot (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
222+ self ._test_cbt_parent_disable_does_not_affect_snapshot (host , ext_sr , vdi_on_ext_sr )
223+
224+ @pytest .mark .small_vm
225+ def test_cbt_bitmap_non_zero_after_write (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ,
226+ vm_on_ext_sr : VM ) -> None :
227+ self ._test_cbt_bitmap_non_zero_after_write (host , ext_sr , vdi_on_ext_sr , vm_on_ext_sr )
228+
229+ def test_cbt_data_destroy (self , host : Host , ext_sr : SR , vdi_on_ext_sr : VDI ) -> None :
230+ self ._test_cbt_data_destroy (host , ext_sr , vdi_on_ext_sr )
0 commit comments