summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2019-07-29 14:28:29 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-08-07 13:10:22 +0000
commit0d4032a68b9b201892af398710b7a71e17a40af6 (patch)
tree73a6614cf15cabb14ca75bbb207eb3ff6fecbccf
parent8e47e9ab8ec6b9327c5d71e20a29bdac64189027 (diff)
Corrections to geo-rep libs
Change-Id: I0f32dc73d960f8bfeb662643e736291ffb74cb81 Signed-off-by: Roch-elle <rallan@redhat.com> Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rw-r--r--glustolibs-gluster/glustolibs/gluster/geo_rep_libs.py50
1 files changed, 23 insertions, 27 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/geo_rep_libs.py b/glustolibs-gluster/glustolibs/gluster/geo_rep_libs.py
index 0c15e64..2b0618b 100644
--- a/glustolibs-gluster/glustolibs/gluster/geo_rep_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/geo_rep_libs.py
@@ -20,8 +20,7 @@
from glusto.core import Glusto as g
from glustolibs.gluster.gluster_init import restart_glusterd
-from glustolibs.gluster.geo_rep_ops import (create_shared_storage,
- georep_groupadd,
+from glustolibs.gluster.geo_rep_ops import (georep_groupadd,
georep_geoaccount,
georep_mountbroker_setup,
georep_mountbroker_adduser,
@@ -32,6 +31,7 @@ from glustolibs.gluster.geo_rep_ops import (create_shared_storage,
georep_createpem, georep_create,
georep_set_pemkeys,
georep_config_set)
+from glustolibs.gluster.shared_storage_ops import enable_shared_storage
def georep_root_prerequisites(mnode, snode, user, passwd):
@@ -46,15 +46,15 @@ def georep_root_prerequisites(mnode, snode, user, passwd):
Args:
mnode (str) : The primary master node where the commands are executed
snode (str) : The primary slave node where the commande are executed
- mastervol (str) : The name of the master volume
- slavevol (str): The name of the slave volume
+ user (str) : User to be used to setup the geo-rep session
+ passwd (str): Password of the specified user.
Returns:
bool : True if all the steps are successful, false if there are
any failures in the middle
"""
g.log.debug("Enable shared-storage")
- ret, _, _ = create_shared_storage(mnode)
+ ret = enable_shared_storage(mnode)
if not ret:
g.log.error("Failed to create gluster shared storage on "
"the master cluster")
@@ -89,6 +89,7 @@ def georep_create_root_session(mnode, snode, mastervol, slavevol,
snode (str) : The primary slave node where the commande are executed
mastervol (str) : The name of the master volume
slavevol (str): The name of the slave volume
+ Kwargs:
user (str): Since it's a root session, user is root or None
force (bool) : Set to true if session needs to be created with force
else it remains false as the default option
@@ -98,27 +99,24 @@ def georep_create_root_session(mnode, snode, mastervol, slavevol,
any failures in the middle
"""
g.log.debug("Creating a common pem file on %s", mnode)
- ret, out, err = georep_createpem(mnode)
+ ret, _, _ = georep_createpem(mnode)
if not ret:
g.log.error("Failed to create a common pem file on all the nodes "
"belonging to the cluster %s ", mnode)
- g.log.error("Error: out: %s \nerr: %s", out, err)
return False
g.log.debug("Create geo-rep session from %s to %s", mnode, snode)
- ret, out, err = georep_create(mnode, mastervol, snode,
- slavevol, user, force)
+ ret, _, _ = georep_create(mnode, mastervol, snode,
+ slavevol, user, force)
if not ret:
g.log.error("Failed to create geo-rep session")
- g.log.error("Error: out: %s \nerr: %s", out, err)
return False
g.log.debug("Setting up meta-volume on %s", mnode)
- ret, out, err = georep_config_set(mnode, mastervol, snode, slavevol,
- "use_meta_volume", "True")
+ ret, _, _ = georep_config_set(mnode, mastervol, snode, slavevol,
+ "use_meta_volume", "True")
if not ret:
g.log.error("Failed to set up meta-volume")
- g.log.error("Error: out: %s \nerr: %s", out, err)
return False
g.log.info("Pem file has been created and the keys have "
@@ -143,11 +141,10 @@ def georep_nonroot_prerequisites(mnode, snodes, group, user, mntbroker_dir,
"""
g.log.debug("Enable shared-storage")
- ret, _, err = create_shared_storage(mnode)
+ ret = enable_shared_storage(mnode)
if ret:
- if "already exists" not in err:
- g.log.error("Failed to enable shared storage on %s", mnode)
- return False
+ g.log.error("Failed to enable shared storage on %s", mnode)
+ return False
g.log.debug("Create new group: %s on all slave nodes", group)
if not georep_groupadd(snodes, group):
@@ -218,6 +215,9 @@ def georep_create_nonroot_session(mnode, mastervol, snode, slavevol, user,
snode (str): Slave node for session creation
slavevol (str) The name of the slave volume
user (str): Specifies a user name
+ Kwargs:
+ force (bool): if master and slave are not of similar
+ size
Returns:
bool: True if geo-rep session is created successfully
Else False
@@ -225,33 +225,29 @@ def georep_create_nonroot_session(mnode, mastervol, snode, slavevol, user,
"""
g.log.debug("Create geo-rep pem keys")
- ret, out, err = georep_createpem(mnode)
+ ret, _, _ = georep_createpem(mnode)
if ret:
g.log.error("Failed to create pem keys")
- g.log.error("Error: out: %s \nerr: %s", out, err)
return False
g.log.debug("Create geo-rep session")
- ret, out, err = georep_create(mnode, mastervol, snode, slavevol,
- user, force)
+ ret, _, _ = georep_create(mnode, mastervol, snode, slavevol,
+ user, force)
if ret:
g.log.error("Failed to create geo-rep session")
- g.log.error("Error: out: %s \nerr: %s", out, err)
return False
g.log.debug("Copy geo-rep pem keys onto all slave nodes")
- ret, out, err = georep_set_pemkeys(snode, user, mastervol, slavevol)
+ ret, _, _ = georep_set_pemkeys(snode, user, mastervol, slavevol)
if ret:
g.log.error("Failed to copy geo-rep pem keys onto all slave nodes")
- g.log.error("Error: out:%s \nerr:%s", out, err)
return False
g.log.debug("Enable meta-volume")
- ret, out, err = georep_config_set(mnode, mastervol, snode, slavevol,
- "use_meta_volume", "true")
+ ret, _, _ = georep_config_set(mnode, mastervol, snode, slavevol,
+ "use_meta_volume", "true")
if ret:
g.log.error("Failed to set meta-volume")
- g.log.error("Error: out: %s \nerr: %s", out, err)
return False
return True