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_lvm_sr ,
21+ assert_cbt_log_exists_lvm_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 TestLVMSRCreateDestroy :
3135 """
3236 Tests that do not use fixtures that setup the SR or import VMs,
@@ -53,6 +57,7 @@ def test_create_and_destroy_sr(self, host: Host,
5357 vm .destroy (verify = True )
5458 sr .destroy (verify = True )
5559
60+
5661@pytest .mark .usefixtures ("lvm_sr" )
5762@pytest .mark .thick_provisioned
5863class TestLVMSR :
@@ -187,3 +192,59 @@ def test_reboot(self, host: Host, lvm_sr: SR, vm_on_lvm_sr: VM) -> None:
187192 vm .shutdown (verify = True )
188193
189194 # *** End of tests with reboots
195+
196+
197+ class TestLVMCBT (CBTTest ):
198+ """Test CBT functionality on LVM SR"""
199+
200+ @staticmethod
201+ def assert_cbt_log_exists (host : Host , sr : SR , vdi : VDI ) -> None :
202+ assert_cbt_log_exists_lvm_sr (host , sr , vdi )
203+
204+ @staticmethod
205+ def assert_cbt_log_does_not_exist (host : Host , sr : SR , vdi : VDI ) -> None :
206+ assert_cbt_log_does_not_exist_lvm_sr (host , sr , vdi )
207+
208+ def test_enable_disable_cbt (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
209+ self ._test_enable_disable_cbt (host , lvm_sr , vdi_on_lvm_sr )
210+
211+ def test_cbt_log_creation (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
212+ self ._test_cbt_log_creation (host , lvm_sr , vdi_on_lvm_sr )
213+
214+ def test_snapshot_with_cbt (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
215+ self ._test_snapshot_with_cbt (host , lvm_sr , vdi_on_lvm_sr )
216+
217+ @pytest .mark .small_vm
218+ def test_changed_blocks_tracking (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI , vm_on_lvm_sr : VM ) -> None :
219+ self ._test_changed_blocks_tracking (host , lvm_sr , vdi_on_lvm_sr , vm_on_lvm_sr )
220+
221+ @pytest .mark .small_vm
222+ def test_cbt_after_coalesce (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI , vm_on_lvm_sr : VM ) -> None :
223+ self ._test_cbt_after_coalesce (host , lvm_sr , vdi_on_lvm_sr , vm_on_lvm_sr )
224+
225+ @pytest .mark .small_vm
226+ def test_incremental_snap_scenario (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI , vm_on_lvm_sr : VM ) -> None :
227+ self ._test_incremental_snap_scenario (host , lvm_sr , vdi_on_lvm_sr , vm_on_lvm_sr )
228+
229+ def test_disable_cbt_removes_log (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
230+ self ._test_disable_cbt_removes_log (host , lvm_sr , vdi_on_lvm_sr )
231+
232+ def test_destroy_vdi_removes_cbt_log (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
233+ self ._test_destroy_vdi_removes_cbt_log (host , lvm_sr , vdi_on_lvm_sr )
234+
235+ def test_cbt_persist_after_sr_reboot (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
236+ self ._test_cbt_persist_after_sr_reboot (host , lvm_sr , vdi_on_lvm_sr )
237+
238+ def test_cbt_on_snapshot_chain (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
239+ self ._test_cbt_on_snapshot_chain (host , lvm_sr , vdi_on_lvm_sr )
240+
241+ def test_cbt_parent_disable_does_not_affect_snapshot (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
242+ self ._test_cbt_parent_disable_does_not_affect_snapshot (host , lvm_sr , vdi_on_lvm_sr )
243+
244+ @pytest .mark .small_vm
245+ def test_cbt_bitmap_non_zero_after_write (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ,
246+ vm_on_lvm_sr : VM ) -> None :
247+ self ._test_cbt_bitmap_non_zero_after_write (host , lvm_sr , vdi_on_lvm_sr , vm_on_lvm_sr )
248+
249+ def test_cbt_data_destroy (self , host : Host , lvm_sr : SR , vdi_on_lvm_sr : VDI ) -> None :
250+ self ._test_cbt_data_destroy (host , lvm_sr , vdi_on_lvm_sr )
0 commit comments