Bug 1020009 - Track domain limits as a capability rather than config
Track domain limits as a capability rather than config
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Website (Show other bugs)
2.x
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Jordan Liggitt
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-16 15:00 EDT by Clayton Coleman
Modified: 2015-05-14 21:30 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-23 22:24:37 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Clayton Coleman 2013-10-16 15:00:46 EDT
We should do this for sprint 35 if at all possible

1) Capability use in the api
2) Default to 1 if not set in the db (for N-1 compat during migration)
3) Write a migration
4) Add it to the plan config (need to figure out what to give silver users)
5) oo-admin-ctl-user needs --set-domain-max-count or similar
Comment 2 Jordan Liggitt 2013-10-17 15:56:39 EDT
Also need to allow deleting domains via UI if we make that required to downgrade
Comment 3 Jordan Liggitt 2013-10-24 10:07:47 EDT
Broker changes:
- Updated the "max_domains" field for the user REST API to return the user's max_domains capability.
- The API will return DEFAULT_MAX_DOMAINS for legacy users without "capabilities.max_domains"
- The API will reject a plan change if the user has more domains than the plan's max_domains capability
  -- Free users are allowed 1 domain
  -- Silver users are allowed 3 domains

Migration:
Added a migration to add "capabilities.max_domains" for legacy users (1 for free users, 3 for silver users)

UI additions:
Users can now delete a domain via the UI (from the /domain/<id> page)

Config additions:
/etc/openshift/broker.conf now has a DEFAULT_MAX_DOMAINS setting

Admin additions:
oo-admin-ctl-user now takes a --setmaxdomains argument
Comment 4 Jordan Liggitt 2013-10-24 13:06:42 EDT
Will merge in https://github.com/openshift/li/pull/2034
Comment 5 Yujie Zhang 2013-10-25 04:22:10 EDT
Tested on devenv_3944,result is as following:

For broker changes:
1.Checked the user info using rest api /broker/rest/user, it displayed two max_domains value like following:

<capabilities>
        <plan-upgrade-enabled>true</plan-upgrade-enabled>
        <subaccounts>false</subaccounts>
        <max-domains>3</max-domains>
        <gear-sizes>
          <gear-size>small</gear-size>
          <gear-size>medium</gear-size>
        </gear-sizes>
        <private-ssl-certificates>true</private-ssl-certificates>
        <max-storage-per-gear>5</max-storage-per-gear>
      </capabilities>
      <max-gears>16</max-gears>
      <max-domains>4</max-domains>
The first <max-domains> value is the 'max_domains' => 3 in plugins/billing/aria/config/initializers/openshift-origin-billing-aria.rb file, the second <max-domains> value read from conf.get('MAX_DOMAINS_PER_USER', '4').to_i in 
var/www/openshift/broker/config/environments/development.rb

2. After upgraded to siver account, silver user still can not create more than 1 domains without changing the MAX_DOMAINS_PER_USER value. Silver user should be allowed to create 3 domains by default.

3.Tried to downgrade to free plan when user has more than 1 domains, error message "User nhnhnh has more domains (3) than the 'free' plan allows." prompt, this should be expected.

For migration:

After migration, checked in mongodb, the max_domains value has been added to users, 1 for free user, 3 for silver user.

For UI additions:

Checked on /domain/<id> page, did not find route to delete a domain.

For Config additions:

Checked in /etc/openshift/broker.conf , it now has a DEFAULT_MAX_DOMAINS setting.

For Admin additions:

Checked by trying to use oo-admin-ctl-user -l nhnhnh --setmaxdomains 10, it still does not have --setmaxdomains argument, also tried by using oo-admin-ctl-user -h/--help, same result.

According to the above result, assign this bug back, thanks.
Comment 6 Jordan Liggitt 2013-10-25 08:27:24 EDT
Required pull request https://github.com/openshift/origin-server/pull/3972 didn't get merged. Re-merging.
Comment 7 Yujie Zhang 2013-10-28 04:18:19 EDT
Tested on devenv_3953, result is as following:
For broker changes:
1.Checked the user info using rest api /broker/rest/user, it displayed max_domains value like following:

<capabilities>
        <gear-sizes>
          <gear-size>small</gear-size>
          <gear-size>medium</gear-size>
        </gear-sizes>
        <plan-upgrade-enabled>true</plan-upgrade-enabled>
        <private-ssl-certificates>true</private-ssl-certificates>
        <subaccounts>false</subaccounts>
        <max-storage-per-gear>5</max-storage-per-gear>
      </capabilities>
      <max-gears>16</max-gears>
      <max-domains>3</max-domains>
max-domains value is 3 for silver account, and 1 for free account.

2. After upgraded to siver account, silver user can create 3 domains by default.

3.Tried to downgrade to free plan when user has more than 1 domains, error message "User nhnhnh has more domains (3) than the 'free' plan allows." prompt, this should be expected.

For migration:

After migration, checked in mongodb, the max_domains value has been added to users, 1 for free user, 3 for silver user, and silve user can create 3 domains successfully.

For UI additions:

Domains can be deleted successfully from console now.

For Config additions:

Checked in /etc/openshift/broker.conf , it now has a DEFAULT_MAX_DOMAINS setting.

For Admin additions:

[root@ip-10-239-2-225 ~]# oo-admin-ctl-user -l bvbvb --setmaxdomains 6

Setting max_domains to 6... Done.

User bvbvb:
                            plan: silver
                consumed domains: 3
                     max domains: 6
                  consumed gears: 0
                       max gears: 16
    max tracked storage per gear: 0
  max untracked storage per gear: 5
            plan upgrade enabled: true
                      gear sizes: small, medium
            sub accounts allowed: false
private SSL certificates allowed: true

And user can create 6 domains successfully after setting the max-domains value.

According to the above result, verify this bug, thanks.

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