Bug 998355 - oo-admin-ctl-app shoudn't be able to remove database gears from scalable apps
Summary: oo-admin-ctl-app shoudn't be able to remove database gears from scalable apps
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
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: 2013-08-19 06:46 UTC by Liang Xia
Modified: 2015-05-15 00:20 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-29 12:52:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Liang Xia 2013-08-19 06:46:01 UTC
Description of problem:
Create scalable app with database imbedded, try to remove database gears through oo-admin-ctl-app and it's removed successfully.

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

How reproducible:
always

Steps to Reproduce:
1.create scalable app with database imbedded.
  rhc app create appname jbossews-2.0 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
5.check the app
  rhc app show appname
  
Actual results:
Step 3 finished successfully.
Step 5 still show the db info.

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:

Comment 1 Rob Millner 2013-08-19 17:14:44 UTC
The tool and underlying logic are in the broker.

Comment 2 Abhishek Gupta 2013-08-19 19:39:56 UTC
Recent changes for HA resulted in this change.

Comment 3 Rajat Chopra 2013-08-20 15:44:31 UTC
Fixed with pull request https://github.com/openshift/origin-server/pull/3423

Comment 4 Liang Xia 2013-08-21 02:37:34 UTC
Reproduced on devenv_3680.
Database gears still can be removed. See steps and results below:

[root@ip-10-204-134-218 ~]# rhc app show appname --gears
ID                               State   Cartridges               Size  SSH URL
-------------------------------- ------- ------------------------ ----- --------------------------------------------------------------------------------------
f64494fc0a0811e3ba6612313b0a852c started mysql-5.1                small f64494fc0a0811e3ba6612313b0a852c.rhcloud.com
768029664124824480382976         started mongodb-2.2              small 768029664124824480382976.rhcloud.com
5214251f246e420729000001         started postgresql-9.2           small 5214251f246e420729000001.rhcloud.com
f58521f80a0811e3ba6612313b0a852c started jbossews-2.0 haproxy-1.4 small f58521f80a0811e3ba6612313b0a852c.rhcloud.com

[root@ip-10-204-134-218 ~]# oo-admin-ctl-app -l lxia -a appname -c remove-gear --gear_uuid f64494fc0a0811e3ba6612313b0a852c
Success

[root@ip-10-204-134-218 ~]# oo-admin-ctl-app -l lxia -a appname -c remove-gear --gear_uuid 768029664124824480382976
Success

[root@ip-10-204-134-218 ~]# oo-admin-ctl-app -l lxia -a appname -c remove-gear --gear_uuid 5214251f246e420729000001
Success

[root@ip-10-204-134-218 ~]# oo-admin-ctl-app -l lxia -a appname -c remove-gear --gear_uuid f58521f80a0811e3ba6612313b0a852c
Gear f58521f80a0811e3ba6612313b0a852c hosts sparse components within its group instance. You cannot remove it.
You can either remove the cartridge or delete the application.

Comment 5 Rajat Chopra 2013-08-21 13:14:55 UTC
Db cartridges may or may not be sparse carts by definition. Including checks for last gear of the group instance.
Fixed with https://github.com/openshift/origin-server/pull/3447

Comment 6 Liang Xia 2013-08-22 02:58:36 UTC
Verified on devenv_3683, it has been fixed.

Steps and results:
# rhc app show jbossews2s --gears
ID                               State   Cartridges               Size  SSH URL
-------------------------------- ------- ------------------------ ----- --------------------------------------------------------------------------------------
474936161729949510664192         started mysql-5.1                small 474936161729949510664192.rhcloud.com
ac3bafe60ad311e3b0d412313d08bd61 started postgresql-9.2           small ac3bafe60ad311e3b0d412313d08bd61.rhcloud.com
ac3e41700ad311e3b0d412313d08bd61 started mongodb-2.2              small ac3e41700ad311e3b0d412313d08bd61.rhcloud.com
abca29a20ad311e3b0d412313d08bd61 started jbossews-2.0 haproxy-1.4 small abca29a20ad311e3b0d412313d08bd61.rhcloud.com
482640281228607802572800         started jbossews-2.0 haproxy-1.4 small 482640281228607802572800.rhcloud.com
e467776e0ad411e3b0d412313d08bd61 started jbossews-2.0 haproxy-1.4 small e467776e0ad411e3b0d412313d08bd61.rhcloud.com

# oo-admin-ctl-app -l lxia -a jbossews2s -c remove-gear --gear_uuid 474936161729949510664192
Gear 474936161729949510664192 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 jbossews2s -c remove-gear --gear_uuid ac3bafe60ad311e3b0d412313d08bd61
Gear ac3bafe60ad311e3b0d412313d08bd61 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 jbossews2s -c remove-gear --gear_uuid ac3e41700ad311e3b0d412313d08bd61
Gear ac3e41700ad311e3b0d412313d08bd61 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 jbossews2s -c remove-gear --gear_uuid abca29a20ad311e3b0d412313d08bd61
Gear abca29a20ad311e3b0d412313d08bd61 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 jbossews2s -c remove-gear --gear_uuid 482640281228607802572800
Success

# oo-admin-ctl-app -l lxia -a jbossews2s -c remove-gear --gear_uuid e467776e0ad411e3b0d412313d08bd61
Success

# rhc app show jbossews2s --gears
ID                               State   Cartridges               Size  SSH URL
-------------------------------- ------- ------------------------ ----- --------------------------------------------------------------------------------------
474936161729949510664192         started mysql-5.1                small 474936161729949510664192.rhcloud.com
ac3bafe60ad311e3b0d412313d08bd61 started postgresql-9.2           small ac3bafe60ad311e3b0d412313d08bd61.rhcloud.com
ac3e41700ad311e3b0d412313d08bd61 started mongodb-2.2              small ac3e41700ad311e3b0d412313d08bd61.rhcloud.com
abca29a20ad311e3b0d412313d08bd61 started jbossews-2.0 haproxy-1.4 small abca29a20ad311e3b0d412313d08bd61.rhcloud.com


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