@@ -13,12 +13,19 @@ def host_without_zfs(host):
1313 assert not host .file_exists ('/usr/sbin/zpool' ), \
1414 "zfs must not be installed on the host at the beginning of the tests"
1515
16+ # NOTE: @pytest.mark.usefixtures does not parametrize this fixture.
17+ # To recreate host_with_zfs for each image_format value, accept
18+ # image_format in the fixture arguments.
19+ # ref https://docs.pytest.org/en/7.1.x/how-to/fixtures.html#use-fixtures-in-classes-and-modules-with-usefixtures
1620@pytest .fixture (scope = 'package' )
17- def host_with_zfs (host_without_zfs , host_with_saved_yum_state ):
21+ def host_with_zfs (host_without_zfs , host_with_saved_yum_state , image_format ):
1822 host = host_with_saved_yum_state
1923 host .yum_install (['zfs' ])
2024 host .ssh (['modprobe' , 'zfs' ])
2125 yield host
26+ host .ssh (["systemctl" , "stop" , "zfs-zed" ])
27+ host .ssh (['rmmod' , 'zfs' ])
28+ host .yum_remove (['zfs' ])
2229
2330@pytest .fixture (scope = 'package' )
2431def zpool_vol0 (sr_disk_wiped , host_with_zfs ):
@@ -28,9 +35,12 @@ def zpool_vol0(sr_disk_wiped, host_with_zfs):
2835 host_with_zfs .ssh (['zpool' , 'destroy' , POOL_NAME ])
2936
3037@pytest .fixture (scope = 'package' )
31- def zfs_sr (host , zpool_vol0 ):
38+ def zfs_sr (host , image_format , zpool_vol0 ):
3239 """ A ZFS SR on first host. """
33- sr = host .sr_create ('zfs' , "ZFS-local-SR-test" , {'location' : POOL_PATH })
40+ sr = host .sr_create ('zfs' , "ZFS-local-SR-test" , {
41+ 'location' : POOL_PATH ,
42+ 'preferred-image-formats' : image_format
43+ }, verify = True )
3444 yield sr
3545 # teardown
3646 sr .destroy ()
0 commit comments