Description of problem: When a user runs "rhc app show <appname> --gear quota" and then ssh into the application and run quota -s, different results will be shown. rhc app show devcenter2 --gear quota Gear Cartridges Used Limit ------------------------ -------------------- ------ ----- 53970fda5973ca16040001c9 haproxy-1.4 ruby-1.9 189 MB 1 GB ➜ ~ rhc ssh devcenter2 Connecting to 53970fda5973ca16040001c9.com ... ********************************************************************* You are accessing a service that is for use only by authorized users. If you do not have authorization, discontinue use at once. Any use of the services is subject to the applicable terms of the agreement which can be found at: https://www.openshift.com/legal ********************************************************************* Welcome to OpenShift shell This shell will assist you in managing OpenShift applications. !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!! Shell access is quite powerful and it is possible for you to accidentally damage your application. Proceed with care! If worse comes to worst, destroy your application with "rhc app delete" and recreate it !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!! Type "help" for more info. *** This gear has been temporarily unidled. To keep it active, access *** your app @ http://devcenter2-niharvey.rhcloud.com/ [devcenter2-niharvey.rhcloud.com 53970fda5973ca16040001c9]\> quota -s Disk quotas for user 53970fda5973ca16040001c9 (uid 4640): Filesystem blocks quota limit grace files quota limit grace /dev/mapper/EBSStore01-user_home01 180M 0 1024M 14646 0 80000 Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. rhc app show <Appname> --gear quota 2. ssh into app 3. run quota -s 4. compare results Actual results: amount of reported space used will be different. Expected results: Additional info: Looks like this might be a dup of 992942, however this one is closed. Also, my rhc version is 1.25.3
Its divide by 1024 vs 1000 error. in this line : https://github.com/openshift/rhc/blob/master/lib/rhc/helpers.rb#L46 in function human_size(), called from https://github.com/openshift/rhc/blob/master/lib/rhc/commands/app.rb#L397 If the code has to use 'PREFIX = %W(TB GB MB KB B).freeze' on L38, then L46 should be definitely be fixed.
Will merge in https://github.com/openshift/rhc/pull/605
Actually, after looking at it more, I think we'll cantfix this. Some remote systems divide by 1000 for 'quota -s', some divide by 1024. Whichever we pick, we'll be inconsistent some of the time. RHC will divide by 1000 for both quota and usage.
(In reply to Rajat Chopra from comment #1) > Its divide by 1024 vs 1000 error. > > in this line : > https://github.com/openshift/rhc/blob/master/lib/rhc/helpers.rb#L46 > in function human_size(), > called from > https://github.com/openshift/rhc/blob/master/lib/rhc/commands/app.rb#L397 > > If the code has to use 'PREFIX = %W(TB GB MB KB B).freeze' on L38, then L46 > should be definitely be fixed. Hi, I'm the one who filed the bug initially (via e-mail). I should have made it perhaps a bit more clear. This is not (necessarily) a division error. My "rhc app show PHP --gear quota" shows 325 MB is in use 1 GB, yet "rhc app tidy <gearname>" shows I'm above 90% of quota. At the same time "quota -s" shows 927M out of 1024M but "du -ms ." issued from home directory gives 311, which (along with 325 above) is consistent with what I use. Honestly I don't care too much of the minor Mb/Gb rounding issues, but the gear just fails when I get supposedly over quota, which in fact is not true.
Gotcha, thanks for the additional info. Reopening to look into the big difference between "du -sh" and "quota -s" run on the gear itself.
Can you provide the login, app, and gear id you are seeing the discrepancy on?
$(rhc quota) needs to use unix quota command not du, to meet expected results.
Whatever's been done (if anything) - it worked. quota -s correctly shows the amount of used space and that's almost consistent with rhc app show <gearname> --gear quota and with du comamnd. 'almost consistent' - being quota -s shows 297M, (at least not 950M as before), whereas rhc app show <gearname> --gear quota shows 327 MB. du -ms comes second - 313M :)
Sure enough, it did not last. While rhc shows: Gear Cartridges Used Limit ----- --------------------------------------- ------ ----- ***** php-5.3 mysql-5.1 phpmyadmin-4 cron-1.4 389 MB 1 GB quota -s shows: Filesystem blocks quota limit grace files quota limit grace /dev/mapper/EBSStore01-user_home01 581M 0 1024M 4040 0 80000
RHC is measuring usage of accessible files in the home directory, which is not the same as what the quota tool looks at. Will re-raise to ops team to check.
hi, got same issue. Seems like a year after but still unresolved?
can someone explain definition "which is not the same as what the quota tool looks at" To where it looks at if not to the physical file usage? see my results: [diy-exch.rhcloud.com 55e3779b89f5cf236f000081]\> quota -w|egrep -v '(quotas|Filesystem)'|awk -F ' ' '{ print $2}' 538652 [diy-exch.rhcloud.com 55e3779b89f5cf236f000081]\> du -sh du: cannot read directory `./.tmp': Permission denied du: cannot read directory `./.sandbox': Permission denied du: cannot read directory `./.ssh': Permission denied 527M . M:>rhc show-app diy --gears quota Gear Cartridges Used Limit ------------------------ ---------------------------------------------------- ------ ----- 55e3779b89f5cf236f000081 diy-0.1 cron-1.4 mongodb-2.4 mmahut-quotamonitor-1.0 0.6 GB 1 GB When My app works about 10 hours quota show that I am out of space and in the same time physically I am using around half of quota size
Indeed, it is confusing that we use 'du' instead of 'quota' here: https://github.com/openshift/rhc/blob/master/lib/rhc/commands/app.rb#L428 One source of confusion: 'quota' cmd includes usage from files that have been deleted but their data blocks are still being held by some process in the gear... so in fact, quota gives a more accurate view of usage. I am formulating a PR to replace 'du' with 'quota' to give more accurate quota info. In the meantime, this command will give you the 'quota' info you need: rhc ssh app --gears quota If the usage is more than you expect (if it varies from du), try re-starting your app and running it again to see if that clears some ghost data blocks.
*** Bug 1273140 has been marked as a duplicate of this bug. ***
Commit pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/3499f13889650461874451e4128f8ceac4e06d5a 'rhc app show <app> --gears quota' use 'quota' not 'du' Bug 1109935 Bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1109935 Users expect 'rhc app show <app> --gears quota' to display output of the system 'quota' cmd. Currently, the rhc cmd uses 'du -s'. This PR replaces 'du' with 'quota'
Verified this bug with > rhc --version rhc 1.38.4 Result: # rhc app-show phptest --gears quota Gear Cartridges Used Limit ------------------------ ---------- ---- ----- 56aefbc2db11e4c989000009 php-5.3 1 MB 1 GB # rhc ssh phptest Connecting to 56aefbc2db11e4c989000009.rhcloud.com ... ********************************************************************* You are accessing a service that is for use only by authorized users. If you do not have authorization, discontinue use at once. Any use of the services is subject to the applicable terms of the agreement which can be found at: https://www.openshift.com/legal ********************************************************************* Welcome to OpenShift shell This shell will assist you in managing OpenShift applications. !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!! Shell access is quite powerful and it is possible for you to accidentally damage your application. Proceed with care! If worse comes to worst, destroy your application with "rhc app delete" and recreate it !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!! Type "help" for more info. [phptest-wsundev.dev.rhcloud.com 56aefbc2db11e4c989000009]\> quota -s Disk quotas for user 56aefbc2db11e4c989000009 (uid 1000): Filesystem blocks quota limit grace files quota limit grace /dev/xvda1 1016 0 1024M 224 0 80000
The rhc is using size from quota. so move bug to verified. [sphp-anlidom.ose22-auto.com.cn /]\> du -sh <---snip----> <---snip----> 3.6G . [sphp-anlidom.ose22-auto.com.cn /]\> quota -s Disk quotas for user anlidom-sphp-1 (uid 1068): Filesystem blocks quota limit grace files quota limit grace /dev/loop0 1504 0 1024M 324 0 80000 [sphp-anlidom.ose22-auto.com.cn /]\> exit exit Connection to sphp-anlidom.ose22-auto.com.cn closed. [anli@broker ~]$ rhc app show sphp --gear quota Gear Cartridges Used Limit -------------- ------------------- ------ ----- anlidom-sphp-1 haproxy-1.4 php-5.3 1.5 MB 1 GB
We apologize, however, we do not plan to address this report at this time. The majority of our active development is for the v3 version of OpenShift. If you would like for Red Hat to reconsider this decision, please reach out to your support representative. We are very sorry for any inconvenience this may cause.