diff options
authorVinayak Papnoi <>2019-07-31 16:32:24 +0530
committerVinayak Papnoi <>2019-07-31 16:47:11 +0530
commit74b4bab01b504f735e656f855100441afe2a700a (patch)
parent790c20c46dee6053c87f709ea8a38ab6384e591f (diff)
Add library to reset particular volume option
Currently there is a library to reset the volume entirely. There needs to be a library to reset a particular volume option because if a user has set a lot of other volume options then it becomes a tedious job to reset and set the other options explicitly. The library function 'reset_volume_option' takes particular volume options as a string and resets it. Change-Id: I2049ea4a49d321d921d940f34e124d1f34bfa068 Signed-off-by: Vinayak Papnoi <>
1 files changed, 35 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/ b/glustolibs-gluster/glustolibs/gluster/
index e478ed979..0b3c94b07 100644
--- a/glustolibs-gluster/glustolibs/gluster/
+++ b/glustolibs-gluster/glustolibs/gluster/
@@ -594,6 +594,41 @@ def set_volume_options(mnode, volname, options):
return _rc
+def reset_volume_option(mnode, volname, option, force=False):
+ """Resets the volume option
+ Args:
+ mnode (str): Node on which cmd has to be executed
+ volname (str): volume name
+ option (str): volume option
+ Kwargs:
+ force (bool): If this option is set to True, then reset volume
+ will get executed with force option. If it is set to False,
+ then reset volume will get executed without force option
+ Returns:
+ tuple: Tuple containing three elements (ret, out, err).
+ The first element 'ret' is of type 'int' and is the return value
+ of command execution.
+ The second element 'out' is of type 'str' and is the stdout value
+ of the command execution.
+ The third element 'err' is of type 'str' and is the stderr value
+ of the command execution.
+ Example:
+ reset_volume_option("", "testvol", "option")
+ """
+ if force:
+ cmd = ("gluster volume reset %s %s force --mode=script"
+ % (volname, option))
+ else:
+ cmd = "gluster volume reset %s %s --mode=script" % (volname, option)
+ return, cmd)
def volume_info(mnode, volname='all'):
"""Executes gluster volume info cli command