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

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

-- 
2.21.1



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

* [PATCH v5 1/3] Acceptance test: adds param 'address' in _get_free_port
  2020-04-07 15:56 [PATCH v5 0/3] Acceptance test: Extension of migration tests Oksana Vohchana
@ 2020-04-07 15:56 ` Oksana Vohchana
  2020-04-07 17:21   ` Willian Rampazzo
  2020-04-07 15:56 ` [PATCH v5 2/3] Acceptance test: provides new functions Oksana Vohchana
  2020-04-07 15:56 ` [PATCH v5 3/3] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana
  2 siblings, 1 reply; 7+ messages in thread
From: Oksana Vohchana @ 2020-04-07 15:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: ovoshcha, philmd, wainersm, crosa

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] 7+ messages in thread

* [PATCH v5 2/3] Acceptance test: provides new functions
  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 15:56 ` Oksana Vohchana
  2020-04-07 17:22   ` Willian Rampazzo
  2020-04-07 15:56 ` [PATCH v5 3/3] Acceptance test: provides to use RDMA transport for migration test Oksana Vohchana
  2 siblings, 1 reply; 7+ messages in thread
From: Oksana Vohchana @ 2020-04-07 15:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: ovoshcha, philmd, wainersm, crosa

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



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

* [PATCH v5 3/3] Acceptance test: provides to use RDMA transport for migration test
  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 15:56 ` [PATCH v5 2/3] Acceptance test: provides new functions Oksana Vohchana
@ 2020-04-07 15:56 ` Oksana Vohchana
  2020-04-07 17:22   ` Willian Rampazzo
  2 siblings, 1 reply; 7+ messages in thread
From: Oksana Vohchana @ 2020-04-07 15:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: ovoshcha, philmd, wainersm, crosa

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 1c3a684395..99563ae850 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -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)
-- 
2.21.1



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

* Re: [PATCH v5 1/3] Acceptance test: adds param 'address' in _get_free_port
  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
  0 siblings, 0 replies; 7+ messages in thread
From: Willian Rampazzo @ 2020-04-07 17:21 UTC (permalink / raw)
  To: Oksana Vohchana
  Cc: Philippe Mathieu Daude, qemu-devel, Wainer Moschetta,
	Cleber Rosa Junior

On Tue, Apr 7, 2020 at 1:05 PM 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
>
>

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



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

* Re: [PATCH v5 2/3] Acceptance test: provides new functions
  2020-04-07 15:56 ` [PATCH v5 2/3] Acceptance test: provides new functions Oksana Vohchana
@ 2020-04-07 17:22   ` Willian Rampazzo
  0 siblings, 0 replies; 7+ messages in thread
From: Willian Rampazzo @ 2020-04-07 17:22 UTC (permalink / raw)
  To: Oksana Vohchana
  Cc: Philippe Mathieu Daude, qemu-devel, Wainer Moschetta,
	Cleber Rosa Junior

On Tue, Apr 7, 2020 at 1:07 PM Oksana Vohchana <ovoshcha@redhat.com> wrote:
>
> 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
>
>

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



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

* Re: [PATCH v5 3/3] Acceptance test: provides to use RDMA transport for migration test
  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
  0 siblings, 0 replies; 7+ messages in thread
From: Willian Rampazzo @ 2020-04-07 17:22 UTC (permalink / raw)
  To: Oksana Vohchana
  Cc: Philippe Mathieu Daude, qemu-devel, Wainer Moschetta,
	Cleber Rosa Junior

On Tue, Apr 7, 2020 at 1:07 PM Oksana Vohchana <ovoshcha@redhat.com> wrote:
>
> 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 1c3a684395..99563ae850 100644
> --- a/tests/acceptance/migration.py
> +++ b/tests/acceptance/migration.py
> @@ -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)
> --
> 2.21.1
>
>

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



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

end of thread, other threads:[~2020-04-07 17:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v5 2/3] Acceptance test: provides new functions Oksana Vohchana
2020-04-07 17:22   ` 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

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