summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorrallan <rallan@redhat.com>2018-06-11 12:10:40 +0530
committerNigel Babu <nigelb@redhat.com>2018-06-15 07:13:11 +0000
commit77dc34706ce4ee6aa410b8b6614dd125d955673b (patch)
tree821f69f354adc4ee7b3728dde9460ba2a97298f4 /glustolibs-gluster/glustolibs/gluster
parentf4e17b354a9cd2240fc9ca75a4183e4e72e8aff5 (diff)
Pausing and resuming a geo-rep session
Change-Id: I4d2767acb4fff7ab972e11d13ef4c547914110d9 Signed-off-by: rallan <rallan@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
index 4bb9ccd48..44a3174f8 100644
--- a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py
@@ -108,3 +108,66 @@ def georep_create(mnode, mastervol, slaveip, slavevol, user=None, force=False):
cmd = "gluster volume geo-replication %s %s::%s create \
push-pem" % (mastervol, slaveip, slavevol)
return g.run(mnode, cmd)
+
+
+def georep_pause(mnode, mastervol, slaveip, slavevol, user=None):
+ """Pauses 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 \
+ pause" % (mastervol, user, slaveip, slavevol)
+ else:
+ cmd = "gluster volume geo-replication %s %s::%s \
+ pause" % (mastervol, slaveip, slavevol)
+ return g.run(mnode, cmd)
+
+
+def georep_resume(mnode, mastervol, slaveip, slavevol, user=None):
+ """Resumes 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 \
+ resume" % (mastervol, user, slaveip, slavevol)
+ else:
+ cmd = "gluster volume geo-replication %s %s::%s \
+ resume" % (mastervol, slaveip, slavevol)
+ return g.run(mnode, cmd)