Bug 1011867

Summary: rhc-admin-migrate-datastore is broken with "undefined method `saved_values' for #<BSON::OrderedHash:0x00000007ea83a8> (NoMethodError)"
Product: OpenShift Online Reporter: Jianwei Hou <jhou>
Component: PodAssignee: Abhishek Gupta <abhgupta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 2.x   
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-10-17 13:31:14 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 Jianwei Hou 2013-09-25 09:43:31 UTC
Description of problem:
Given there are some app pending_ops with type 'set_group_overrides' in mongodb, execute the mongo migration, and the program is broken with error "undefined method `saved_values' for #<BSON::OrderedHash:0x00000007ea83a8> (NoMethodError)"

Digged into code, and found the error generating line:
update_sets["pending_op_groups.#{op_group_index}.pending_ops.#{op_index}.saved_group_overrides"] = op.saved_values["group_overrides"]

the op's class was BSON::OrderedHash, worked around it by updating 'op.saved_values' to op["saved_values"]

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

How reproducible:
Always

Steps to Reproduce:
1. Create all types of pending_ops on devenv-stage ami
2. Upgrade server to latest following wiki to test fork_ami migration
3. Do non-compatible datastore migration
/usr/bin/rhc-admin-migrate-datastore --non-compatible --version 2.0.34

Actual results:
After step 3:
[root@ip-10-236-138-5 ~]# /usr/bin/rhc-admin-migrate-datastore --non-compatible --version 2.0.34
Starting migration: non_compatible
/usr/bin/rhc-admin-migrate-datastore:278:in `migrate_app_pending_ops': undefined method `saved_values' for #<BSON::OrderedHash:0x0000000841eb48> (NoMethodError)
	from /usr/bin/rhc-admin-migrate-datastore:186:in `block (2 levels) in migrate_pending_ops'
	from /usr/bin/rhc-admin-migrate-datastore:185:in `each'
	from /usr/bin/rhc-admin-migrate-datastore:185:in `each_with_index'
	from /usr/bin/rhc-admin-migrate-datastore:185:in `block in migrate_pending_ops'
	from /opt/rh/ruby193/root/usr/local/share/gems/gems/mongo-1.8.1/lib/mongo/cursor.rb:286:in `each'
	from /usr/bin/rhc-admin-migrate-datastore:181:in `migrate_pending_ops'
	from /usr/bin/rhc-admin-migrate-datastore:140:in `migrate'
	from /usr/bin/rhc-admin-migrate-datastore:466:in `<main>'


Expected results:
Program should not be broken

Additional info:

Comment 1 openshift-github-bot 2013-09-25 17:18:17 UTC
Commits pushed to master at https://github.com/openshift/li

https://github.com/openshift/li/commit/afdafd84aa210d9950f133b9f014636f8a65abe7
Fix for bug 1011867

https://github.com/openshift/li/commit/2d5b28233d36b4efa2515f6cf52fc3b60da2a256
Merge pull request #1924 from abhgupta/abhgupta-dev

Fix for bug 1011867

Comment 2 Abhishek Gupta 2013-09-25 17:23:04 UTC
Fixed with --> https://github.com/openshift/li/pull/1924

Comment 3 Jianwei Hou 2013-09-26 03:14:00 UTC
Verified on devenv_3829, the problem is fixed, the program migrated mongodb successfully.