summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
diff options
context:
space:
mode:
authorAkarsha <akrai@redhat.com>2018-03-15 13:20:37 +0530
committerNigel Babu <nigelb@redhat.com>2018-03-27 12:28:00 +0000
commit1c566e0bf28089727a31ada1b5d640c92c165b11 (patch)
tree2767e11e225a0d3d37a6c63928c5fa517a1bfc41 /glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
parent297c8bfbcc11ce81cb39cc5a662daf6cbee8600f (diff)
Added function to check brickmux is enabled or not
Change-Id: Ie115ecc42a38391b0e8687d7f3acf9904c18b0ee Signed-off-by: Akarsha <akrai@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/brickmux_ops.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/brickmux_ops.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py b/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
new file mode 100644
index 000000000..af72a856c
--- /dev/null
+++ b/glustolibs-gluster/glustolibs/gluster/brickmux_ops.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+ Description: Module for gluster brick multiplex operations
+"""
+
+from glusto.core import Glusto as g
+
+
+def is_brick_mux_enabled(mnode):
+ """Checks for brick multiplex operation enabled or not
+
+ Args:
+ mnode (str): Node on which cmd has to be executed.
+
+ Returns:
+ bool : True if successfully enabled brickmux. False otherwise.
+ """
+ cmd = ("gluster v get all all | grep cluster.brick-multiplex |"
+ "awk '{print $2}'")
+ ret, out, err = g.run(mnode, cmd)
+ if "enable" in out:
+ return True
+ else:
+ return False