From 0b2576209bf35beed5393c4b33c7fd0441bf7412 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 18 Jun 2018 03:54:36 -0400 Subject: Geo-rep: Non-root session related ops Setting up mountbroker along with adding user and checking status. Setting pem keys specific to non-root Change-Id: Ic8e38087d118f43aea0da270ea8f8f9da81286c1 Signed-off-by: rallan Signed-off-by: Kotresh HR --- .../glustolibs/gluster/geo_rep_ops.py | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) (limited to 'glustolibs-gluster/glustolibs') diff --git a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py index faf818746..e87090d0f 100644 --- a/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/geo_rep_ops.py @@ -123,6 +123,103 @@ def georep_geoaccount(servers, groupname, groupaccount): return True +def georep_mountbroker_setup(mnode, groupname, directory): + """ Sets up mountbroker root directory and group + + Args: + mnode (str): Node on which command is to be executed + groupname (str) : Specifies the groupname used + directory (str) : Specifies mountbroker root directory + + 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-mountbroker setup %s %s" % (directory, groupname) + return g.run(mnode, cmd) + + +def georep_mountbroker_adduser(mnode, slavevol, useraccount): + """ Adds the volume and user to the mountbroker + + Args: + mnode (str): Node on which command is to be executed + slavevol (str) : The slave volume name + useraccount (str): The user with which geo-rep is to be set up + + 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-mountbroker add %s %s" % (slavevol, useraccount) + return g.run(mnode, cmd) + + +def georep_mountbroker_status(mnode): + """ Displays the status of every peer node in the slave cluster + + Args: + mnode (str): Node on which command is to be executed + + + 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-mountbroker status" + return g.run(mnode, cmd) + + +def georep_set_pemkeys(mnode, useraccount, mastervol, slavevol): + """ Sets geo-rep pem keys + + Args: + mnode (str): Node on which command is to be executed + useraccount (str) : User with which geo-rep is to be set up + mastervol (str) : The master volume + slavevol (str): The slave volume + + 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 = ("/usr/libexec/glusterfs/set_geo_rep_pem_keys.sh %s %s %s" % + (useraccount, mastervol, slavevol)) + return g.run(mnode, cmd) + + def georep_status(mnode, mastervol, slaveip, slavevol, user=None): """Shows the status of the geo-replication session Args: -- cgit