@@ -28,10 +28,16 @@ class TestLVMSRCreateDestroy:
2828 def test_create_sr_with_missing_device (self , host ):
2929 try_to_create_sr_with_missing_device ('lvm' , 'LVM-local-SR-test' , host )
3030
31- def test_create_and_destroy_sr (self , host : Host , unused_512B_disks : dict [Host , list [Host .BlockDeviceInfo ]]) -> None :
31+ def test_create_and_destroy_sr (self , host : Host ,
32+ unused_512B_disks : dict [Host , list [Host .BlockDeviceInfo ]],
33+ image_format : str
34+ ) -> None :
3235 sr_disk = unused_512B_disks [host ][0 ]["name" ]
3336 # Create and destroy tested in the same test to leave the host as unchanged as possible
34- sr = host .sr_create ('lvm' , "LVM-local-SR-test" , {'device' : '/dev/' + sr_disk }, verify = True )
37+ sr = host .sr_create ('lvm' , "LVM-local-SR-test" , {
38+ 'device' : '/dev/' + sr_disk ,
39+ 'preferred-image-formats' : image_format
40+ }, verify = True )
3541 # import a VM in order to detect vm import issues here rather than in the vm_on_xfs_fixture used in
3642 # the next tests, because errors in fixtures break teardown
3743 vm = host .import_vm (vm_image ('mini-linux-x86_64-bios' ), sr_uuid = sr .uuid )
@@ -47,6 +53,13 @@ def test_quicktest(self, lvm_sr):
4753 def test_vdi_is_not_open (self , vdi_on_lvm_sr ):
4854 assert not vdi_is_open (vdi_on_lvm_sr )
4955
56+ def test_vdi_image_format (self , vdi_on_lvm_sr : VDI , image_format : str ):
57+ fmt = vdi_on_lvm_sr .get_image_format ()
58+ # feature-detect: if the SM doesn't report image-format, skip this check
59+ if not fmt :
60+ pytest .skip ("SM does not report sm-config:image-format; skipping format check" )
61+ assert fmt == image_format
62+
5063 @pytest .mark .small_vm # run with a small VM to test the features
5164 @pytest .mark .big_vm # and ideally with a big VM to test it scales
5265 def test_start_and_shutdown_VM (self , vm_on_lvm_sr ):
0 commit comments