From: Oksana Vohchana <ovoshcha@redhat.com>
To: qemu-devel@nongnu.org
Cc: ovoshcha@redhat.com, philmd@redhat.com, wainersm@redhat.com,
crosa@redhat.com
Subject: [PATCH v2 3/4] Acceptance test: provides new functions
Date: Tue, 25 Feb 2020 15:13:01 +0200 [thread overview]
Message-ID: <20200225131302.4792-4-ovoshcha@redhat.com> (raw)
In-Reply-To: <20200225131302.4792-1-ovoshcha@redhat.com>
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 <ovoshcha@redhat.com>
---
tests/acceptance/migration.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index 8209dcf71d..5632d74f14 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -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()
--
2.21.1
next prev parent reply other threads:[~2020-02-25 13:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 13:12 [PATCH v2 0/4] Acceptance test: Extension of migration tests Oksana Vohchana
2020-02-25 13:12 ` [PATCH v2 1/4] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
2020-02-25 13:13 ` [PATCH v2 2/4] Acceptance test: EXEC migration Oksana Vohchana
2020-02-25 13:13 ` Oksana Vohchana [this message]
2020-02-25 13:13 ` [PATCH v2 4/4] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200225131302.4792-4-ovoshcha@redhat.com \
--to=ovoshcha@redhat.com \
--cc=crosa@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).