Skip to content

Commit b4e1f53

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 5ec3d5e commit b4e1f53

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

tests/storage/xfs/conftest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ 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(sr_disk, host_with_xfsprogs, image_format):
1616
""" A XFS SR on first host. """
17-
sr = host_with_xfsprogs.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk})
17+
sr = host_with_xfsprogs.sr_create('xfs', "XFS-local-SR-test", {
18+
'device': '/dev/' + sr_disk,
19+
'preferred-image-formats': image_format
20+
})
1821
yield sr
1922
# teardown
2023
sr.destroy()

tests/storage/xfs/test_xfs_sr.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,29 @@ 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, image_format, sr_disk):
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"
2424
sr = None
2525
try:
26-
sr = host.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk})
26+
sr = host.sr_create('xfs', "XFS-local-SR-test", {
27+
'device': '/dev/' + sr_disk,
28+
'preferred-image-formats': image_format
29+
})
2730
except Exception:
2831
logging.info("SR creation failed, as expected.")
2932
if sr is not None:
3033
sr.destroy()
3134
assert False, "SR creation should not have succeeded!"
3235

33-
def test_create_and_destroy_sr(self, sr_disk, host_with_xfsprogs):
36+
def test_create_and_destroy_sr(self, sr_disk, host_with_xfsprogs, image_format):
3437
# Create and destroy tested in the same test to leave the host as unchanged as possible
3538
host = host_with_xfsprogs
36-
sr = host.sr_create('xfs', "XFS-local-SR-test", {'device': '/dev/' + sr_disk}, verify=True)
39+
sr = host.sr_create('xfs', "XFS-local-SR-test", {
40+
'device': '/dev/' + sr_disk,
41+
'preferred-image-formats': image_format
42+
}, verify=True)
3743
# import a VM in order to detect vm import issues here rather than in the vm_on_xfs fixture used in
3844
# the next tests, because errors in fixtures break teardown
3945
vm = host.import_vm(vm_image('mini-linux-x86_64-bios'), sr_uuid=sr.uuid)

0 commit comments

Comments
 (0)