1313
1414if TYPE_CHECKING :
1515 from lib .host import Host
16+ from lib .vdi import VDI
1617
1718# Requirements:
1819# - one XCP-ng host >= 8.2 with an additional unused disk for the SR
@@ -27,15 +28,19 @@ class TestXFSSRCreateDestroy:
2728
2829 def test_create_xfs_sr_without_xfsprogs (self ,
2930 host : Host ,
30- unused_512B_disks : dict [Host , list [Host .BlockDeviceInfo ]]
31+ unused_512B_disks : dict [Host , list [Host .BlockDeviceInfo ]],
32+ image_format : str
3133 ) -> None :
3234 # This test must be the first in the series in this module
3335 assert not host .file_exists ('/usr/sbin/mkfs.xfs' ), \
3436 "xfsprogs must not be installed on the host at the beginning of the tests"
3537 sr_disk = unused_512B_disks [host ][0 ]["name" ]
3638 sr = None
3739 try :
38- sr = host .sr_create ('xfs' , "XFS-local-SR-test" , {'device' : '/dev/' + sr_disk })
40+ sr = host .sr_create ('xfs' , "XFS-local-SR-test" , {
41+ 'device' : '/dev/' + sr_disk ,
42+ 'preferred-image-formats' : image_format
43+ })
3944 except Exception :
4045 logging .info ("SR creation failed, as expected." )
4146 if sr is not None :
@@ -65,6 +70,13 @@ def test_quicktest(self, xfs_sr):
6570 def test_vdi_is_not_open (self , vdi_on_xfs_sr ):
6671 assert not vdi_is_open (vdi_on_xfs_sr )
6772
73+ def test_vdi_image_format (self , vdi_on_xfs_sr : VDI , image_format : str ):
74+ fmt = vdi_on_xfs_sr .get_image_format ()
75+ # feature-detect: if the SM doesn't report image-format, skip this check
76+ if not fmt :
77+ pytest .skip ("SM does not report sm-config:image-format; skipping format check" )
78+ assert fmt == image_format
79+
6880 @pytest .mark .small_vm # run with a small VM to test the features
6981 @pytest .mark .big_vm # and ideally with a big VM to test it scales
7082 def test_start_and_shutdown_VM (self , vm_on_xfs_sr ):
0 commit comments