Skip to content

Commit 872c4f8

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 685a040 commit 872c4f8

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
@@ -6,17 +6,22 @@
66
from pkgfixtures import host_with_saved_yum_state, sr_disk_wiped
77

88
@pytest.fixture(scope='package')
9-
def host_with_zfsvol(host_with_saved_yum_state):
9+
def host_with_zfsvol(host_with_saved_yum_state, image_format):
1010
host = host_with_saved_yum_state
1111
host.yum_install(['xcp-ng-xapi-storage-volume-zfsvol'])
1212
host.restart_toolstack(verify=True)
1313
yield host
14+
host.yum_remove(['xcp-ng-xapi-storage-volume-zfsvol'])
15+
host.restart_toolstack(verify=True)
1416

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

tests/storage/zfsvol/test_zfsvol_sr.py

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

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

0 commit comments

Comments
 (0)