From 5588a0f2448cb855fb8df8cba772dc548c9770d3 Mon Sep 17 00:00:00 2001 From: "Jose A. Rivera" Date: Fri, 1 Sep 2017 16:59:04 -0500 Subject: Bring Fedora image up to date. Signed-off-by: Jose A. Rivera --- Fedora/gluster-brickmultiplex.sh | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Fedora/gluster-brickmultiplex.sh (limited to 'Fedora/gluster-brickmultiplex.sh') diff --git a/Fedora/gluster-brickmultiplex.sh b/Fedora/gluster-brickmultiplex.sh new file mode 100644 index 0000000..968a3e2 --- /dev/null +++ b/Fedora/gluster-brickmultiplex.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +### +# Description: Script to enable brick multiplexing in gluster. +# Copyright (c) 2017 Red Hat, Inc. +# +# This file is part of GlusterFS. +# +# This file is licensed to you under your choice of the GNU Lesser +# General Public License, version 3 or any later version (LGPLv3 or +# later), or the GNU General Public License, version 2 (GPLv2), in all +# cases as published by the Free Software Foundation. +### + +main () { + GLUSTERFS_CONF_DIR="/etc/glusterfs" + GLUSTERFS_LOG_DIR="/var/log/glusterfs" + GLUSTERFS_META_DIR="/var/lib/glusterd" + GLUSTERFS_LOG_CONT_DIR="/var/log/glusterfs/container" + GLUSTERFS_CUSTOM_FSTAB="/var/lib/heketi/fstab" + + GLUSTER_BRICKMULTIPLEX=${GLUSTER_BRICKMULTIPLEX-yes} + + case "$GLUSTER_BRICKMULTIPLEX" in + [nN] | [nN][Oo] ) + gluster v info | grep 'cluster.brick-multiplex: off' > $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + if [[ ${?} == 0 ]]; then + echo "cluster brick-multiplexing already disabled." >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + exit 0 + fi + + gluster --mode=script volume set all cluster.brick-multiplex off >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + if [[ ${?} != 0 ]]; then + echo "cluster brick-multiplexing set failed." >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + exit 1 + fi + + systemctl restart glusterd + if [[ ${?} != 0 ]]; then + echo "Restarting glusterd failed." >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + exit 1 + fi + + echo "Brick Multiplexing Successfully Disabled" + exit 0 + ;; + [yY] | [yY][Ee][Ss] ) + gluster v info | grep 'cluster.brick-multiplex: on' > $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + if [[ ${?} == 0 ]]; then + echo "cluster brick-multiplexing already set." >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + exit 0 + fi + + gluster --mode=script volume set all cluster.brick-multiplex on >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + if [[ ${?} != 0 ]]; then + echo "cluster brick-multiplexing set failed." >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + exit 1 + fi + + systemctl restart glusterd + if [[ ${?} != 0 ]]; then + echo "Restarting glusterd failed." >> $GLUSTERFS_LOG_CONT_DIR/brickmultiplexing + exit 1 + fi + + echo "Brick Multiplexing Successfully Enabled" + exit 0 + ;; + *) echo "Invalid input" + ;; + esac +} + +main -- cgit v1.2.3