Bug 1034571

Summary: [origin_broker_114] oo-admin-ctl-app shoudn't be able to remove database gears from scalable apps
Product: OpenShift Online Reporter: Liang Xia <lxia>
Component: PodAssignee: Ravi Sankar <rpenta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: abhgupta, rpenta
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 03:34:37 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:

Description Liang Xia 2013-11-26 06:34:16 UTC
Description of problem:
Create scalable app with database embedded, try to remove database gears through oo-admin-ctl-app and it's removed successfully.

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

How reproducible:
always

Steps to Reproduce:
1.create scalable app with database imbedded.
  rhc app create appname php-5.3 mysql-5.1 mongodb-2.2 postgresql-9.2 -s
2.check the gears in the app
  rhc app show appname --gears
3.try to remove the db gear via oo-admin-ctl-app
  oo-admin-ctl-app -l user -a appname -c remove-gear --gear_uuid <uuid_of_mysql>
  oo-admin-ctl-app -l user -a appname -c remove-gear --gear_uuid <uuid_of_mongodb>
  oo-admin-ctl-app -l user -a appname -c remove-gear --gear_uuid <uuid_of_postgresql>
4.check the gears in the app
  rhc app show appname --gears
  
Actual results:
Step 3 finished successfully.

Expected results:
Step 3 should be failed to remove and get messages like below:
Gear <uuid> hosts singleton components within its group instance. You cannot remove it.
You can either remove the cartridge or delete the application.

Additional info:
https://bugzilla.redhat.com/show_bug.cgi?id=998355

Comment 1 Abhishek Gupta 2013-11-26 18:27:16 UTC
Removing the [fork] tag from the title as this code is now merged into master. Also, marking UpcomingRelease since this belongs to 2.0.37.

Comment 2 Ravi Sankar 2013-11-27 04:40:28 UTC
Fixed in https://github.com/openshift/origin-server/pull/4262

Comment 3 openshift-github-bot 2013-11-27 05:47:35 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/cdd26af507c9a8580a701658fa061e0846816c5a
Bug 1034571 - Fix oo-admin-ctl-app script: 'remove-gear' option will not remove database gears

Comment 4 Liang Xia 2013-11-28 08:48:13 UTC
Verified on devenv_4081. The head web gear and database gears will not be removed.

# rhc app show phps --gears
ID                               State   Cartridges          Size  SSH URL
-------------------------------- ------- ------------------- ----- --------------------------------------------------------------------------------------
899463612020411894595584         started mysql-5.1           small 899463612020411894595584.rhcloud.com
25fa3bfc580611e384a512313d2f5d14 started mongodb-2.2         small 25fa3bfc580611e384a512313d2f5d14.rhcloud.com
25faa132580611e384a512313d2f5d14 started postgresql-9.2      small 25faa132580611e384a512313d2f5d14.rhcloud.com
5296fd261333d38856000153         started php-5.3 haproxy-1.4 small 5296fd261333d38856000153.rhcloud.com
5296fe001333d30a6500000b         started php-5.3 haproxy-1.4 small 5296fe001333d30a6500000b.rhcloud.com
132839267040436156366848         started php-5.3 haproxy-1.4 small 132839267040436156366848.rhcloud.com
5296fe001333d30a6500000c         started php-5.3 haproxy-1.4 small 5296fe001333d30a6500000c.rhcloud.com

# oo-admin-ctl-app -l lxia -a phps -c remove-gear --gear_uuid 899463612020411894595584
Gear 899463612020411894595584 cannot be removed. You need to remove cartridge mysql-5.1.

# oo-admin-ctl-app -l lxia -a phps -c remove-gear --gear_uuid 25fa3bfc580611e384a512313d2f5d14
Gear 25fa3bfc580611e384a512313d2f5d14 cannot be removed. You need to remove cartridge mongodb-2.2.

# oo-admin-ctl-app -l lxia -a phps -c remove-gear --gear_uuid 25faa132580611e384a512313d2f5d14 
Gear 25faa132580611e384a512313d2f5d14 cannot be removed. You need to remove cartridge postgresql-9.2.

# oo-admin-ctl-app -l lxia -a phps -c remove-gear --gear_uuid 5296fd261333d38856000153
Gear 5296fd261333d38856000153 hosts sparse components within its group instance. You cannot remove it.
You can either remove the cartridge or delete the application.

# oo-admin-ctl-app -l lxia -a phps -c remove-gear --gear_uuid 5296fe001333d30a6500000b
Success

# oo-admin-ctl-app -l lxia -a phps -c remove-gear --gear_uuid 132839267040436156366848
Success

# rhc app show phps --gears
ID                               State   Cartridges          Size  SSH URL
-------------------------------- ------- ------------------- ----- --------------------------------------------------------------------------------------
899463612020411894595584         started mysql-5.1           small 899463612020411894595584.rhcloud.com
25fa3bfc580611e384a512313d2f5d14 started mongodb-2.2         small 25fa3bfc580611e384a512313d2f5d14.rhcloud.com
25faa132580611e384a512313d2f5d14 started postgresql-9.2      small 25faa132580611e384a512313d2f5d14.rhcloud.com
5296fd261333d38856000153         started php-5.3 haproxy-1.4 small 5296fd261333d38856000153.rhcloud.com
5296fe001333d30a6500000c         started php-5.3 haproxy-1.4 small 5296fe001333d30a6500000c.rhcloud.com