Bug 974056

Summary: [broker_50] oo-admin-chk should not report FAIL if user has just downgraded from Silver to Free while aria has not been changed to free until the end of the month
Product: OpenShift Online Reporter: Xiaoli Tian <xtian>
Component: PodAssignee: Ravi Sankar <rpenta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: rpenta, zzhao
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: 2013-06-24 14:54:38 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:

Description Xiaoli Tian 2013-06-13 11:08:46 UTC
Description of problem:
After downgrading an user from Silver to Free,  plan_id in mongo has been changed to Free: 
libra_rs:PRIMARY> db.cloud_users.find ({login: "xtian+bt2"},  {plan_id: 1, plan_state: 2, usage_account_id: 3})
{ "_id" : ObjectId("51b93788c9c6fe945b000006"), "plan_id" : "free", "plan_state" : "ACTIVE", "usage_account_id" : "2555487" }

But in Aria, the plan_id will be still siver and not be changed to free until the end of current month ( which should be by design as far as I know).

While running oo-admin-chk -l 2 --verbose, it will report it as FAIL since the plan_id is not match between mongo and aria

Checking plan_id validity for all billing users: FAIL
User '51b93788c9c6fe945b000006' has plan_id 'free' in mongo but has plan_id 'silver' in Aria billing provider.

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

How reproducible:
Always

Steps to Reproduce:
1. Create an account and upgrade it to silver via web console
2. Downgrade it to Free before the end of current month via web console
3. run oo-admin-chk -l 2 --verbose

Actual results:
It will report it as FAIL since the plan_id is not match between mongo and aria
Checking plan_id validity for all billing users: FAIL
User '51b93788c9c6fe945b000006' has plan_id 'free' in mongo but has plan_id 'silver' in Aria billing provider.

Expected results:
It should bypass such mismatch or checking the next pending queue in aria 

Additional info:

Comment 1 Ravi Sankar 2013-06-14 04:58:46 UTC
Fixed in devenv_3360.

Comment 2 zhaozhanqi 2013-06-14 08:07:33 UTC
Tested it on devenv_3360, it has been fixed


Steps to Reproduce:
1. Create an account and upgrade it to silver via web console
2. Downgrade it to Free before the end of current month via web console
3. run oo-admin-chk -l 2 --verbose


[root@ip-10-196-79-9 openshift]# oo-admin-chk -l 1 --verbose
Started at: 2013-06-14 04:06:14 -0400
Time to fetch mongo data: 0.025s
Total gears found in mongo: 1
Checking consumed gear count for user user_with_multiple_gear_sizes...	OK
Checking consumed gear count for user user_with_extra_storage...	OK
Checking consumed gear count for user user_with_certificate_capabilities...	OK
Checking consumed gear count for user zzhao...	OK
Time to get all gears from nodes: 20.445s
Total gears found on the nodes: 1
Total nodes that responded : 1
Time to get all sshkeys for all gears from nodes: 20.053s
Total gears found on the nodes: 1
Total nodes that responded : 1
Checking application gears and ssh keys on corresponding nodes:
100310887277097123840000 : String...	OK
Checking ssh keys for gear: 100310887277097123840000...	OK
Checking node gears in application database:
100310887277097123840000...	OK
Checking for application without any group instances in the database:
Checking for application without any gears in the group instances in the database:
Checking for users with nil or empty or missing login in the database:
Checking for unreserved UIDs in the district:
Checking for unused UIDs in the district:
Checking for gears with the same UID:
Checking gears available in applications collection but not in usage_records and viceversa: OK
Checking gears with additional storage in applications collection but not in usage_records and viceversa: OK
Checking gears with premium cartridge in applications collection but not in usage_records and viceversa: OK
Checking un-ended records in usage_records collection but not in usage collection and viceversa: OK
Checking usage_account_id validity for all billing users: OK
Checking plan_id validity for all billing users: OK
Checking plan_state validity for all billing users: OK
Success
Total time: 46.323s
Finished at: 2013-06-14 04:07:00 -0400