summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-06-18 03:43:09 -0400
committerNigel Babu <nigelb@redhat.com>2018-06-21 05:06:22 +0000
commite9b43d2dd6a2fe59035cf571f320a894701eb04e (patch)
treed914ded3d1cd4656aaf8e5efd30720ef41c726a5 /glustolibs-gluster/glustolibs/gluster
parentb22e54a02fb3ba831a8d4663543f62539edb5d1e (diff)
Geo-rep: Delete and status ops
Deletion of a geo-rep session and getting the status of the geo-rep session Change-Id: I94f3c1877c4530246e1cc7077085c92ee7c72101 Signed-off-by: rallan <rallan@redhat.com> Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
index cd7c03a07..5e9a09b77 100644
--- a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
@@ -65,6 +65,36 @@ def georep_createpem(mnode):
return g.run(mnode, cmd)
+def georep_status(mnode, mastervol, slaveip, slavevol, user=None):
+ """Shows the status of the geo-replication session
+ Args:
+ mnode (str): Node on which cmd is to be executed
+ mastervol (str):The name of the master volume
+ slaveip (str): SlaveIP
+ slavevol(str): The name of the slave volume
+ Kwargs:
+ user (str): If not set, the default is a root-user
+ If specified, non-root user participates in geo-rep
+ session
+ 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.
+
+ """
+ if user:
+ cmd = ("gluster volume geo-replication %s %s@%s::%s status" %
+ (mastervol, user, slaveip, slavevol))
+ else:
+ cmd = ("gluster volume geo-replication %s %s::%s status" %
+ (mastervol, slaveip, slavevol))
+ return g.run(mnode, cmd)
+
+
def georep_create(mnode, mastervol, slaveip, slavevol, user=None, force=False):
"""Pushes the keys to all the slave nodes and creates a geo-rep session
Args:
@@ -263,3 +293,35 @@ def georep_resume(mnode, mastervol, slaveip, slavevol, user=None):
cmd = "gluster volume geo-replication %s %s::%s \
resume" % (mastervol, slaveip, slavevol)
return g.run(mnode, cmd)
+
+
+def georep_delete(mnode, mastervol, slaveip, slavevol, user=None):
+ """Deletes the geo-replication session
+ Args:
+ mnode (str): Node on which cmd is to be executed
+ mastervol (str):The name of the master volume
+ slaveip (str): SlaveIP
+ slavevol (str): The name of the slave volume
+ Kwargs:
+ user (str): If not set, the default is a root-user
+ If specified, non-root user participates in geo-rep
+ session
+ 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.
+
+ """
+ if user:
+ cmd = ("gluster volume geo-replication %s %s@%s::%s delete" %
+ (mastervol, user, slaveip, slavevol))
+ else:
+ cmd = ("gluster volume geo-replication %s %s::%s delete" %
+ (mastervol, slaveip, slavevol))
+ return g.run(mnode, cmd)