Acceptance test: Extension of migration tests
v5 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
V3:
- removes unrelated changes
- updates functions with new avocado features
V4:
- moves RDMA's functions outside the Migration class
V5:
- improvement to comments
- updates to functions
Oksana Vohchana (3):
Acceptance test: adds param 'address' in _get_free_port Acceptance test: provides new functions
Acceptance test: provides to use RDMA transport for migration test
tests/acceptance/migration.py | 61 +++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.1
PATCH v5 1/3 Acceptance test: adds param 'address' in _get_free_port
In 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
Re: [PATCH v5 1/3] Acceptance test: adds param 'address' in _get_free_port
Quoted 27 lines · Oksana Vohchana
In the migration test function
_get_free_portworks 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 optionSigned-off-by Oksana Vohchana <[email protected]>--- tests/acceptance/migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/acceptance/migration.py +2
-3@@ -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 --
Quoted 3 lines
2.21.1
PATCH v5 2/3 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 | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
tests/acceptance/migration.py +45 -0
@@ -11,12 +11,57 @@ import tempfile +import json 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.network.interfaces import NetworkInterface +from avocado.utils.network.hosts import LocalHost +from avocado.utils import service +from avocado.utils import process + + +def get_rdma_status(): + """Verify the status of RDMA service. + + return: True if rdma service is enabled, False otherwise. + """ + rdma_stat = service.ServiceManager() + return bool(rdma_stat.status('rdma')) + +def get_interface_rdma(): + """Get the interface name where RDMA is configured. + + return: The interface name or False if none is found + """ + cmd = 'rdma link show -j' + out = json.loads(process.getoutput(cmd)) + try: + for i in out: + if i['state'] == 'ACTIVE': + return i['netdev'] + except KeyError: + pass + return False + +def get_ip_rdma(interface): + """Get the IP address on a specific interface. + + :param interface: Network interface name + :return: IP addresses as a list, otherwise will return False + """ + local = LocalHost() + network_in = NetworkInterface(interface, local) + try: + ip = network_in.get_ipaddrs() + if ip: + return ip + except: + pass + return False class Migration(Test):
Signature · 1 line
2.21.1
Re: [PATCH v5 2/3] Acceptance test: provides new functions
Quoted 73 lines · Oksana Vohchana
Provides 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
Signed-off-by Oksana Vohchana <[email protected]>--- tests/acceptance/migration.py | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)tests/acceptance/migration.py +45
-1@@ -11,12 +11,57 @@ import tempfile +import json 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.network.interfaces import NetworkInterface +from avocado.utils.network.hosts import LocalHost +from avocado.utils import service +from avocado.utils import process + + +def get_rdma_status(): + """Verify the status of RDMA service. + + return: True if rdma service is enabled, False otherwise. + """ + rdma_stat = service.ServiceManager() + return bool(rdma_stat.status('rdma')) + +def get_interface_rdma(): + """Get the interface name where RDMA is configured. + + return: The interface name or False if none is found + """ + cmd = 'rdma link show -j' + out = json.loads(process.getoutput(cmd)) + try: + for i in out: + if i['state'] == 'ACTIVE': + return i['netdev'] + except KeyError: + pass + return False + +def get_ip_rdma(interface): + """Get the IP address on a specific interface. + + :param interface: Network interface name + :return: IP addresses as a list, otherwise will return False + """ + local = LocalHost() + network_in = NetworkInterface(interface, local) + try: + ip = network_in.get_ipaddrs() + if ip: + return ip + except: + pass + return False class Migration(Test): --
Quoted 3 lines
2.21.1
PATCH v5 3/3 Acceptance test: provides to use RDMA transport for migration test
In reply to Oksana VohchanaAdds test for RDMA migration check
--- tests/acceptance/migration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tests/acceptance/migration.py +12 -0
@@ -120,3 +120,15 @@ class Migration(Test): """ free_port = self._get_free_port() dest_uri = 'exec:nc -l localhost %u' % free_port + + @skipUnless(get_rdma_status(), 'RDMA service is disabled or not installed') + @skipUnless(get_interface_rdma(), 'RDMA interface not configured') + def test_migration_with_rdma_localhost(self): + iface = get_interface_rdma() + ip = get_ip_rdma(iface) + if ip: + free_port = self._get_free_port(address=ip[0]) + else: + self.cancel("Ip address doesn't configured properly on interface:%s" % iface) + dest_uri = 'rdma:%s:%u' % (ip, free_port) + self.do_migrate(dest_uri)
Signature · 1 line
2.21.1
Re: [PATCH v5 3/3] Acceptance test: provides to use RDMA transport for migration test
Quoted 29 lines · Oksana Vohchana
Adds test for RDMA migration check
Signed-off-by Oksana Vohchana <[email protected]>--- tests/acceptance/migration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+)tests/acceptance/migration.py +12
-1@@ -120,3 +120,15 @@ class Migration(Test): """ free_port = self._get_free_port() dest_uri = 'exec:nc -l localhost %u' % free_port + + @skipUnless(get_rdma_status(), 'RDMA service is disabled or not installed') + @skipUnless(get_interface_rdma(), 'RDMA interface not configured') + def test_migration_with_rdma_localhost(self): + iface = get_interface_rdma() + ip = get_ip_rdma(iface) + if ip: + free_port = self._get_free_port(address=ip[0]) + else: + self.cancel("Ip address doesn't configured properly on interface:%s" % iface) + dest_uri = 'rdma:%s:%u' % (ip, free_port) + self.do_migrate(dest_uri) --
Quoted 3 lines
2.21.1