Skip to content

Commit f07746f

Browse files
committed
coalesce: Fix vdi_on_local_sr fixture
Now use `SR.create_vdi` to create a VDI with the chosen image_format Signed-off-by: Damien Thenot <[email protected]>
1 parent 8782ae4 commit f07746f

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

tests/storage/coalesce/conftest.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
import pytest
22
import logging
33

4-
from lib.vdi import VDI
5-
64
MAX_LENGTH = 1 * 1024 * 1024 * 1024 # 1GiB
75

86
@pytest.fixture(scope="module")
97
def vdi_on_local_sr(host, local_sr_on_hostA1, image_format):
10-
sr_uuid = local_sr_on_hostA1.uuid
11-
vdi_uuid = host.xe("vdi-create",
12-
{"sr-uuid": sr_uuid,
13-
"name-label": "testVDI",
14-
"virtual-size": str(MAX_LENGTH),
15-
"sm-config:type": image_format,
16-
})
17-
logging.info(">> Created VDI {} of type {}".format(vdi_uuid, image_format))
18-
19-
vdi = VDI(vdi_uuid, host=host)
8+
sr = local_sr_on_hostA1
9+
vdi = sr.create_vdi("testVDI", MAX_LENGTH, image_format=image_format)
10+
logging.info(">> Created VDI {} of type {}".format(vdi.uuid, image_format))
2011

2112
yield vdi
2213

23-
logging.info("<< Destroying VDI {}".format(vdi_uuid))
24-
host.xe("vdi-destroy", {"uuid": vdi_uuid})
14+
logging.info("<< Destroying VDI {}".format(vdi.uuid))
15+
vdi.destroy()
2516

2617
@pytest.fixture(scope="module")
2718
def vdi_with_vbd_on_dom0(host, vdi_on_local_sr):

0 commit comments

Comments
 (0)