Skip to content

Commit 826fd23

Browse files
authored
Merge pull request #538 from xcp-ng/gln/nfs-intrapool-migration-tests-uyvw
Use NFS for intrapool migration in the linstor tests
2 parents a7c66a8 + 56441ac commit 826fd23

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

Lines changed: 20 additions & 8 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,19 +18,27 @@
1418
# And:
1519
# - access to XCP-ng RPM repository from hostA1
1620

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

24-
def test_cold_intrapool_migration(
25-
self, host: Host, hostA2: Host, vm_on_linstor_sr: VM, xfs_sr_on_hostA2: SR
26-
) -> None:
27-
cold_migration_then_come_back(vm_on_linstor_sr, host, hostA2, xfs_sr_on_hostA2)
40+
def test_cold_intrapool_migration(self, host: Host, hostA2: Host, vm_on_linstor_sr: VM, nfs_sr: SR) -> None:
41+
cold_migration_then_come_back(vm_on_linstor_sr, host, hostA2, nfs_sr)
2842

29-
def test_live_intrapool_migration(
30-
self, host: Host, hostA2: Host, vm_on_linstor_sr: VM, xfs_sr_on_hostA2: SR
31-
) -> None:
32-
live_storage_migration_then_come_back(vm_on_linstor_sr, host, hostA2, xfs_sr_on_hostA2)
43+
def test_live_intrapool_migration(self, host: Host, hostA2: Host, vm_on_linstor_sr: VM, nfs_sr: SR) -> None:
44+
live_storage_migration_then_come_back(vm_on_linstor_sr, host, hostA2, nfs_sr)

0 commit comments

Comments
 (0)