1010 from lib .host import Host
1111 from lib .sr import SR
1212
13+ # NOTE: @pytest.mark.usefixtures does not parametrize this fixture.
14+ # To recreate host_with_xfsprogs for each image_format value, accept
15+ # image_format in the fixture arguments.
16+ # ref https://docs.pytest.org/en/7.1.x/how-to/fixtures.html#use-fixtures-in-classes-and-modules-with-usefixtures
1317@pytest .fixture (scope = 'package' )
14- def host_with_xfsprogs (host ):
18+ def host_with_xfsprogs (host : Host , image_format : str ):
1519 assert not host .file_exists ('/usr/sbin/mkfs.xfs' ), \
1620 "xfsprogs must not be installed on the host at the beginning of the tests"
1721 host .yum_save_state ()
@@ -21,11 +25,16 @@ def host_with_xfsprogs(host):
2125 host .yum_restore_saved_state ()
2226
2327@pytest .fixture (scope = 'package' )
24- def xfs_sr (unused_512B_disks : dict [Host , list [Host .BlockDeviceInfo ]], host_with_xfsprogs : Host
28+ def xfs_sr (unused_512B_disks : dict [Host ,
29+ list [Host .BlockDeviceInfo ]],
30+ host_with_xfsprogs : Host ,
31+ image_format : str
2532 ) -> Generator [SR ]:
2633 """ A XFS SR on first host. """
2734 sr_disk = unused_512B_disks [host_with_xfsprogs ][0 ]["name" ]
28- sr = host_with_xfsprogs .sr_create ('xfs' , "XFS-local-SR-test" , {'device' : '/dev/' + sr_disk })
35+ sr = host_with_xfsprogs .sr_create ('xfs' , "XFS-local-SR-test" ,
36+ {'device' : '/dev/' + sr_disk ,
37+ 'preferred-image-formats' : image_format })
2938 yield sr
3039 # teardown
3140 sr .destroy ()
0 commit comments