1111from lib .vm import VM
1212from 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 ,
2427# Requirements:
2528# - one XCP-ng host >= 8.0 with an additional unused disk for the SR
2629
30+
2731class 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' )
4147class 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 )
0 commit comments