Bug 1509888 - redhat-storage-server rpm package - improve shell coding style
Summary: redhat-storage-server rpm package - improve shell coding style
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: redhat-storage-server
Version: rhgs-3.3
Hardware: All
OS: Linux
low
low
Target Milestone: ---
: RHGS 3.4.z Batch Update 2
Assignee: Milind Changire
QA Contact: Vinayak Papnoi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-06 09:35 UTC by Damian Wojsław
Modified: 2022-03-13 14:31 UTC (History)
11 users (show)

Fixed In Version: redhat-storage-server-3.4.2.0-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-12-17 17:07:02 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3827 0 None None None 2018-12-17 17:07:17 UTC

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


Note You need to log in before you can comment on or make changes to this bug.