Bug 1197123 - Error reported while adding storage to gear should be informative to the user
Summary: Error reported while adding storage to gear should be informative to the user
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Timothy Williams
QA Contact: Ma xiaoqiang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-27 14:37 UTC by Jaspreet Kaur
Modified: 2019-08-15 04:18 UTC (History)
8 users (show)

Fixed In Version: rubygem-openshift-origin-controller-1.37.3.1-1.el6op
Doc Type: Bug Fix
Doc Text:
When the base gear file storage limits (quota_blocks) were less than 1048576, converting this value to gigabytes previously returned 0. Calculating the total file limit from every gear in the application included dividing by the base gear file storage limits in GB, which when 0 caused a "divide by 0" error to be returned. This bug fix updates the behavior to round up all base gear file storage (quota_blocks) values to 1GB if they are less than 1GB. As a result, the base total file storage limit for an application can now be reported without error when storage limits are less than 1048576. Note that because we round up when the quota_blocks value is less than 1048576, storage values may be inaccurate for some applications.
Clone Of:
Environment:
Last Closed: 2015-09-30 16:36:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:1844 0 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 2.2.7 security, bug fix and enhancement update 2015-09-30 20:35:28 UTC

Description Jaspreet Kaur 2015-02-27 14:37:03 UTC
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.

Comment 1 Timothy Williams 2015-06-23 14:36:44 UTC
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.

Comment 2 Timothy Williams 2015-06-26 17:07:57 UTC
https://github.com/openshift/origin-server/pull/6182

Comment 3 openshift-github-bot 2015-07-13 23:55:25 UTC
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.

Comment 11 Ma xiaoqiang 2015-09-18 06:26:10 UTC
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

Comment 13 Ma xiaoqiang 2015-09-23 02:09:33 UTC
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

Comment 15 errata-xmlrpc 2015-09-30 16:36:33 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


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