Skip to content

Commit 41c61e5

Browse files
committed
feat(coalesce): modify coalesce fixture to use VM function
Signed-off-by: Damien Thenot <[email protected]>
1 parent 58e9d39 commit 41c61e5

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

tests/storage/coalesce/conftest.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
import logging
34

45
MAX_LENGTH = 1 * 1024 * 1024 * 1024 # 1GiB
@@ -16,21 +17,12 @@ def vdi_on_local_sr(host, local_sr_on_hostA1, image_format):
1617

1718
@pytest.fixture(scope="module")
1819
def vdi_with_vbd_on_dom0(host, vdi_on_local_sr):
19-
vdi_uuid = vdi_on_local_sr.uuid
20-
dom0_uuid = host.get_dom0_uuid()
21-
logging.info(f">> Plugging VDI {vdi_uuid} on Dom0")
22-
vbd_uuid = host.xe("vbd-create",
23-
{"vdi-uuid": vdi_uuid,
24-
"vm-uuid": dom0_uuid,
25-
"device": "autodetect",
26-
})
27-
host.xe("vbd-plug", {"uuid": vbd_uuid})
20+
dom0 = host.get_dom0_VM()
21+
dom0.connect_vdi(vdi_on_local_sr)
2822

2923
yield vdi_on_local_sr
3024

31-
logging.info(f"<< Unplugging VDI {vdi_uuid} from Dom0")
32-
host.xe("vbd-unplug", {"uuid": vbd_uuid})
33-
host.xe("vbd-destroy", {"uuid": vbd_uuid})
25+
dom0.disconnect_vdi(vdi_on_local_sr)
3426

3527
@pytest.fixture(scope="class")
3628
def data_file_on_host(host):

0 commit comments

Comments
 (0)