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 v5 2/3] Acceptance test: provides new functions
Date: Tue, 7 Apr 2020 18:56:41 +0300 [thread overview]
Message-ID: <20200407155642.10716-3-ovoshcha@redhat.com> (raw)
In-Reply-To: <20200407155642.10716-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 | 45 +++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index e4c39b85a1..1c3a684395 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -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):
--
2.21.1
next prev parent reply other threads:[~2020-04-07 16:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-07 15:56 [PATCH v5 0/3] Acceptance test: Extension of migration tests Oksana Vohchana
2020-04-07 15:56 ` [PATCH v5 1/3] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
2020-04-07 17:21 ` Willian Rampazzo
2020-04-07 15:56 ` Oksana Vohchana [this message]
2020-04-07 17:22 ` [PATCH v5 2/3] Acceptance test: provides new functions Willian Rampazzo
2020-04-07 15:56 ` [PATCH v5 3/3] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana
2020-04-07 17:22 ` Willian Rampazzo
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=20200407155642.10716-3-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).