[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 3/4] Acceptance test: provides new functions
From: |
Wainer dos Santos Moschetta |
Subject: |
Re: [PATCH v1 3/4] Acceptance test: provides new functions |
Date: |
Fri, 21 Feb 2020 15:31:42 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Hi Oksana,
On 2/14/20 12:52 PM, Oksana Vohchana wrote:
Adds functions to check if service RDMA is enabled and gets the interface
where it was configured
Signed-off-by: Oksana Vohchana <address@hidden>
---
tests/acceptance/migration.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index 8209dcf71d..bbd88f8dda 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -11,12 +11,16 @@
import tempfile
+import re
+import netifaces
Since netifaces isn't a standard Python library that import might fail.
The tests dependencies are listed in tests/requirements.txt, and
installed in the environment created by `make check-acceptance`. If you
want to ensure the test behaves well even when executed manually (i.e.
not via `make check-acceptance`), you can add runtime checks as can be
seen in tests/acceptance/machine_m68k_nextcube.py
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
class Migration(Test):
@@ -58,6 +62,19 @@ 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
Above function is used on patch04, but actually I don't think it needs
to check this service for RoCE. It would be needed if it was using the
rxe_cfg to configure the rdma link. Or am I missing something?
+
+ 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]
+ ip =
netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr']
+ return ip
+
I suggest that it explicitly returns None if none is found.
Thanks!
- Wainer
def test_migration_with_tcp_localhost(self):
dest_uri = 'tcp:localhost:%u' % self._get_free_port()