qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 2/3] Acceptance test: provides new functions


From: Willian Rampazzo
Subject: Re: [PATCH v5 2/3] Acceptance test: provides new functions
Date: Tue, 7 Apr 2020 14:22:05 -0300

On Tue, Apr 7, 2020 at 1:07 PM Oksana Vohchana <address@hidden> 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 <address@hidden>
> ---
>  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 <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]