Bug 869226

Summary: Got error when add cartridge to scalable app or scale it up after setting its min gear size to "16".
Product: OKD Reporter: Mengjiao Gao <mgao>
Component: MasterAssignee: Rajat Chopra <rchopra>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: rchopra, szhou, yujzhang
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-06 18:49:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The error page when add cartridge in step 5.
none
error page when add cartridges in step 6.
none
The app detail page after step 6. none

Description Mengjiao Gao 2012-10-23 10:27:14 UTC
Created attachment 632017 [details]
The error page when add cartridge in step 5.

Description of problem:
If I created a scalable app, and directely changed its min gear size as 16, I would get error when I tried to add cartridge to it or scaled up it.

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

How reproducible:
always

Steps to Reproduce:
1.Go to website and login.
2.Update the account to MegaShift
3.Created a scalable app used CLI :
   $rhc app create -s -a s490 -t php-5.3 -p redhat -l mgao+dev22 -p redhat
4.Set its minimum gear size as 16.
5.Try to add cartridge to it.
6.Try to add cartridge again.
6.Try to scale up it use REST API:
    curl -k -X POST -H 'Accept: application/xml' -d event=scale-up --user mgao+dev22:redhat https://ec2-107-22-93-180.compute-1.amazonaws.com/broker/rest/domains/do1122/applications/s490/events


Actual results:
Error page in step 5 is shown as attachment #1 [details], and cartridges cannot be added successfully.
In Step 6, the cartridge still cannot added, but the error message said that:"You have reached the maximum allowed gears and cannot create another. You must scale down an application or remove an application or cartridge to continue." as attachment #2 [details] shown.
But I have checked the app detail page, the gear number in this page shown is "2" as attachment #3 [details] shown . 
Error message in step 7 as below:
**********************************************************************
  <messages>
    <message>
      <exit-code>104</exit-code>
      <severity>error</severity>
      <field nil="true"></field>
      <text>mgao+dev22 has a gear limit of 16 and this app requires 13 more gears. Check the 'scales_from' limit of all cartridges of the app?</text>
    </message>
  </messages>
**********************************************************************


Expected results:
The cartridge should added successfully in step 5, and with this operation, the gear number of the app should be "16".

Additional info:
I think we should change a little in the scale your app page.User should not set the min gear size bigger than the app's real gear number.
Or when user set its min gear size bigger than the app's real gear number, the broker should scale up the app automaticly.

Comment 1 Mengjiao Gao 2012-10-23 10:29:08 UTC
Created attachment 632018 [details]
error page when add cartridges in step 6.

Comment 2 Mengjiao Gao 2012-10-23 10:30:02 UTC
Created attachment 632019 [details]
The app detail page after step 6.

Comment 3 Rajat Chopra 2012-10-29 16:53:08 UTC
Fixed with rev#9232307bf7cd12783692552d3aad33ae2c023d84

Comment 4 Rajat Chopra 2012-10-29 16:56:22 UTC
Yes, we want to have the broker scale up the app automatically, but that is not done yet and will be part of some user story in the future.

As of this fix, an appropriate message will guide the user about whats going on with gear additions and limits.

Comment 5 Mengjiao Gao 2012-10-30 06:17:10 UTC
Tested this issue on devenv_2403.
    Firstly, I set a scalable app's min gear size bigger than its available gear number. 
    Then I tried to add cartridge to the app, and I would get error message as this :"You have reached the maximum allowed gears and cannot create another. You must scale down an application or remove an application or cartridge to continue.".
    And when I tried to scale up it with RESTAPI, I will get message as below:
"
  <messages>
    <message>
      <text>rr has a gear limit of 19 and this app requires 3 more gears. Check the 'scales_from' limit of all cartridges of the app?</text>
      <field nil="true"></field>
      <severity>error</severity>
      <exit-code>104</exit-code>
    </message>
  </messages>
"

Since I think this are appropriate messages for user, so  I will put this issue to verified. Looking forward your later improvement to scale up the app automatically, thanks!