Skip to content

Commit 91f2bb5

Browse files
tests/storage/xfs: Updated xfs to handle both vhd and qcow2 vdi image format
Signed-off-by: Rushikesh Jadhav <[email protected]>
1 parent 0d57bb8 commit 91f2bb5

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

tests/storage/xfs/conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from lib.sr import SR
1212

1313
@pytest.fixture(scope='package')
14-
def host_with_xfsprogs(host):
14+
def host_with_xfsprogs(host, image_format):
1515
assert not host.file_exists('/usr/sbin/mkfs.xfs'), \
1616
"xfsprogs must not be installed on the host at the beginning of the tests"
1717
host.yum_save_state()
@@ -21,11 +21,13 @@ def host_with_xfsprogs(host):
2121
host.yum_restore_saved_state()
2222

2323
@pytest.fixture(scope='package')
24-
def xfs_sr(unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]], host_with_xfsprogs: Host
24+
def xfs_sr(unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]], host_with_xfsprogs: Host, image_format
2525
) -> Generator[SR]:
2626
""" A XFS SR on first host. """
2727
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})
28+
sr = host_with_xfsprogs.sr_create('xfs', "XFS-local-SR-test",
29+
{'device': '/dev/' + sr_disk,
30+
'preferred-image-formats': image_format})
2931
yield sr
3032
# teardown
3133
sr.destroy()

tests/storage/xfs/test_xfs_sr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ class TestXFSSRCreateDestroy:
2727

2828
def test_create_xfs_sr_without_xfsprogs(self,
2929
host: Host,
30-
unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]]
30+
unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]],
31+
image_format
3132
) -> None:
3233
# This test must be the first in the series in this module
3334
assert not host.file_exists('/usr/sbin/mkfs.xfs'), \
3435
"xfsprogs must not be installed on the host at the beginning of the tests"
3536
sr_disk = unused_512B_disks[host][0]["name"]
3637
sr = None
3738
try:
38-
sr = host.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk})
39+
sr = host.sr_create('xfs', "XFS-local-SR-test", {
40+
'device': '/dev/' + sr_disk,
41+
'preferred-image-formats': image_format
42+
})
3943
except Exception:
4044
logging.info("SR creation failed, as expected.")
4145
if sr is not None:

0 commit comments

Comments
 (0)