diff options
author | Pranav <prprakas@redhat.com> | 2021-01-11 14:53:50 +0530 |
---|---|---|
committer | Arthy Loganathan <aloganat@redhat.com> | 2021-01-18 05:08:42 +0000 |
commit | a52acf091b72bbc0cacd8644eab33ba0b4dbf441 (patch) | |
tree | 901a00ce46281733a5a1570dab37f4b7c54648c2 /glustolibs-misc/glustolibs | |
parent | 7531b90f8f0e7eee410fb0270a5af12b7b29b7bf (diff) |
[TestFix+Lib] Add steps to validate glusterd logs
Adding additional checks to verify the glusterd logs
for `Responded to` and `Received ACC` while performing
a glusterd restart.
Replacing reboot with network interface down to validate
the peer probe scenarios.
Adding lib to bring down network interface.
Change-Id: Ifb01d53f67835224d828f531e7df960c6cb0a0ba
Signed-off-by: Pranav <prprakas@redhat.com>
Diffstat (limited to 'glustolibs-misc/glustolibs')
-rwxr-xr-x | glustolibs-misc/glustolibs/misc/misc_libs.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/glustolibs-misc/glustolibs/misc/misc_libs.py b/glustolibs-misc/glustolibs/misc/misc_libs.py index 109dc9621..9f9225929 100755 --- a/glustolibs-misc/glustolibs/misc/misc_libs.py +++ b/glustolibs-misc/glustolibs/misc/misc_libs.py @@ -21,7 +21,7 @@ import sys import time from glusto.core import Glusto as g -from glustolibs.gluster.lib_utils import is_rhel6 +from glustolibs.gluster.lib_utils import is_rhel6, is_rhel7 def create_dirs(list_of_nodes, list_of_dir_paths): @@ -666,3 +666,25 @@ def kill_process(mnode, process_ids='', process_names=''): g.log.error("Failed to kill process with pid %s" % str(pid)) return False return True + + +def bring_down_network_interface(mnode, timeout=150): + """Brings the network interface down for a defined time + + Args: + mnode (str): Node at which the interface has to be bought down + timeout (int): Time duration (in secs) for which network has to + be down + + Returns: + network_status(object): Returns a process object + + Example: + >>> bring_down_network_interface("10.70.43.68", timout=100) + """ + interface = "eth0" if is_rhel7(mnode) else "ens3" + cmd = "ifconfig {0} down\nsleep {1}\nifconfig {0} up".format(interface, + timeout) + _, _, _ = g.run(mnode, "echo \"{}\"> 'test.sh'".format(cmd)) + network_status = g.run_async(mnode, "sh test.sh") + return network_status |