Skip to content

Commit 8642a22

Browse files
vxgmichelrzr
authored andcommitted
Use NFS for intrapool migration in the glusterfs tests
The following tests are failing: - test_glusterfs_sr_intrapool_migration.py::Test::test_cold_intrapool_migration - test_glusterfs_sr_intrapool_migration.py::Test::test_live_intrapool_migration With either one of those errors depending on the fixture resolution order: - [AssertionError: xfsprogs must not be installed on the host at the beginning of the tests](https://github.com/xcp-ng/xcp-ng-tests/blob/377e8bd9d6ba0149728c5f4e535f55fb5fef84cf/tests/storage/conftest.py#L69) - [AssertionError: There is already a saved package list set](https://github.com/xcp-ng/xcp-ng-tests/blob/488cbdc1258cc0e0a38bcf45ba39a7cb065a0491/lib/host.py#L621)[AssertionError: There is already a saved package list set](https://github.com/xcp-ng/xcp-ng-tests/blob/488cbdc1258cc0e0a38bcf45ba39a7cb065a0491/lib/host.py#L621) This is due to both mangled package installation in underlying fixtures and the lack of enough unused disks for both SR. @glehmann, @rzr and I concluded that using NFS was much simpler and less error prone to test the glusterfs intrapool migration Signed-off-by: Vincent Michel <vincent.michel@vates.tech>
1 parent 377e8bd commit 8642a22

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)