Bug 1122935

Summary: Scale-down picks up incorrect gear in HA apps
Product: OpenShift Container Platform Reporter: Brenton Leanhardt <bleanhar>
Component: NodeAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 2.1.0CC: abhgupta, adellape, anli, jialiu, jokerman, libra-bugs, libra-onpremise-devel, mmccomas, rchopra, xiama
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-broker-1.16.1.11-1.el6op, rubygem-openshift-origin-controller-1.23.10.8-1.el6op Doc Type: Bug Fix
Doc Text:
If a scalable application was made highly available and scaled just to the point to which a second HAProxy gear was created, a scale down event could delete the HAProxy gear. This was due to a bug in the broker's controller library. This bug fix updates the controller logic and the HAProxy gear is now correctly preserved in this scenario.
Story Points: ---
Clone Of: 1122657 Environment:
Last Closed: 2014-08-26 13:52:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 1122657    
Bug Blocks:    

Description Brenton Leanhardt 2014-07-24 12:47:28 UTC
+++ This bug was initially created as a clone of Bug #1122657 +++

Description of problem:
Scaling down an app which is HA picks up the wrong gear if HA was enabled when app had more than two gears.

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


How reproducible:
Always

Steps to Reproduce:
1. Create a scalable app and scale up to 3 gears
2. Make the app HA by issuing the REST API. Scale-up once more to have the 4th gear have haproxy in it.
3. Scale-down.

Actual results:
The gear brought down by scale-down event contained haproxy in it, thus rendering the app non-ha.

Expected results:
The gear selection for scale-down should account for HA/sparse-cart-multiplier/sparse-cart-min, so that an HA app is never reduced to being non-HA.

Additional info:

Comment 1 Brenton Leanhardt 2014-08-01 13:13:46 UTC
Upstream commit:

commit 023dfc859ca71b6579b71a670c016a6220ac4175
Author: Abhishek Gupta <abhgupta@redhat.com>
Date:   Wed Jul 23 17:04:18 2014 -0700

    Bug 1122657: Fixing logic to select gear for scaledown

Comment 4 Ma xiaoqiang 2014-08-04 06:01:51 UTC
Check on puddle[2.1.5/2014-08-01.1]

1.configure the env 
#oo-admin-ctl-user -l test  --allowha true
#sed -i 's/ALLOW_HA_APPLICATIONS="false"/ALLOW_HA_APPLICATIONS="true"/' /etc/openshift/broker.conf 
#/etc/init.d/openshift-broker restart
2.create a scalable app
#rhc app create phps php-5.4 -s
3.Scale up the app twice:
curl -s -k -H 'Content-Type: Application/json' --user $user:$password https://$broker/broker/rest/domains/$domain/applications/php1s/events -X POST -d '{"event":"scale-up"}'
4. Make the app HA
curl -s -k -H 'Content-Type: Application/json' --user $user:$password  https://$broker/broker/rest/domains/$domain/applications/php1s/events -X POST -d '{"event":"make-ha"}'
5. Scale up one more time
curl -s -k -H 'Content-Type: Application/json' --user $user:$password https://$broker/broker/rest/domains/$domain/applications/php1s/events -X POST -d '{"event":"scale-up"}'
The app contains two ha-proxy cartridges 
6.Scale down the app
rhc app scale-down phps 
7.check the haproxy cartridge 
#rhc app-ssh phps --gears "ls -l"
The app still contains two haproxy cartridges. so move the issue to VERIFIED.

Comment 6 errata-xmlrpc 2014-08-26 13:52:54 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.

http://rhn.redhat.com/errata/RHBA-2014-1095.html