qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Acceptance test: Extension of migration tests
@ 2020-03-23 10:30 Oksana Vohchana
  2020-03-23 10:30 ` [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Oksana Vohchana @ 2020-03-23 10:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, crosa, wainersm, wrampazz, ovoshcha, philmd

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

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 | 48 +++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

-- 
2.21.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port
  2020-03-23 10:30 [PATCH v4 0/3] Acceptance test: Extension of migration tests Oksana Vohchana
@ 2020-03-23 10:30 ` Oksana Vohchana
  2020-03-23 14:45   ` Willian Rampazzo
  2020-03-23 10:30 ` [PATCH v4 2/3] Acceptance test: provides new functions Oksana Vohchana
  2020-03-23 10:30 ` [PATCH v4 3/3] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana
  2 siblings, 1 reply; 5+ messages in thread
From: Oksana Vohchana @ 2020-03-23 10:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, crosa, wainersm, wrampazz, ovoshcha, philmd

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

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
---
 tests/acceptance/migration.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index a8367ca023..e4c39b85a1 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -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
-- 
2.21.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 2/3] Acceptance test: provides new functions
  2020-03-23 10:30 [PATCH v4 0/3] Acceptance test: Extension of migration tests Oksana Vohchana
  2020-03-23 10:30 ` [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
@ 2020-03-23 10:30 ` Oksana Vohchana
  2020-03-23 10:30 ` [PATCH v4 3/3] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana
  2 siblings, 0 replies; 5+ messages in thread
From: Oksana Vohchana @ 2020-03-23 10:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, crosa, wainersm, wrampazz, ovoshcha, philmd

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 | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index e4c39b85a1..59144f18fd 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -11,12 +11,44 @@
 
 
 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 _if_rdma_enable():
+    rdma_stat = service.ServiceManager()
+    return bool(rdma_stat.status('rdma'))
+
+def _get_interface_rdma():
+    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:
+        return False
+    return False
+
+def _get_ip_rdma(interface):
+    local = LocalHost()
+    network_in = NetworkInterface(interface, local)
+    try:
+        ip = network_in._get_interface_details()
+        if ip:
+            return ip[0]['addr_info'][0]['local']
+    except (KeyError, process.CmdError):
+        return False
+    return False
 
 
 class Migration(Test):
-- 
2.21.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 3/3] Acceptance test: provides to use RDMA transport for migration test
  2020-03-23 10:30 [PATCH v4 0/3] Acceptance test: Extension of migration tests Oksana Vohchana
  2020-03-23 10:30 ` [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
  2020-03-23 10:30 ` [PATCH v4 2/3] Acceptance test: provides new functions Oksana Vohchana
@ 2020-03-23 10:30 ` Oksana Vohchana
  2 siblings, 0 replies; 5+ messages in thread
From: Oksana Vohchana @ 2020-03-23 10:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost, crosa, wainersm, wrampazz, ovoshcha, philmd

Adds test for RDMA migration check

Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
---
 tests/acceptance/migration.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index 59144f18fd..c96da1dd4b 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -107,3 +107,15 @@ class Migration(Test):
         """
         free_port = self._get_free_port()
         dest_uri = 'exec:nc -l localhost %u' % free_port
+
+    @skipUnless(_if_rdma_enable(), 'Unit rdma.service could not be found')
+    @skipUnless(_get_interface_rdma(), 'RDMA service or 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)
+        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)
-- 
2.21.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port
  2020-03-23 10:30 ` [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
@ 2020-03-23 14:45   ` Willian Rampazzo
  0 siblings, 0 replies; 5+ messages in thread
From: Willian Rampazzo @ 2020-03-23 14:45 UTC (permalink / raw)
  To: Oksana Vohchana
  Cc: Eduardo Habkost, Philippe Mathieu Daude, qemu-devel,
	Wainer Moschetta, Cleber Rosa Junior

On Mon, Mar 23, 2020 at 7:30 AM Oksana Vohchana <ovoshcha@redhat.com> wrote:
>
> 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
>
> Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
> ---
>  tests/acceptance/migration.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
> index a8367ca023..e4c39b85a1 100644
> --- a/tests/acceptance/migration.py
> +++ b/tests/acceptance/migration.py
> @@ -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
> --
> 2.21.1
>

Just confirming,

Reviewed-by: Willian Rampazzo <willianr@redhat.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-23 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-23 10:30 [PATCH v4 0/3] Acceptance test: Extension of migration tests Oksana Vohchana
2020-03-23 10:30 ` [PATCH v4 1/3] Acceptance test: adds param 'address' in _get_free_port Oksana Vohchana
2020-03-23 14:45   ` Willian Rampazzo
2020-03-23 10:30 ` [PATCH v4 2/3] Acceptance test: provides new functions Oksana Vohchana
2020-03-23 10:30 ` [PATCH v4 3/3] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana

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).