diff options
author | Kotresh HR <khiremat@redhat.com> | 2018-06-18 04:48:37 -0400 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2018-06-21 05:12:09 +0000 |
commit | 144e2a1bfe80211fe02775da2386f57122001710 (patch) | |
tree | 583c8036fb16c1dd929aa6d4333660769cd41887 /glustolibs-gluster | |
parent | e9b43d2dd6a2fe59035cf571f320a894701eb04e (diff) |
Geo-rep: Config get and set options
Change-Id: I6cb2a321cd774e5c1008d27c42d9df9219e74ff0
Signed-off-by: rallan <rallan@redhat.com>
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'glustolibs-gluster')
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py | 71 |
1 files changed, 64 insertions, 7 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py index 5e9a09b77..88ad8ae80 100644 --- a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py @@ -125,18 +125,75 @@ def georep_create(mnode, mastervol, slaveip, slavevol, user=None, force=False): """ if user: if force: - cmd = "gluster volume geo-replication %s %s@%s::%s create push-pem \ - force" % (mastervol, user, slaveip, slavevol) + cmd = "gluster volume geo-replication %s %s@%s::%s create \ + push-pem force" % (mastervol, user, slaveip, slavevol) else: cmd = "gluster volume geo-replication %s %s@%s::%s create \ - push-pem" % (mastervol, user, slaveip, slavevol) + create push-pem" % (mastervol, user, slaveip, slavevol) else: if force: - cmd = "gluster volume geo-replication %s %s::%s create push-pem \ - force" % (mastervol, slaveip, slavevol) - else: cmd = "gluster volume geo-replication %s %s::%s create \ - push-pem" % (mastervol, slaveip, slavevol) + push-pem force" % (mastervol, slaveip, slavevol) + else: + cmd = "gluster volume geo-replication %s %s::%s \ + create push-pem" % (mastervol, slaveip, slavevol) + return g.run(mnode, cmd) + + +def georep_config_get(mnode, mastervol, slaveip, slavevol, config_key): + """ All the available configurable geo-rep options can be got + using the config_key and seeing what it has been set to + + Args: + mnode (str) : Node on which cmd is to be executed + mastervol (str) : The name of the mastervol + slaveip (str): SlaveIP + slavevol (str) The name of the slave volume + config_key (str): The configurable options available in geo-replication + 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. In this case, it contains value of + config. + + The third element 'err' is of type 'str' and is the stderr value + of the command execution. + + """ + cmd = ("gluster volume geo-replication %s %s::%s config %s" % + (mastervol, slaveip, slavevol, config_key)) + return g.run(mnode, cmd) + + +def georep_config_set(mnode, mastervol, slaveip, slavevol, config, value): + """ All the available configurable geo-rep options can be set with a + specific command if required or + just with the config parameter + Args: + mnode (str) : Node on which cmd is to be executed + mastervol (str) : The name of the mastervol + slaveip (str): SlaveIP + slavevol (str) The name of the slave volume + config (str): The configurable options available in geo-replication + Kwargs: + value (str): The value for the geo-rep config + 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. + + """ + cmd = ("gluster volume geo-replication %s %s::%s config %s %s" % + (mastervol, slaveip, slavevol, config, value)) return g.run(mnode, cmd) |