2
2
import pytest
3
3
import time
4
4
5
- from .conftest import STORAGE_POOL_NAME , LINSTOR_PACKAGE
5
+ from .conftest import LINSTOR_PACKAGE
6
6
from lib .commands import SSHCommandFailed
7
7
from lib .common import wait_for , vm_image
8
8
from tests .storage import vdi_is_open
9
9
10
10
# Requirements:
11
- # - one XCP-ng host >= 8.2 with an additional unused disk for the SR
11
+ # - two or more XCP-ng hosts >= 8.2 with additional unused disk(s) for the SR
12
12
# - access to XCP-ng RPM repository from the host
13
13
14
14
class TestLinstorSRCreateDestroy :
@@ -18,15 +18,15 @@ class TestLinstorSRCreateDestroy:
18
18
and VM import.
19
19
"""
20
20
21
- def test_create_sr_without_linstor (self , host , lvm_disk ):
21
+ def test_create_sr_without_linstor (self , host , lvm_disks , provisioning_type , storage_pool_name ):
22
22
# This test must be the first in the series in this module
23
23
assert not host .is_package_installed ('python-linstor' ), \
24
24
"linstor must not be installed on the host at the beginning of the tests"
25
25
try :
26
26
sr = host .sr_create ('linstor' , 'LINSTOR-SR-test' , {
27
- 'group-name' : STORAGE_POOL_NAME ,
27
+ 'group-name' : storage_pool_name ,
28
28
'redundancy' : '1' ,
29
- 'provisioning' : 'thin'
29
+ 'provisioning' : provisioning_type
30
30
}, shared = True )
31
31
try :
32
32
sr .destroy ()
@@ -36,13 +36,13 @@ def test_create_sr_without_linstor(self, host, lvm_disk):
36
36
except SSHCommandFailed as e :
37
37
logging .info ("SR creation failed, as expected: {}" .format (e ))
38
38
39
- def test_create_and_destroy_sr (self , pool_with_linstor ):
39
+ def test_create_and_destroy_sr (self , pool_with_linstor , provisioning_type , storage_pool_name ):
40
40
# Create and destroy tested in the same test to leave the host as unchanged as possible
41
41
master = pool_with_linstor .master
42
42
sr = master .sr_create ('linstor' , 'LINSTOR-SR-test' , {
43
- 'group-name' : STORAGE_POOL_NAME ,
43
+ 'group-name' : storage_pool_name ,
44
44
'redundancy' : '1' ,
45
- 'provisioning' : 'thin'
45
+ 'provisioning' : provisioning_type
46
46
}, shared = True )
47
47
# import a VM in order to detect vm import issues here rather than in the vm_on_linstor_sr fixture used in
48
48
# the next tests, because errors in fixtures break teardown
@@ -147,7 +147,7 @@ def _ensure_resource_remain_diskless(host, controller_option, volume_name, diskl
147
147
148
148
class TestLinstorDisklessResource :
149
149
@pytest .mark .small_vm
150
- def test_diskless_kept (self , host , linstor_sr , vm_on_linstor_sr ):
150
+ def test_diskless_kept (self , host , linstor_sr , vm_on_linstor_sr , storage_pool_name ):
151
151
vm = vm_on_linstor_sr
152
152
vdi_uuids = vm .vdi_uuids (sr_uuid = linstor_sr .uuid )
153
153
vdi_uuid = vdi_uuids [0 ]
@@ -157,10 +157,12 @@ def test_diskless_kept(self, host, linstor_sr, vm_on_linstor_sr):
157
157
for member in host .pool .hosts :
158
158
controller_option += f"{ member .hostname_or_ip } ,"
159
159
160
+ sr_group_name = "xcp-sr-" + storage_pool_name .replace ("/" , "_" )
161
+
160
162
# Get volume name from VDI uuid
161
163
# "xcp/volume/{vdi_uuid}/volume-name": "{volume_name}"
162
164
output = host .ssh ([
163
- "linstor-kv-tool" , "--dump-volumes" , "-g" , "xcp-sr-linstor_group_thin_device" ,
165
+ "linstor-kv-tool" , "--dump-volumes" , "-g" , sr_group_name ,
164
166
"|" , "grep" , "volume-name" , "|" , "grep" , vdi_uuid
165
167
])
166
168
volume_name = output .split (': ' )[1 ].split ('"' )[1 ]
0 commit comments