summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/lib_utils.py
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2021-01-07 11:53:42 +0530
committerArthy Loganathan <aloganat@redhat.com>2021-01-20 05:59:20 +0000
commitb0a6b643ae2357af37af47a9948fb2a8444afc37 (patch)
tree1ba503a3ca93a0c91672fde389a1b077e31eb345 /glustolibs-gluster/glustolibs/gluster/lib_utils.py
parent60cb33330800072d14654b3bf3b85a232644dd65 (diff)
[Test+Lib] Add tests to check self heal
Test scenarios added: 1. Test to check entry self heal. 2. Test to check meta data self heal. 3. Test self heal when files are removed and dirs created with the same name. Additional libraries added: 1. group_del(): Deletes groups created 2. enable_granular_heal(): Enables granular heal 3. disable_granular_heal(): Disables granular heal Change-Id: Iffa9a100fddaecae99c384afe3aaeaf13dd37e0d Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/lib_utils.py')
-rwxr-xr-xglustolibs-gluster/glustolibs/gluster/lib_utils.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/lib_utils.py b/glustolibs-gluster/glustolibs/gluster/lib_utils.py
index aa919e344..b04976b1c 100755
--- a/glustolibs-gluster/glustolibs/gluster/lib_utils.py
+++ b/glustolibs-gluster/glustolibs/gluster/lib_utils.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (C) 2015-2020 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2021 Red Hat, Inc. <http://www.redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1016,6 +1016,30 @@ def group_add(servers, groupname):
return True
+def group_del(servers, groupname):
+ """
+ Deletes a group in all the servers.
+
+ Args:
+ servers(list|str): Nodes on which cmd is to be executed.
+ groupname(str): Name of the group to be removed.
+
+ Return always True
+ """
+ if not isinstance(servers, list):
+ servers = [servers]
+
+ cmd = "groupdel %s" % groupname
+ results = g.run_parallel(servers, cmd)
+
+ for server, ret_value in list(results.items()):
+ retcode, _, err = ret_value
+ if retcode != 0 and "does not exist" in err:
+ g.log.error("Group %s on server %s already removed",
+ groupname, server)
+ return True
+
+
def ssh_keygen(mnode):
"""
Creates a pair of ssh private and public key if not present