Skip to content

Commit e273f0a

Browse files
authored
Merge pull request #535 from xcp-ng/vml/use-nfs-for-intrapool-migration-in-glusterfs-tests
Use NFS for intrapool migration in the glusterfs tests
2 parents 377e8bd + 8642a22 commit e273f0a

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import pytest
22

3+
from lib import config
34
from lib.host import Host
45
from lib.sr import SR
6+
from lib.vdi import ImageFormat
57
from lib.vm import VM
68
from tests.storage import cold_migration_then_come_back, live_storage_migration_then_come_back
79

10+
from typing import Generator
11+
812
# Requirements:
913
# From --hosts parameter:
1014
# - host(A1): first XCP-ng host >= 8.2 with an additional unused disk for the SR.
@@ -14,6 +18,20 @@
1418
# And:
1519
# - access to XCP-ng RPM repository from hostA1
1620

21+
22+
@pytest.fixture(scope='package')
23+
def nfs_sr(host: Host, image_format: ImageFormat) -> Generator[SR, None, None]:
24+
"""
25+
A NFS SR on first host.
26+
27+
Note: this fixture is already present in `tests/storage/nfs`, but it's scoped to the `nfs` package
28+
"""
29+
nfs_device_config = config.sr_device_config("NFS_DEVICE_CONFIG") | {'preferred-image-formats': image_format}
30+
sr = host.sr_create('nfs', "NFS-SR-test", nfs_device_config, shared=True)
31+
yield sr
32+
sr.destroy()
33+
34+
1735
@pytest.mark.small_vm # run with a small VM to test the features
1836
@pytest.mark.big_vm # and ideally with a big VM to test it scales
1937
class Test:
@@ -22,11 +40,11 @@ def test_live_intrapool_shared_migration(self, host: Host, hostA2: Host, vm_on_g
2240
live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, sr)
2341

2442
def test_cold_intrapool_migration(
25-
self, host: Host, hostA2: Host, vm_on_glusterfs_sr: VM, xfs_sr_on_hostA2: SR
43+
self, host: Host, hostA2: Host, vm_on_glusterfs_sr: VM, nfs_sr: SR
2644
) -> None:
27-
cold_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, xfs_sr_on_hostA2)
45+
cold_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, nfs_sr)
2846

2947
def test_live_intrapool_migration(
30-
self, host: Host, hostA2: Host, vm_on_glusterfs_sr: VM, xfs_sr_on_hostA2: SR
48+
self, host: Host, hostA2: Host, vm_on_glusterfs_sr: VM, nfs_sr: SR
3149
) -> None:
32-
live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, xfs_sr_on_hostA2)
50+
live_storage_migration_then_come_back(vm_on_glusterfs_sr, host, hostA2, nfs_sr)

0 commit comments

Comments
 (0)