|
12 | 12 | LINSTOR_PACKAGE = 'xcp-ng-linstor'
|
13 | 13 |
|
14 | 14 | @pytest.fixture(scope='package')
|
15 |
| -def lvm_disk(host, sr_disk_for_all_hosts): |
16 |
| - device = '/dev/' + sr_disk_for_all_hosts |
| 15 | +def lvm_disks(host, sr_disks_for_all_hosts, provisioning_type): |
| 16 | + devices = [f"/dev/{disk}" for disk in sr_disks_for_all_hosts] |
17 | 17 | hosts = host.pool.hosts
|
18 | 18 |
|
19 | 19 | for host in hosts:
|
20 |
| - try: |
21 |
| - host.ssh(['pvcreate', '-ff', '-y', device]) |
22 |
| - except commands.SSHCommandFailed as e: |
23 |
| - if e.stdout.endswith('Mounted filesystem?'): |
24 |
| - host.ssh(['vgremove', '-f', GROUP_NAME, '-y']) |
| 20 | + for device in devices: |
| 21 | + try: |
25 | 22 | host.ssh(['pvcreate', '-ff', '-y', device])
|
26 |
| - elif e.stdout.endswith('excluded by a filter.'): |
27 |
| - host.ssh(['wipefs', '-a', device]) |
28 |
| - host.ssh(['pvcreate', '-ff', '-y', device]) |
29 |
| - else: |
30 |
| - raise e |
| 23 | + except commands.SSHCommandFailed as e: |
| 24 | + if e.stdout.endswith('Mounted filesystem?'): |
| 25 | + host.ssh(['vgremove', '-f', GROUP_NAME, '-y']) |
| 26 | + host.ssh(['pvcreate', '-ff', '-y', device]) |
| 27 | + elif e.stdout.endswith('excluded by a filter.'): |
| 28 | + host.ssh(['wipefs', '-a', device]) |
| 29 | + host.ssh(['pvcreate', '-ff', '-y', device]) |
| 30 | + else: |
| 31 | + raise e |
31 | 32 |
|
32 |
| - host.ssh(['vgcreate', GROUP_NAME, device]) |
33 |
| - host.ssh(['lvcreate', '-l', '100%FREE', '-T', STORAGE_POOL_NAME]) |
| 33 | + host.ssh(['vgcreate', GROUP_NAME] + devices) |
| 34 | + if provisioning_type == 'thin': |
| 35 | + host.ssh(['lvcreate', '-l', '100%FREE', '-T', STORAGE_POOL_NAME]) |
34 | 36 |
|
35 |
| - yield device |
| 37 | + yield devices |
36 | 38 |
|
37 | 39 | for host in hosts:
|
38 | 40 | host.ssh(['vgremove', '-f', GROUP_NAME])
|
39 |
| - host.ssh(['pvremove', device]) |
| 41 | + for device in devices: |
| 42 | + host.ssh(['pvremove', device]) |
40 | 43 |
|
41 | 44 | @pytest.fixture(scope='package')
|
42 | 45 | def pool_with_linstor(hostA2, lvm_disk, pool_with_saved_yum_state):
|
|
0 commit comments