Bug 980708 - [origin_broker#7]Should report reasonable error when the user do not have sufficient capacity to the default gear size
[origin_broker#7]Should report reasonable error when the user do not have suf...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Pod (Show other bugs)
2.x
All All
medium Severity medium
: ---
: ---
Assigned To: Ravi Sankar
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-03 01:38 EDT by zhaozhanqi
Modified: 2015-05-14 20:18 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-22 11:20:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description zhaozhanqi 2013-07-03 01:38:15 EDT
Description of problem:

Given a user has small gear size by default, and "DEFAULT_GEAR_SIZE" is updated to 'medium' on node, when create app without option "-g medium", it will be successfull and the app's gear size is 'medium'. When create app with '-g medium' it will fail and report "Invalid size: medium. Acceptable values are: small"


Version-Release number of selected component (if applicable):
devenv_3439

How reproducible:
always

Steps to Reproduce:
1. the user only support small gear
2. change DEFAULT_GEAR_SIZE="medium"
3. create one app without option -g medium
    rhc app create zqmedium php-5.3 
    rhc app show zqmedium
4. create another app with option -g medium
    rhc app create zqphp2 php-5.3 -g medium

Actual results:
step 3. app can be created successfully
zqmedium @ http://zqmedium-zqd.dev.rhcloud.com/ (uuid: 51d38c0f043d4c5d86000001)
  --------------------------------------------------------------------------------
    Created: Jul 02 10:27 PM
    Gears:   1 (defaults to medium)
    Git URL: ssh://51d38c0f043d4c5d86000001@zqmedium-zqd.dev.rhcloud.com/~/git/zqmedium.git/
    SSH:     51d38c0f043d4c5d86000001@zqmedium-zqd.dev.rhcloud.com

    php-5.3 (PHP 5.3)
    -----------------
      Gears: 1 medium


step 4. will report "Invalid size: medium. Acceptable values are: small"

Expected results:
step 3, should report "Invalid size: medium. Acceptable values are: small"

Additional info:
Comment 1 Ravi Sankar 2013-07-04 22:37:54 EDT
Fixed in https://github.com/openshift/li/pull/1702 , https://github.com/openshift/origin-server/pull/2991
In step-2: when DEFAULT_GEAR_SIZE is changed, we need to make sure the new default gear size is present in DEFAULT_GEAR_CAPABILITIES.

Steps to test failure case:
1. change DEFAULT_GEAR_SIZE="medium"
2. clear cache and restart broker/site service
3. create user => will get default gear capabilities as "small" (from DEFAULT_GEAR_CAPABILITIES)
4. create one app without option -g medium
    rhc app create zqmedium php-5.3  => This should fail with error "Invalid size: medium. Acceptable values are: small"
5. create another app with option -g medium
    rhc app create zqphp2 php-5.3 -g medium => This should fail with error "Invalid size: medium. Acceptable values are: small"

Steps to test success case:
1. change DEFAULT_GEAR_SIZE="medium" and DEFAULT_GEAR_CAPABILITIES="medium" or "small,medium"
2. clear cache and restart broker/site service
3. create user => will get default gear capabilities as "medium"/"small,medium" (from DEFAULT_GEAR_CAPABILITIES)
4. create one app without option -g medium
    rhc app create zqmedium php-5.3  => This should succeed.
5. create another app with option -g medium
    rhc app create zqphp2 php-5.3 -g medium => This should succeed.
Comment 2 openshift-github-bot 2013-07-04 23:21:13 EDT
Commits pushed to master at https://github.com/openshift/li

https://github.com/openshift/li/commit/af8a5df504c814192af32c01902707178b230edc
Bug 980708 - Add DEFAULT_GEAR_CAPABILITIES field to broker-dev.conf

https://github.com/openshift/li/commit/f0c75e0dd0fbf76898beecb31f3177308d478109
Merge pull request #1702 from pravisankar/dev/ravi/bug980708

Merged by openshift-bot
Comment 3 zhaozhanqi 2013-07-05 03:36:39 EDT
Tested this bug on devenv_3450. According to comment 1, the bug has not been fixed.

 Tested the following steps,it cannot create 'medium' gear app. In step 3, the new user's Allowed Gear Sizes is small.

Steps to test success case:
1. change DEFAULT_GEAR_SIZE="medium" and DEFAULT_GEAR_CAPABILITIES="medium" or "small,medium"
2. clear cache and restart broker/site service
3. create user => will get default gear capabilities as "medium"/"small,medium" (from DEFAULT_GEAR_CAPABILITIES)
4. create one app without option -g medium
    rhc app create zqmedium php-5.3  => This should succeed.
5. create another app with option -g medium
    rhc app create zqphp2 php-5.3 -g medium => This should succeed.

the result:
  rhc app create zqphp php-5.3 
Application Options
-------------------
  Namespace:  zqd2
  Cartridges: php-5.3
  Gear Size:  default
  Scaling:    no

Creating application 'zqphp' ... Invalid size: medium. Acceptable values are: small


[zqzhao@dhcp-13-222 ~]$ rhc account
Server:                     ec2-54-242-253-230.compute-1.amazonaws.com
Login:                      zhao+2@redhat.com
Plan:                       Free
Gears Used:                 0
Gears Allowed:              3
Allowed Gear Sizes:         small
SSL Certificates Supported: no
Comment 4 Ravi Sankar 2013-07-05 17:08:56 EDT
Steps provided in comment# 2 for testing success case is valid only on openshift origin.
To test this on openshift online(like devenv),
Step-1 need to be modified:
=> change DEFAULT_GEAR_SIZE="medium" and 
   edit '/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-billing-aria-1.9.2/config/initializers/openshift-origin-billing-aria.rb' 
   (Note: If there are any new changes to openshift-origin-billing-aria package, file name will have different version /opt/.../openshift-origin-billing-aria-1.9.X/...)
    :plans => {
      :free => {
        :capabilities => {
          'gear_sizes' => ["medium"], # or ["small", "medium"]   <== Changes
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   Rationale: User default capabilities are governed by their plan in openshift online and online user is by default enrolled into 'free' plan.
Comment 5 zhaozhanqi 2013-07-07 23:09:02 EDT
Tested this on Devenv_3456

 1.change DEFAULT_GEAR_SIZE="medium"
 2.modify openshift-origin-billing-aria.rb 
   'gear_sizes' => ["medium"

 3.register one account
 


[zqzhao@dhcp-13-222 myshell]$ rhc account
Server:                     ec2-23-20-44-151.compute-1.amazonaws.com
Login:                      zzhao@redhat.com
Plan:                       Free
Gears Used:                 0
Gears Allowed:              3
Allowed Gear Sizes:         medium
SSL Certificates Supported: no

can create medium app successfully.
Comment 6 openshift-github-bot 2013-07-08 19:14:02 EDT
Commit pushed to master at https://github.com/openshift/li

https://github.com/openshift/li/commit/b02afb8d4ac8fe8a7fad33da3851035f60249de9
Bug 980708 - Add DEFAULT_GEAR_CAPABILITIES field to broker-dev.conf

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