Bug 1034018

Summary: [origin_broker_114]some errors should not be detected while running 'oo-admin-chk -l 1 ' since gears field was nested in 'group_instances'
Product: OpenShift Online Reporter: zhaozhanqi <zzhao>
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, xtian
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 03:34:15 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 zhaozhanqi 2013-11-25 04:53:32 UTC
Description of problem:
Launch one fork_ami_origin_broker_114_952 instance, create one app, run 'oo-admin-chk -l 1' will be blocked with error "/usr/sbin/oo-admin-chk:439:in `block (2 levels) in <main>': undefined method `[]' for nil:NilClass (NoMethodError)'

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

How reproducible:
always

Steps to Reproduce:
1. oo-admin-chk -l 1


Actual results:
oo-admin-chk -l 1
Started at: 2013-11-24 22:04:23 -0500
/usr/sbin/oo-admin-chk:439:in `block (2 levels) in <main>': undefined method `[]' for nil:NilClass (NoMethodError)
	from /usr/sbin/oo-admin-chk:435:in `each'
	from /usr/sbin/oo-admin-chk:435:in `block in <main>'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.18.0/lib/openshift/data_store.rb:27:in `block (2 levels) in find'
	from /opt/rh/ruby193/root/usr/local/share/gems/gems/mongo-1.8.1/lib/mongo/cursor.rb:286:in `each'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.18.0/lib/openshift/data_store.rb:26:in `block in find'
	from /opt/rh/ruby193/root/usr/local/share/gems/gems/mongo-1.8.1/lib/mongo/collection.rb:276:in `find'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.18.0/lib/openshift/data_store.rb:25:in `find'
	from /usr/sbin/oo-admin-chk:296:in `<main>'


Expected results:
no this error

Additional info:
'oo-admin-chk -l 0' is ok
oo-admin-chk -l 0
Started at: 2013-11-24 22:12:34 -0500
Time to fetch mongo data: 0.008s
Total gears found in mongo: 3
Time to get all gears from nodes: 21.174s
Total gears found on the nodes: 3
Total nodes that responded : 1
Success
Total time: 21.182s
Finished at: 2013-11-24 22:12:55 -0500

Comment 1 Ravi Sankar 2013-11-25 17:23:03 UTC
Fixed in https://github.com/openshift/origin-server/pull/4240

Comment 2 zhaozhanqi 2013-11-26 10:14:14 UTC
tested this issue on devenv_4072

since the gears field was nested in 'group_instances', so use 

oo-admin-chk -l 1 should not detect the following error.

Check failed.
Application 'zqphps' with Id '5294554863512bb55e000028' has no gears for group instance with Id '529455f063512bb55e00004c'
Application 'zqphps' with Id '5294554863512bb55e000028' has no gears for group instance with Id '5294561863512bb55e000069'
Application 'zqphps' with Id '5294554863512bb55e000028' has no gears for group instance with Id '5294561863512bb55e000069'

Comment 3 zhaozhanqi 2013-11-26 10:25:13 UTC
it is only for scaling app, check the all gears as below.

 rhc app show zqphps -g
ID                               State   Cartridges          Size  SSH URL
-------------------------------- ------- ------------------- ----- -------------------------------------------------------------------------------------
5294554863512bb55e000028         started php-5.3 haproxy-1.4 small 5294554863512bb55e000028.rhcloud.com
4f097936567111e388bc22000aa43a5b started mysql-5.1           small 4f097936567111e388bc22000aa43a5b.rhcloud.com
438826707696280391385088         started postgresql-8.4      small 438826707696280391385088.rhcloud.com

Comment 4 Abhishek Gupta 2013-11-26 18:21:39 UTC
Regardless of whether gears are embedded within group instances or not, they still "belong" to a group instance. Hence, this validation is both valid and necessary.

Comment 5 zhaozhanqi 2013-11-27 02:46:32 UTC
Hi abhgupta

My steps is 

1) create one scaling app zqphps

2) add db cartridge mysql and postgresql-8.4

3) then run 'oo-admin-chk -l 1'

step 3, it will give error:

Check failed.
Application 'zqphps' with Id '5294554863512bb55e000028' has no gears for group instance with Id '529455f063512bb55e00004c'
Application 'zqphps' with Id '5294554863512bb55e000028' has no gears for group instance with Id '5294561863512bb55e000069'
Application 'zqphps' with Id '5294554863512bb55e000028' has no gears for group instance with Id '5294561863512bb55e000069'

so I think this is not we expected.

It should return 'PASS'

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

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

https://github.com/openshift/origin-server/commit/56388bb445a173728e5614708ffc45227b20f5f7
Bug 1034018 - Fix gears/group_instances check in oo-admin-chk script

Comment 8 zhaozhanqi 2013-11-27 10:35:44 UTC
Tested this issue on devenv_4078, it has been fixed

oo-admin-chk -l 1
Started at: 2013-11-27 05:33:03 -0500
Time to fetch mongo data: 0.123s
Total gears found in mongo: 13
Time to get all gears from nodes: 21.873s
Total gears found on the nodes: 13
Total nodes that responded : 1
Time to get all sshkeys for all gears from nodes: 20.064s
Total gears found on the nodes: 13
Total nodes that responded : 1
Success
Total time: 43.071s
Finished at: 2013-11-27 05:33:46 -0500


Marked this bug to 'verified'