File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
2
import logging
3
3
4
- from lib .vdi import VDI
5
-
6
4
MAX_LENGTH = 1 * 1024 * 1024 * 1024 # 1GiB
7
5
8
6
@pytest .fixture (scope = "module" )
9
7
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 ))
20
11
21
12
yield vdi
22
13
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 ( )
25
16
26
17
@pytest .fixture (scope = "module" )
27
18
def vdi_with_vbd_on_dom0 (host , vdi_on_local_sr ):
You can’t perform that action at this time.
0 commit comments