Skip to content

Commit

Permalink
Use env. variable GLUSTER_BLOCK_ENABLED to enable/disable gluster-blo…
Browse files Browse the repository at this point in the history
…ck service.

Enable gluster-block services if GLUSTER_BLOCK_ENABLED is "1" and
disable otherwise.

By default, GLUSTER_BLOCK_ENABLED is set as "1".

Updates: #120
Signed-off-by: Saravanakumar Arumugam <[email protected]>
[Niels de Vos: replace TRUE with "1", update README]
  • Loading branch information
SaravanaStorageNetwork authored and nixpanic committed Jan 15, 2019
1 parent f5409d9 commit 9b1aeba
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
2 changes: 0 additions & 2 deletions CentOS/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ systemctl disable nfs-server.service && \
systemctl mask getty.target && \
systemctl enable gluster-fake-disk.service && \
systemctl enable gluster-setup.service && \
systemctl enable gluster-block-setup.service && \
systemctl enable gluster-blockd.service && \
systemctl enable glusterd.service && \
systemctl enable gluster-check-diskspace.service

Expand Down
9 changes: 9 additions & 0 deletions CentOS/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
This dockerfile can be used to build a CentOS Gluster Container.

# Enabling/Disabling gluster-block

Gluster Block is an optional service that can be used to provide
PersistentVolumes of type=Block. Not everyone needs this functionality, and on
some distributions the dependencies (in the kernel) might be missing. It is
possible to disable the Gluster Block service by exporting the
`GLUSTER_BLOCK_ENABLED` environment variable set to `"0"`. By default the
environment variable will be set to `"1"` so that the service is enabled.

# Support for fake disks

This container offers several configuration options that make it easier to test
Expand Down
24 changes: 17 additions & 7 deletions CentOS/update-params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@
: ${GB_LOGDIR:=/var/log/glusterfs/gluster-block}
: ${TCMU_LOGDIR:=/var/log/glusterfs/gluster-block}
: ${GB_GLFS_LRU_COUNT:=15}
: ${GLUSTER_BLOCK_ENABLED:=1}
: ${HOST_DEV_DIR:=/mnt/host-dev}

echo "env variable is set. Update in gluster-blockd.service"
#FIXME To update in environment file
sed -i '/GB_GLFS_LRU_COUNT=/s/GB_GLFS_LRU_COUNT=.*/'GB_GLFS_LRU_COUNT="$GB_GLFS_LRU_COUNT"\"'/' /usr/lib/systemd/system/gluster-blockd.service
sed -i '/EnvironmentFile/i Environment="GB_LOGDIR='$GB_LOGDIR'"' /usr/lib/systemd/system/gluster-blockd.service
if [ "$GLUSTER_BLOCK_ENABLED" == 1 ]; then
echo "Enabling gluster-block service and updating env. variables"
systemctl enable gluster-block-setup.service
systemctl enable gluster-blockd.service

sed -i "s#TCMU_LOGDIR=.*#TCMU_LOGDIR='$TCMU_LOGDIR'#g" /etc/sysconfig/tcmu-runner-params
#FIXME To update in environment file
sed -i '/GB_GLFS_LRU_COUNT=/s/GB_GLFS_LRU_COUNT=.*/'GB_GLFS_LRU_COUNT="$GB_GLFS_LRU_COUNT"\"'/' /usr/lib/systemd/system/gluster-blockd.service
sed -i '/EnvironmentFile/i Environment="GB_LOGDIR='$GB_LOGDIR'"' /usr/lib/systemd/system/gluster-blockd.service

sed -i '/ExecStart/i EnvironmentFile=-/etc/sysconfig/tcmu-runner-params' /usr/lib/systemd/system/tcmu-runner.service
sed -i '/tcmu-log-dir=/s/tcmu-log-dir.*/tcmu-log-dir $TCMU_LOGDIR/' /usr/lib/systemd/system/tcmu-runner.service
sed -i "s#TCMU_LOGDIR=.*#TCMU_LOGDIR='$TCMU_LOGDIR'#g" /etc/sysconfig/tcmu-runner-params

sed -i '/ExecStart/i EnvironmentFile=-/etc/sysconfig/tcmu-runner-params' /usr/lib/systemd/system/tcmu-runner.service
sed -i '/tcmu-log-dir=/s/tcmu-log-dir.*/tcmu-log-dir $TCMU_LOGDIR/' /usr/lib/systemd/system/tcmu-runner.service
else
echo "Disabling gluster-block service"
systemctl disable gluster-block-setup.service
systemctl disable gluster-blockd.service
fi

if [ -c "${HOST_DEV_DIR}/zero" ] && [ -c "${HOST_DEV_DIR}/null" ]; then
# looks like an alternate "host dev" has been provided
Expand Down

0 comments on commit 9b1aeba

Please sign in to comment.