Bug 1509888

Summary: redhat-storage-server rpm package - improve shell coding style
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Damian Wojsław <dwojslaw>
Component: redhat-storage-serverAssignee: Milind Changire <mchangir>
Status: CLOSED ERRATA QA Contact: Vinayak Papnoi <vpapnoi>
Severity: low Docs Contact:
Priority: low    
Version: rhgs-3.3CC: amukherj, atumball, bkunal, mchangir, rhinduja, rhs-bugs, sanandpa, sankarshan, sheggodu, storage-qa-internal, vbellur
Target Milestone: ---Keywords: ZStream
Target Release: RHGS 3.4.z Batch Update 2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: redhat-storage-server-3.4.2.0-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-17 17:07:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Damian Wojsław 2017-11-06 09:35:29 UTC
Description of problem:
Red Hat IT raised concern over rpm scripting:

Iterating over ls output is fragile. Use globs.

Reference
- https://github.com/koalaman/shellcheck/wiki/SC2045

Quoting:

Please consider changing /etc/init.d/gluster-system-settings from:

#!/bin/bash
# 
# chkconfig: 35 99 12
# description: Configure sysctl settings to optimize Gluster I/O
#

for i in $(ls -d /sys/block/*/queue/iosched 2>/dev/null); do
    iosched_dir=$(echo $i | awk '/iosched/ {print $1}')
    [ -z $iosched_dir ] && {
  continue
    }
    path=$(dirname $iosched_dir)
    [ -f $path/scheduler ] && {
  echo "deadline" > $path/scheduler
    }
done

modprobe fuse;

if ! grep -q Gluster /etc/security/limits.conf ; then
    echo '* - core unlimited # added by Gluster' >> /etc/security/limits.conf
fi


to:


#!/bin/bash
#
# chkconfig: 35 99 12
# description: Configure sysctl settings to optimize Gluster I/O
#

for i in /sys/block/*/queue/iosched; do
  iosched_dir=$(echo ${i} | awk '/iosched/ {print $1}')
  [ -z ${iosched_dir} ] && {
    continue
  }
  path=$(dirname ${iosched_dir})
  [ -f ${path}/scheduler ] && {
    echo "deadline" > ${path}/scheduler
  }
done

modprobe fuse;

if ! grep -q Gluster /etc/security/limits.conf ; then
  echo '* - core unlimited # added by Gluster' >> /etc/security/limits.conf
fi

Comment 8 Bipin Kunal 2018-10-23 10:10:27 UTC
@Sunil : can we accept this for 3.4.1?

Comment 9 Bipin Kunal 2018-10-23 10:11:03 UTC
@Rahul : can we accept this for 3.4.1?

Comment 18 Vinayak Papnoi 2018-12-07 10:01:31 UTC
Build version:
redhat-storage-server-3.4.2.0-1.el6rhs.noarch (RHEL 6)
redhat-storage-server-3.4.2.0-1.el7rhgs.noarch (RHEL 7)

After successful installation of redhat-storage-server all the io-schedulers for the block devices are set to "deadline".

RHEL 6

# cat /sys/block/vdb/queue/scheduler
noop anticipatory deadline [cfq] 
# rpm -qa | grep redhat-storage-server
redhat-storage-server-3.4.2.0-1.el6rhs.noarch


RHEL 7

# cat /sys/block/vdb/queue/scheduler
[mq-deadline] kyber none
# rpm -qa | grep redhat-storage-server
redhat-storage-server-3.4.2.0-1.el7rhgs.noarch


Hence, based on comment #16 , comment #17 and the above observation, moving this bug to VERIFIED.

Comment 19 errata-xmlrpc 2018-12-17 17:07:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3827