Bug 997848

Summary: Sub-account cannot inherit gear size from parent account
Product: OpenShift Online Reporter: Meng Bo <bmeng>
Component: PodAssignee: Clayton Coleman <ccoleman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 2.xCC: ccoleman
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-29 12:52:11 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 Meng Bo 2013-08-16 09:45:04 UTC
Description of problem:
Make my account allow subaccount and can inherit gear size, add some gear size to my account. Create subaccount of this account.

#oo-admin-ctl-user -l bmeng --allowsubaccount true --inheritgearsizes true --addgearsize c9 --addgearsize medium

Check the attribute of the subaccount. Only small gear is allowed for the subaccount.

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

How reproducible:
always

Steps to Reproduce:
1.Make my account allow subaccount and can inherit gear size and add gear size for it
#oo-admin-ctl-user -l bmeng --allowsubaccount true --inheritgearsizes true --addgearsize c9 --addgearsize medium
2.Create subaccount via rest api
#curl -k -H 'Accept: application/xml' -H "X-Impersonate-User: bmeng+sub1" --user bmeng:xxx https://localhost/broker/rest/user
3.Check the attribute of sub-account bmeng+sub1


Actual results:
Only small size is allowed for the subaccount.
      <id>520df052abfea4bb4100004f</id>
      <login>bmeng+sub1</login>
      <consumed-gears>0</consumed-gears>
      <plan-id>free</plan-id>
      <plan-state>ACTIVE</plan-state>
      <usage-account-id nil="true"></usage-account-id>
      <created-at>2013-08-16T09:26:42Z</created-at>
      <capabilities>
        <subaccounts>false</subaccounts>
        <gear-sizes>
          <gear-size>small</gear-size>
        </gear-sizes>
        <plan-upgrade-enabled>true</plan-upgrade-enabled>
      </capabilities>
      <max-gears>3</max-gears>


Expected results:
Subaccount should inherit gear sizes from parent account.

Additional info:
parent account info:

      <id>520deb8fabfea4da26000001</id>
      <login>bmeng</login>
      <consumed-gears>3</consumed-gears>
      <plan-id>silver</plan-id>
      <plan-state>ACTIVE</plan-state>
      <usage-account-id>1728373</usage-account-id>
      <created-at>2013-08-16T09:06:23Z</created-at>
      <capabilities>
        <plan-upgrade-enabled>true</plan-upgrade-enabled>
        <subaccounts>true</subaccounts>
        <gear-sizes>
          <gear-size>small</gear-size>
          <gear-size>medium</gear-size>
          <gear-size>c9</gear-size>
        </gear-sizes>
        <private-ssl-certificates>true</private-ssl-certificates>
        <inherit-on-subaccounts>
          <inherit-on-subaccount>gear_sizes</inherit-on-subaccount>
        </inherit-on-subaccounts>
        <max-storage-per-gear>5</max-storage-per-gear>
      </capabilities>
      <max-gears>16</max-gears>

Comment 1 Clayton Coleman 2013-08-16 17:10:23 UTC
Capabilities are right (at the broker level), it's only the rest API that is broken.

Comment 2 Clayton Coleman 2013-08-20 15:37:57 UTC
Fixed in https://github.com/openshift/origin-server/pull/3435

Comment 3 openshift-github-bot 2013-08-20 18:15:47 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/957a6daa1774072ced6afc845c38632247ceb166
Bug 997848 - Inherited capabilities not in REST API

With the changes to use CapabilityProxy, the default API serialization (Rails) was serializing the user's underlying attribute from Mongoid, not the proxy overlay of inherited capabilities.  Changed to use serializable_hash which uses the proper values

Comment 4 Meng Bo 2013-08-21 10:57:15 UTC
Teston devenv_3680, the subaccount can inherit the gear size from parent account now.

    <user>
      <id>52149cb79e7126b70b000096</id>
      <login>bmengsub</login>
      <consumed-gears>0</consumed-gears>
      <plan-id>free</plan-id>
      <plan-state>ACTIVE</plan-state>
      <usage-account-id nil="true"></usage-account-id>
      <created-at>2013-08-21T10:55:51Z</created-at>
      <capabilities>
        <subaccounts>false</subaccounts>
        <gear-sizes>
          <gear-size>small</gear-size>
          <gear-size>c9</gear-size>
        </gear-sizes>
        <plan-upgrade-enabled>true</plan-upgrade-enabled>
      </capabilities>
      <max-gears>3</max-gears>
    </user>