Acceptance test: Extension of migration tests
PATCH v2 1/4 Acceptance test: adds param 'address' in _get_free_port
In reply to Oksana VohchanaIn the migration test function _get_free_port works only for localhost, but in the case to use migration through an RDMA we need to get a free port on the configured network RDMA-interface.
This patch is the start for another migration option
--- tests/acceptance/migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/acceptance/migration.py +2 -2
@@ -52,8 +52,8 @@ class Migration(Test): source_vm.qmp('migrate', uri=src_uri) self.assert_migration(source_vm, dest_vm) - def _get_free_port(self): - port = network.find_free_port() + def _get_free_port(self, address='localhost'): + port = network.find_free_port(address=address) if port is None: self.cancel('Failed to find a free port') return port
Signature · 1 line
2.21.1
PATCH v2 2/4 Acceptance test: EXEC migration
In reply to Oksana VohchanaImproves EXEC migration to run whole test stage
--- tests/acceptance/migration.py | 2 ++ 1 file changed, 2 insertions(+)
tests/acceptance/migration.py +2 -0
@@ -75,3 +75,5 @@ class Migration(Test): """ free_port = self._get_free_port() dest_uri = 'exec:nc -l localhost %u' % free_port + src_uri = 'exec:nc localhost %u' % free_port + self.do_migrate(dest_uri, src_uri)
Signature · 1 line
2.21.1
PATCH v2 4/4 Acceptance test: provides to use RDMA transport for migration test
In reply to Oksana VohchanaAdds test for RDMA migration check
--- tests/acceptance/migration.py | 9 +++++++++ 1 file changed, 9 insertions(+)
tests/acceptance/migration.py +9 -0
@@ -103,3 +103,12 @@ class Migration(Test): dest_uri = 'exec:nc -l localhost %u' % free_port src_uri = 'exec:nc localhost %u' % free_port self.do_migrate(dest_uri, src_uri) + + @skipUnless(NET_AVAILABLE, 'Netifaces module not installed') + @skipUnless(_if_rdma_enable(None), "Unit rdma.service could not be found") + @skipUnless(_get_ip_rdma(None), 'RoCE(RDMA) service or interface not configured') + def test_migration_with_rdma_localhost(self): + ip = self._get_ip_rdma() + free_port = self._get_free_port(address=ip) + dest_uri = 'rdma:%s:%u' % (ip, free_port) + self.do_migrate(dest_uri)
Signature · 1 line
2.21.1
PATCH v2 3/4 Acceptance test: provides new functions
In reply to Oksana VohchanaProvides new functions related to the rdma migration test Adds functions to check if service RDMA is enabled and gets the ip address on the interface where it was configured
--- tests/acceptance/migration.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
tests/acceptance/migration.py +26 -0
@@ -11,12 +11,22 @@ import tempfile +import re from avocado_qemu import Test from avocado import skipUnless from avocado.utils import network from avocado.utils import wait from avocado.utils.path import find_command +from avocado.utils import service +from avocado.utils import process + + +NET_AVAILABLE = True +try: + import netifaces +except ImportError: + NET_AVAILABLE = False class Migration(Test):
@@ -58,6 +68,22 @@ class Migration(Test): self.cancel('Failed to find a free port') return port + def _if_rdma_enable(self): + rdma_stat = service.ServiceManager() + rdma = rdma_stat.status('rdma') + return rdma + + def _get_ip_rdma(self): + get_ip_rdma = process.run('rdma link show').stdout.decode() + for line in get_ip_rdma.split('\n'): + if re.search(r"ACTIVE", line): + interface = line.split(" ")[-2] + try: + return netifaces.ifaddresses(interface)[netifaces \ + .AF_INET][0]['addr'] + except (IndexError, KeyError): + return None + def test_migration_with_tcp_localhost(self): dest_uri = 'tcp:localhost:%u' % self._get_free_port()
Signature · 1 line
2.21.1
v2 cover Acceptance test: Extension of migration tests
This series adds a new migration test through RDMA.
To correct uses of migration need to add a new function to work with RDMA service.
And as a part of migration tests, the series makes small updates to EXEC migration and to _get_free_port function
V2:
- improves commit message in Acceptance test: adds param 'address' in _get_free_port
- provides import check for netifaces library
- makes fix to _get_ip_rdma function
- adds skip to test if not upload python module
Oksana Vohchana (4):
Acceptance test: adds param 'address' in _get_free_port Acceptance test: EXEC migration
Acceptance test: provides new functions
Acceptance test: provides to use RDMA transport for migration test
tests/acceptance/migration.py | 41 +++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.1