Bug 980708 - [origin_broker#7]Should report reasonable error when the user do not have sufficient capacity to the default gear size
Summary: [origin_broker#7]Should report reasonable error when the user do not have suf...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
Version: 2.x
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: Ravi Sankar
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-03 05:38 UTC by zhaozhanqi
Modified: 2015-05-15 00:18 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-22 15:20:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description zhaozhanqi 2013-07-03 05:38:15 UTC
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.rhcloud.com/~/git/zqmedium.git/
    SSH:     51d38c0f043d4c5d86000001.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-05 02:37:54 UTC
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-05 03:21:13 UTC
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 07:36:39 UTC
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
Plan:                       Free
Gears Used:                 0
Gears Allowed:              3
Allowed Gear Sizes:         small
SSL Certificates Supported: no

Comment 4 Ravi Sankar 2013-07-05 21:08:56 UTC
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-08 03:09:02 UTC
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
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 23:14:02 UTC
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.