Skip to content

Commit cfe0199

Browse files
tests/storage/zfsvol: Updated zfsvol to handle both vhd and qcow2 vdi image format
Signed-off-by: Rushikesh Jadhav <[email protected]>
1 parent 8e95898 commit cfe0199

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

tests/storage/zfsvol/conftest.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@
55
from pkgfixtures import host_with_saved_yum_state, sr_disk_wiped
66

77
@pytest.fixture(scope='package')
8-
def host_with_zfsvol(host_with_saved_yum_state):
8+
def host_with_zfsvol(host_with_saved_yum_state, image_format):
99
host = host_with_saved_yum_state
1010
host.yum_install(['xcp-ng-xapi-storage-volume-zfsvol'])
1111
host.restart_toolstack(verify=True)
1212
yield host
13+
host.yum_remove(['xcp-ng-xapi-storage-volume-zfsvol'])
14+
host.restart_toolstack(verify=True)
1315

1416
@pytest.fixture(scope='package')
15-
def zfsvol_sr(host, sr_disk_wiped, host_with_zfsvol):
17+
def zfsvol_sr(host, image_format, sr_disk_wiped, host_with_zfsvol):
1618
""" A ZFS Volume SR on first host. """
1719
device = '/dev/' + sr_disk_wiped
18-
sr = host.sr_create('zfs-vol', "ZFS-local-SR-test", {'device': device})
20+
sr = host.sr_create('zfs-vol', "ZFS-local-SR-test", {
21+
'device': device,
22+
'preferred-image-formats': image_format
23+
}, verify=True)
1924
yield sr
2025
# teardown violently - we don't want to require manual recovery when a test fails
2126
sr.forget()

tests/storage/zfsvol/test_zfsvol_sr.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ class TestZfsvolSRCreateDestroy:
1919
and VM import.
2020
"""
2121

22-
def test_create_and_destroy_sr(self, sr_disk_wiped, host_with_zfsvol):
22+
def test_create_and_destroy_sr(self, image_format, sr_disk_wiped, host_with_zfsvol):
2323
host = host_with_zfsvol
2424
# Create and destroy tested in the same test to leave the host as unchanged as possible
25-
sr = host.sr_create('zfs-vol', "ZFS-local-SR-test", {'device': '/dev/' + sr_disk_wiped}, verify=True)
25+
sr = host.sr_create('zfs-vol', "ZFS-local-SR-test", {
26+
'device': '/dev/' + sr_disk_wiped,
27+
'preferred-image-formats': image_format
28+
}, verify=True)
2629
# import a VM in order to detect vm import issues here rather than in the vm_on_xfs_fixture used in
2730
# the next tests, because errors in fixtures break teardown
2831
vm = host.import_vm(vm_image('mini-linux-x86_64-bios'), sr_uuid=sr.uuid)

0 commit comments

Comments
 (0)