Skip to content

Commit 933204a

Browse files
committed
Use unused_disks in xfs tests
Signed-off-by: Yann Dirson <[email protected]>
1 parent 1e4031c commit 933204a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/storage/xfs/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ def host_with_xfsprogs(host):
1212
host.yum_restore_saved_state()
1313

1414
@pytest.fixture(scope='package')
15-
def xfs_sr(sr_disk, host_with_xfsprogs):
15+
def xfs_sr(unused_disks, host_with_xfsprogs):
1616
""" A XFS SR on first host. """
17+
sr_disk = unused_disks[host_with_xfsprogs][0]
1718
sr = host_with_xfsprogs.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk})
1819
yield sr
1920
# teardown

tests/storage/xfs/test_xfs_sr.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ class TestXFSSRCreateDestroy:
1717
and VM import.
1818
"""
1919

20-
def test_create_xfs_sr_without_xfsprogs(self, host, sr_disk):
20+
def test_create_xfs_sr_without_xfsprogs(self, host, unused_disks):
2121
# This test must be the first in the series in this module
2222
assert not host.file_exists('/usr/sbin/mkfs.xfs'), \
2323
"xfsprogs must not be installed on the host at the beginning of the tests"
24+
sr_disk = unused_disks[host][0]
2425
sr = None
2526
try:
2627
sr = host.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk})
@@ -30,9 +31,10 @@ def test_create_xfs_sr_without_xfsprogs(self, host, sr_disk):
3031
sr.destroy()
3132
assert False, "SR creation should not have succeeded!"
3233

33-
def test_create_and_destroy_sr(self, sr_disk, host_with_xfsprogs):
34+
def test_create_and_destroy_sr(self, unused_disks, host_with_xfsprogs):
3435
# Create and destroy tested in the same test to leave the host as unchanged as possible
3536
host = host_with_xfsprogs
37+
sr_disk = unused_disks[host][0]
3638
sr = host.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk}, verify=True)
3739
# import a VM in order to detect vm import issues here rather than in the vm_on_xfs fixture used in
3840
# the next tests, because errors in fixtures break teardown

0 commit comments

Comments
 (0)