Bug 869951 - Rest api returns incorrect gear limit when app tries to scale beyond maximum gear range
Summary: Rest api returns incorrect gear limit when app tries to scale beyond maximum ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Master
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Rajat Chopra
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-25 08:24 UTC by Jianwei Hou
Modified: 2015-05-15 00:52 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-06 18:50:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
scaling info (5.22 KB, text/x-log)
2012-10-25 08:24 UTC, Jianwei Hou
no flags Details

Description Jianwei Hou 2012-10-25 08:24:13 UTC
Created attachment 633221 [details]
scaling info

Description of problem:
Rest api will return incorrect gear limit when user try to scale up this app beyond the maximum gear range

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

How reproducible:
Always

Steps to Reproduce:
1. Create a scalable app, set scales_from=3/scales_to=4 for this app via rest api
rhc app create es jbosseap-6.0 -s
curl -k --user $user:$passwd https://ec2-184-73-34-227.compute-1.amazonaws.com/broker/rest/domains/2378t/applications/es/cartridges/jbosseap-6.0.json -X PUT -d "scales_from=3" -d "scales_to=4"

2. Call rest api to scale up this app twice
curl -k -H 'Accept: application/xml' --user $user:$passwd https://ec2-184-73-34-227.compute-1.amazonaws.com/broker/rest/domains/2378t/applications/es/events -X POST -d event=scale-up

3. Try to scale up this app beyond maximum gear limit

Actual results:
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <message>
      <field nil="true"></field>
      <text>Cannot scale up beyond maximum gear limit '3' in app es.</text>
      <severity>error</severity>
      <exit-code>104</exit-code>
    </message>
  </messages>
  <data>
    <datum nil="true"></datum>
  </data>
  <version>1.2</version>
  <status>unprocessable_entity</status>
  <type nil="true"></type>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
  </supported-api-versions>
</response>

My maximum gear limit is 4, but rest api returns 3

Expected results:
Returned message should be like:
<text>Cannot scale up beyond maximum gear limit '4' in app es.</text>

Additional info:
Attachment is my current scaling info

Comment 1 Rajat Chopra 2012-10-25 20:11:17 UTC
Fix upshot - The messaging is being changed not to tell the gear limit in number. The new message will look like :
<text>Cannot scale up beyond maximum gear limit in app es</text>

Fix explanation -
What the REST call is returning is the maximum gear limit of the gear_group that the application's framework cartridge belongs to. The total limit is '1' more because of the component that resides in the haproxy group.
Now it may be easy to ask that we report the max gear limit as the total of all groups for the framework cartridge, but the reason I would suggest refraining from reporting that is that scale_up today scales the 'web' group and not the 'framework' cartridge. 
We should not hardcode the return message with framework cartridge's limits, because another cartridge collocating with the 'web' group will confuse the matter.

Fix tracker - https://github.com/openshift/origin-server/pull/760 rev#77cba70

Comment 2 Wei Sun 2012-10-26 03:46:48 UTC
Test this bug on devenv_2384, it's not pulled on devenv_2384.
Follow this :  https://github.com/openshift/origin-server/pull/760 ,change some code,find this bug is fixed.Will verify it  after having new devenv.

Result:
[sunwei@dhcp-8-229 es]$ curl -k -H 'Accept: application/xml' --user wsun:redhat https://ec2-50-17-161-147.compute-1.amazonaws.com/broker/rest/domains/wsundevb26/applications/es/events -X POST -d event=scale-up
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
  </supported-api-versions>
  <status>unprocessable_entity</status>
  <version>1.2</version>
  <data>
    <datum nil="true"></datum>
  </data>
  <type nil="true"></type>
  <messages>
    <message>
      <severity>error</severity>
      <text>Cannot scale up beyond maximum gear limit in app es.</text>
      <exit-code>104</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
</response>

Comment 3 Wei Sun 2012-10-26 06:56:53 UTC
verified on devenv_2385

Steps:
1. Create a scalable app, set scales_from=3/scales_to=4 for this app via rest api

2. Call rest api to scale up this app twice

3. Try to scale up this app beyond maximum gear limit

Result:
[sunwei@dhcp-8-229 eapscaletest]$ curl -k --user wsun:redhat https://ec2-54-242-145-85.compute-1.amazonaws.com/broker/rest/domains/wsundev26/applications/eapscaletest/events -X POST -d event=scale-up|python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   261    0   247  100    14    193     10  0:00:01  0:00:01 --:--:--   249
{
    "data": null, 
    "messages": [
        {
            "exit_code": 104, 
            "field": null, 
            "severity": "error", 
            "text": "Cannot scale up beyond maximum gear limit in app eapscaletest."
        }
    ], 
    "status": "unprocessable_entity", 
    "supported_api_versions": [
        1.0, 
        1.1, 
        1.2
    ], 
    "type": null, 
    "version": "1.2"
}


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