Description of problem: When quota_blocks at node end is less than GB an error is reported to the client when additing storage to the cartridge of an application. The error reported is not informative to the user for why the action has failed. Version-Release number of selected component (if applicable): How reproducible: always Steps to Reproduce: 1. At node end quota_blocks value is as below: grep ^quota_blocks /etc/openshift/resource_limits.conf quota_blocks=524288 2. Add storage to the cartridge of application $ rhc cartridge storage -a quotacheck -c php-5.3 --add 1GB Set storage on cartridge ... Unable to complete the requested operation due to: divided by 0 Reference ID: bb6a476e53ce6e9ff946ada05fdf7a2a 3. As seen above "divided by 0" does not indicate what has failed or is not correct. Actual results: Unable to complete the requested operation due to: divided by 0 Expected results: Unable to complete the requested operation due to: minimum storage should be in GB for quota_blocks Additional info: In broker platform logs below error is seen : 2015-02-23 07:44:43.122 [INFO ] Started PUT "/broker/rest/application/54eb1fa1e659c51926000003/cartridge/php-5.3" for 127.0.0.1 at 2015-02-23 07:44:43 -0500 (pid:2631) 2015-02-23 07:44:43.124 [INFO ] Processing by EmbCartController#update as JSON (pid:2631) 2015-02-23 07:44:43.125 [INFO ] Parameters: {"additional_gear_storage"=>1, "application_id"=>"54eb1fa1e659c51926000003", "id"=>"php-5.3"} (pid:2631) 2015-02-23 07:44:48.367 [ERROR] divided by 0 (pid:2631) 2015-02-23 07:44:48.367 [ERROR] /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5.1/app/models/gear.rb:386:in `/' /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5.1/app/models/gear.rb:386:in `set_addtl_fs_gb' /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5.1/app/pending_ops_models/set_addtl_fs_gb_op.rb:15:in `add_parallel_execute_job' The code referenced in the traceback: https://github.com/openshift/origin-server/blob/564cf61137c414de5aff30286a83de9af3124dbf/controller/app/models/gear.rb#L386 total_file_limit = (total_fs_gb * base_file_limit) / base_filesystem_gb where base_filesystem_gb comes from: https://github.com/openshift/origin-server/blob/564cf61137c414de5aff30286a83de9af3124dbf/controller/app/models/gear.rb#L63-L70 quota_blocks / 1024 / 1024 which as they mention it rounds (down) to the GiB - 0 in this case.
The issue here isn't just the error reported, but what caused the error. Because we treat quota_blocks as an integer, the base storage is returned as 0 if quota_blocks is set to anything less than 1048576. This affects other parts of openshift, such as just listing cartridge storage: # rhc cartridge-storage -a storagetest2 RESULT: Ruby 1.9 -------- Base Gear Storage: None <-- 0 base storage Additional Gear Storage: None We definitely expect to be able to add storage to gears with less than 1GB of base storage.
https://github.com/openshift/origin-server/pull/6182
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/a4b1b076947fdd3e8434411c01b13f4895b7af9e Round up if base filesystem quota is less than 1Gb Bug 1197123 https://bugzilla.redhat.com/show_bug.cgi?id=1197123 When a node profile specifies a 'quota_blocks' value less than 1Gb (1048576), round up to 1Gb rather than returning 0. This will inaccurately report base storage as 1Gb when it may be much less, but will avoid reporting that a gear has 0 base storage.
Check on puddle [2.2.7/2015-09-17.1] #rhc app create quotacheck php-5.3 #rhc cartridge storage -a quotacheck -c php-5.3 --add 1GB Set storage on cartridge ... Unable to complete the requested operation due to: divided by 0 Reference ID: f4f898807ffc31fe31192b09f164359c [root@broker ~]# rpm -qa|grep rubygem-openshift-origin-controller rubygem-openshift-origin-controller-1.36.2.3-1.el6op.noarch
Check on puddle [2.2.7/2015-09-22.1] 1. Set node quota_blocks to 524000. and restart the ruby193-mcollective service 2. create an app rhc app create quotacheck php-5.3 3. add storage to the app rhc cartridge storage -a quotacheck -c php-5.3 --add 1GB Set storage on cartridge ... set to 1GB Storage Info ------------ Base Gear Storage: 1GB Additional Gear Storage: 1GB 4. list the storage rhc cartridge-storage -a quotacheck RESULT: PHP 5.3 ------- Base Gear Storage: 1GB Additional Gear Storage: 1GB
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