Bug 1225943

Summary: oo-init-quota function get_filesystem_type pulls in commented lines in fstab if same mount point
Product: OpenShift Container Platform Reporter: Ryan Howe <rhowe>
Component: ContainersAssignee: Timothy Williams <tiwillia>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.2.0CC: adellape, anli, jialiu, jokerman, libra-onpremise-devel, mmccomas, tiwillia
Target Milestone: ---Keywords: NeedsTestCase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-node-util-1.37.2.1-1.el6op Doc Type: Bug Fix
Doc Text:
The `grep` method in which entries are pulled from the /etc/fstab file in the `oo-init-quota` command previously did not ignore commented lines. This could result in an error where the quota failed to initialize due to duplicate entries when a commented entry included the same file system mount as an un-commented entry. This bug fix updates the `grep` commands used in `oo-init-quota` to now ignore lines beginning with a '#' symbol. As a result, `oo-init-quota` now successfully initializes quotas on systems where a commented entry for the same file system where OpenShift gears will be stored exists.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-30 16:37:40 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 Ryan Howe 2015-05-28 14:01:28 UTC
Description of problem:

-Bug with the oo-init-quota with node module.
While installing, it fails at the 'Initialize quota DB' stage if there is more than one pattern containing of the same file system mount point in /etc/fstab, one being commented.

This is due to the script : 
https://github.com/openshift/origin-server/blob/master/node-util/sbin/oo-init-quota#L52

# find the filesystem type above a given file or directory
function get_filesystem_type() {
    egrep "\s+$1\s+" /etc/fstab | awk '{ print $3 }'
}


It should exclude commented-out lines in /etc/fstab

Later on, the script evaluate the result of print $3, and compare it to 'ext4'

https://github.com/openshift/origin-server/blob/master/node-util/sbin/oo-init-quota#L104


Version-Release number of selected component (if applicable):v2.2


How reproducible:
Have more than one pattern containing /var/lib/openshift in /etc/fstab and go through puppet install on node module. 

Steps to Reproduce:
1.Copy line line in fstab and comment it out 
2.Use oo-init-quota /mount/point
3.If you have multiple entries it will fail because it includes the commented out line

Actual results:
Error:
oo-init-quota only supports ext4 filesystems. You will need to setup user quotas for the 'ext4 ext4' filesystem.

Expected results:
No Error

Additional info:

Comment 2 Timothy Williams 2015-06-01 13:59:47 UTC
https://github.com/openshift/origin-server/pull/6155

Comment 3 openshift-github-bot 2015-06-09 19:48:35 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/807b9c94115f89a36da485a04963c3afd0432253
oo-init-quota: Ignore commented lines in /etc/fstab

Bug 1225943
Bugzilla Link https://bugzilla.redhat.com/show_bug.cgi?id=1225943

Comment 7 Anping Li 2015-08-20 08:45:58 UTC
QA can reproduce this issue. Now waiting new puddle to verify it.

Comment 10 Johnny Liu 2015-09-22 06:47:55 UTC
Verified this bug with 2.2/2015-09-21.1, PASS.


Reproduce this bug with old version - openshift-origin-node-util-1.35.1.1-1.el6op.noarch:
# /usr/sbin/oo-init-quota
oo-init-quota only supports ext4 filesystems. You will need to setup user quotas for the 'ext4
ext4' filesystem.


Fix in new version - openshift-origin-node-util-1.37.2.1-1.el6op.noarch:
# /usr/sbin/oo-init-quota
/dev/mapper/vg_dhcp128178-lv_root / ext4 defaults,usrquota,usrjquota=aquota.user,jqfmt=vfsv0 1 1
mount: / not mounted already, or bad option
chmod: changing permissions of `/aquota.user': Operation not permitted
quotaon: using //aquota.user on /dev/mapper/vg_dhcp128178-lv_root [/]: Device or resource busy

Comment 12 errata-xmlrpc 2015-09-30 16:37:40 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://rhn.redhat.com/errata/RHSA-2015-1844.html