Bug 1144057 - Gear size is still added to a user account if adding to the domain fails
Summary: Gear size is still added to a user account if adding to the domain fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 2.1.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Luke Meyer
QA Contact: libra bugs
URL:
Whiteboard:
Depends On: 1145132
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-18 14:23 UTC by Timothy Williams
Modified: 2018-12-09 18:36 UTC (History)
7 users (show)

Fixed In Version: openshift-origin-broker-util-1.30.4-1.git.68.ba34717.el6op rubygem-openshift-origin-controller-1.31.5-1.git.43.4a89b0c.el6op
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1145132 (view as bug list)
Environment:
Last Closed: 2014-11-03 19:55:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2014:1796 0 normal SHIPPED_LIVE Moderate: Red Hat OpenShift Enterprise 2.2 Release Advisory 2014-11-04 00:52:02 UTC

Comment 3 Eric Rich 2014-09-19 18:52:14 UTC
I think you can work arround this issue with however we should not have to. 

# oo-admin-ctl-domain -c update --allowed_gear_sizes small,large -l admin -n admin

Comment 4 Luke Meyer 2014-09-22 12:45:00 UTC
For the public who can't see the (private) bug report, it's basically this:

If you remove a valid gear size in broker.conf after it's already in use (users, domains, apps created) then it causes validation problems later, specifically when you try to modify an existing domain having that gear size ("Validation of Domain failed."). There could be other ramifications too, but this is the one reported.

Nothing goes through after a change like this to broker.conf to "true up" the existing records. Frankly, it would be unclear what we should do with apps/nodes/districts/regions that now are unrecognized by the broker. Technically, the administrator should disable all of the nodes in the profile, destroy all of the apps (or perhaps move them to a different profile), remove any districts/regions for the profile, and only then remove the profile from broker.conf.

None of this would fix the existing users and domains. A decent workaround would be to use oo-admin-ctl-user with a list of all users to remove the gear size from them prior to removing it from broker.conf. Since there is no way I know of to *get* a list of all OpenShift users (aside from MongoDB query) it would be really nice to have a "--all" flag of some kind on oo-admin-ctl-user for situations like this.

This would be a good addition to the docs, both the current state of affairs and any improvements that come.

It might also be good if domain and user capability validation silently removed invalid gear sizes rather than choking on them while doing something unrelated.

Comment 5 Luke Meyer 2014-10-02 14:04:18 UTC
I don't think this particular problem is directly addressed, but upstream changes should make it easy for admins to fix the underlying issue.

Comment 6 Jason DeTiberus 2014-10-08 02:39:57 UTC
http://etherpad.corp.redhat.com/puddle-2-2-2014-10-07

Comment 7 Ma xiaoqiang 2014-10-08 08:17:38 UTC
Check on puddle [2.2/2014-10-07.2]

Steps:
1. Create an app with small gear
2. Remove small gear size from /etc/openshift/broker.conf, add 'medium' to VALID_GEAR_SIZES. 
3. Attempt to add the 'medium' to the user, new gear size added successfully.
4. Run oo-admin-chk, the inconsistent user capability is detected
5. Fix it with oo-admin-repair, and run oo-admin-chk again.
6. List the user and domain, there is no small gear size

Result:
After step 3:
# oo-admin-ctl-user -l xiaom --addgearsize medium


Adding gear size medium for user xiaom... 
Problem:
  Validation of Domain failed.
Summary:
  The following errors were found: Allowed gear sizes The following gear sizes are invalid: small
Resolution:
  Try persisting the document with valid data or remove the validations.
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/persistence.rb:335:in `fail_validate!'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/persistence.rb:97:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5/app/models/cloud_user.rb:409:in `block in add_gear_size'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/relations/referenced/many.rb:169:in `block in each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/relations/targets/enumerable.rb:184:in `block in each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/contextual/mongo.rb:640:in `yield_document'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/contextual/mongo.rb:123:in `block (2 levels) in each'
/opt/rh/ruby193/root/usr/share/gems/gems/moped-1.5.0/lib/moped/query.rb:77:in `block in each'
/opt/rh/ruby193/root/usr/share/gems/gems/moped-1.5.0/lib/moped/cursor.rb:26:in `block in each'
/opt/rh/ruby193/root/usr/share/gems/gems/moped-1.5.0/lib/moped/cursor.rb:26:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/moped-1.5.0/lib/moped/cursor.rb:26:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/moped-1.5.0/lib/moped/query.rb:76:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/moped-1.5.0/lib/moped/query.rb:76:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/contextual/mongo.rb:122:in `block in each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/contextual/mongo.rb:619:in `selecting'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/contextual/mongo.rb:121:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/contextual.rb:19:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/relations/targets/enumerable.rb:181:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.1.4/lib/mongoid/relations/referenced/many.rb:169:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5/app/models/cloud_user.rb:406:in `add_gear_size'
/usr/sbin/oo-admin-ctl-user:380:in `block in add_gear_size'
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5/app/models/lock.rb:92:in `_run_in_app_user_lock'
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.31.5/app/models/lock.rb:38:in `run_in_user_lock'
/usr/sbin/oo-admin-ctl-user:379:in `add_gear_size'
/usr/sbin/oo-admin-ctl-user:728:in `block in <main>'
/usr/sbin/oo-admin-ctl-user:653:in `each'
/usr/sbin/oo-admin-ctl-user:653:in `<main>'


After step 4:
# oo-admin-chk -l 1
<--snip-->
Some domains have invalid gear sizes allowed: small
Some users have invalid gear sizes in their capabilities: small
FAILED
Please refer to the oo-admin-repair tool to resolve some of these inconsistencies.


After step 5:
# oo-admin-repair --gear-sizes  -v
Some users have invalid gear sizes in their capabilities: small
Some domains have invalid gear sizes allowed: small
Removing invalid gear sizes (small) from all users...	Done.
Removing invalid gear sizes (small) from all domains...	Done.

# oo-admin-chk -l 1
<--snip-->
Checked premium cart usage inconsistencies in 0 seconds

Checked usage record inconsistencies in 0 seconds

Checked user plan inconsistencies in 0 seconds


Finished at: 2014-10-08 08:05:44 UTC
Total time: 40.931s
SUCCESS

Comment 9 errata-xmlrpc 2014-11-03 19:55:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2014-1796.html


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