Skip to content

Commit 0d57bb8

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

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

tests/storage/lvm/conftest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
from lib.sr import SR
1212

1313
@pytest.fixture(scope='package')
14-
def lvm_sr(host: Host, unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]]) -> Generator[SR]:
14+
def lvm_sr(host: Host,
15+
unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]],
16+
image_format) -> Generator[SR]:
1517
""" An LVM SR on first host. """
1618
sr_disk = unused_512B_disks[host][0]["name"]
17-
sr = host.sr_create('lvm', "LVM-local-SR-test", {'device': '/dev/' + sr_disk})
19+
sr = host.sr_create('lvm', "LVM-local-SR-test",
20+
{'device': '/dev/' + sr_disk,
21+
'preffered-image-formats': image_format})
1822
yield sr
1923
# teardown
2024
sr.destroy()

tests/storage/lvm/test_lvm_sr.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ class TestLVMSRCreateDestroy:
2323
def test_create_sr_with_missing_device(self, host):
2424
try_to_create_sr_with_missing_device('lvm', 'LVM-local-SR-test', host)
2525

26-
def test_create_and_destroy_sr(self, host: Host, unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]]) -> None:
26+
def test_create_and_destroy_sr(self, host: Host,
27+
unused_512B_disks: dict[Host, list[Host.BlockDeviceInfo]],
28+
image_format) -> None:
2729
sr_disk = unused_512B_disks[host][0]["name"]
2830
# Create and destroy tested in the same test to leave the host as unchanged as possible
29-
sr = host.sr_create('lvm', "LVM-local-SR-test", {'device': '/dev/' + sr_disk}, verify=True)
31+
sr = host.sr_create('lvm', "LVM-local-SR-test", {
32+
'device': '/dev/' + sr_disk,
33+
'preferred-image-formats': image_format
34+
}, verify=True)
3035
# import a VM in order to detect vm import issues here rather than in the vm_on_xfs_fixture used in
3136
# the next tests, because errors in fixtures break teardown
3237
vm = host.import_vm(vm_image('mini-linux-x86_64-bios'), sr_uuid=sr.uuid)

0 commit comments

Comments
 (0)