Skip to content

Implement Quota service - #768

Merged
asfgit merged 1 commit into
apache:masterfrom
shapeblue:quota-master
Dec 7, 2015
Merged

Implement Quota service#768
asfgit merged 1 commit into
apache:masterfrom
shapeblue:quota-master

Conversation

@yadvr

@yadvr yadvr commented Sep 1, 2015

Copy link
Copy Markdown
Member

This pull request is for quota service implementation, divided into following commits:

Quota server side implementation
a. Quota Framework plugin containing Daos
b. Quota database plugin for quota APIs
c. Quota Usage server enhancements
d. Quota UI plugin
e. Tests

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #458 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #459 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #460 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #391 ABORTED

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #461 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #392 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #393 ABORTED

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #394 ABORTED

@yadvr yadvr mentioned this pull request Sep 1, 2015
@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #464 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #465 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #466 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #397 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #398 ABORTED

@asfbot

asfbot commented Sep 1, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #399 ABORTED

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #474 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #407 ABORTED

@jburwell

jburwell commented Sep 2, 2015

Copy link
Copy Markdown
Contributor

Previously, I expressed concerns that the pattern of opening and immediately closing transactions on TransactionLegacy was placing undue pressure on the underlying connection pool. Upon re-review prompted by @abhinandanprateek, I realize that I misread the open method -- mistakenly concluding that it called getConnection causing a connection to be taken from the pool. While it is an unclear, error-prone, and repetitive construct, this pattern is not placing undue pressure on the connection pool. We can address the issue of transaction management (transaction boundaries should not be defined in a DAO and the appropriate abstractions/mechanisms) in a separate effort.

@yadvr yadvr changed the title Quota master WIP (just to follow changes) Quota Sep 2, 2015
@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #476 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #477 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #478 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #479 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #480 SUCCESS
This pull request looks good

@asfbot

asfbot commented Sep 2, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #409 UNSTABLE
Looks like there's a problem with this pull request

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Dates are mutable, a copy of endDate should be returned to avoid downstream side effects.

@jburwell

jburwell commented Dec 7, 2015

Copy link
Copy Markdown
Contributor

@remibergsma I have reviewed the code. I found a couple of minor issues. Namely, that dates are not being defensively copied in a variety of places. These fixes are very simple to implement. The only other items I noticed were a number of unit test methods with no asserts. Hopefully, it will be relatively simple to add some asserts to verify correctness of the methods being tested.

/cc @abhinandanprateek @bhaisaab

abhinandanprateek added a commit to shapeblue/cloudstack that referenced this pull request Dec 7, 2015
Quota service while allowing for scalability will make sure that the cloud is
not exploited by attacks, careless use and program errors. To address this
problem, we propose to employ a quota-enforcement service that allows resource
usage within certain bounds as defined by policies and available quotas for
various entities.  Quota service extends the functionality of usage server to
provide a measurement for the resources used by the accounts and domains using a
common unit referred to as cloud currency in this document. It can be configured
to ensure that your usage won’t exceed the budget allocated to accounts/domain
in cloud currency.  It will let user know how much of the cloud resources he is
using. It will help the cloud admins, if they want, to ensure that a user does
not go beyond his allocated quota. Per usage cycle if a account is found to be
exceeding its quota then it is locked. Locking an account means that it will not
be able to initiat e a new resource allocation request, whether it is more
storage or an additional ip. Needless to say quota service as well as any action
on the account is configurable.

Changes from Github code review:

- added marvin test for quota plugin API
- removed unused commented code
- debug messages in debug enabled check
- checks for nulls, fixed access to member variables and feature
- changes based on PR comments
- unit tests for UsageTypes
- unit tests for all Cmd classes
- unit tests for all service and manager impls
- try-catch-finally or try-with-resource in dao impls for failsafe db switching
- remove dead code
- add missing quota calculation case (regression fixed)
- replace tabs with spaces in pom.xmls
- quota: though default value for quota_calculated is 0, the usage server
  makes it null while entering usage entries. Flipping the condition so
  as to acocunt for that.
- quotatypes: fix NPE in quota type
- quota framework test fixes
- Made statement period configurable
- Changed default email templates to reflect the fact that exhausted quota may not result in a locked account
- Added quotaUpdateCmd that refreshes quota balances and sends alerts and statements
- Report quotaSummary command returns quota balance, quota usage and state for all account
- Made UI framework changes to allow for text area input in edit views
- Process usage entries that have greater than 0 usage
- Process quota entries only if tariff is non zero
- If there are credit entries but no balance entry create a dummy balance entry
- Remove any credit entries that are before the last balance entry
  when displaying balance statement

FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Quota+Service+-+FS
PR: apache#768

Signed-off-by: Rohit Yadav <[email protected]>
@yadvr

yadvr commented Dec 7, 2015

Copy link
Copy Markdown
Member Author

Abhi has fixed the issues, changes are now incorporated, commits squashed into one.
cc @remibergsma @jburwell

LGTM, let's merge this before EOD.

@agneya2001

Copy link
Copy Markdown
Contributor

@bhaisaab @remibergsma there is still one issue that I am looking at now.

@remibergsma

Copy link
Copy Markdown
Contributor

@agneya2001 OK, please ping me when done!

@remibergsma

Copy link
Copy Markdown
Contributor

@bhaisaab Minor thing: could you also rename the title to "Implement Quota service"?

I will make sure it will be merged before we freeze.

@yadvr

yadvr commented Dec 7, 2015

Copy link
Copy Markdown
Member Author

@remibergsma sure, I'm discussing with Abhi on that minor fix. After that, will squash/amend the message in the git log.

@yadvr yadvr changed the title Quota Implement Quota service Dec 7, 2015
@agneya2001

Copy link
Copy Markdown
Contributor

@bhaisaab the issue is resolved.

@yadvr

yadvr commented Dec 7, 2015

Copy link
Copy Markdown
Member Author

@agneya2001 thanks, squashing the change and pushing now.

abhinandanprateek added a commit to shapeblue/cloudstack that referenced this pull request Dec 7, 2015
Quota service while allowing for scalability will make sure that the cloud is
not exploited by attacks, careless use and program errors. To address this
problem, we propose to employ a quota-enforcement service that allows resource
usage within certain bounds as defined by policies and available quotas for
various entities.  Quota service extends the functionality of usage server to
provide a measurement for the resources used by the accounts and domains using a
common unit referred to as cloud currency in this document. It can be configured
to ensure that your usage won’t exceed the budget allocated to accounts/domain
in cloud currency.  It will let user know how much of the cloud resources he is
using. It will help the cloud admins, if they want, to ensure that a user does
not go beyond his allocated quota. Per usage cycle if a account is found to be
exceeding its quota then it is locked. Locking an account means that it will not
be able to initiat e a new resource allocation request, whether it is more
storage or an additional ip. Needless to say quota service as well as any action
on the account is configurable.

Changes from Github code review:

- Added marvin test for quota plugin API
- removed unused commented code
- debug messages in debug enabled check
- checks for nulls, fixed access to member variables and feature
- changes based on PR comments
- unit tests for UsageTypes
- unit tests for all Cmd classes
- unit tests for all service and manager impls
- try-catch-finally or try-with-resource in dao impls for failsafe db switching
- remove dead code
- add missing quota calculation case (regression fixed)
- replace tabs with spaces in pom.xmls
- quota: though default value for quota_calculated is 0, the usage server
  makes it null while entering usage entries. Flipping the condition so
  as to acocunt for that.
- quotatypes: fix NPE in quota type
- quota framework test fixes
- made statement period configurable
- changed default email templates to reflect the fact that exhausted quota may not result in a locked account
- added quotaUpdateCmd that refreshes quota balances and sends alerts and statements
- report quotaSummary command returns quota balance, quota usage and state for all account
- made UI framework changes to allow for text area input in edit views
- process usage entries that have greater than 0 usage
- orocess quota entries only if tariff is non zero
- if there are credit entries but no balance entry create a dummy balance entry
- remove any credit entries that are before the last balance entry
  when displaying balance statement
- on a rerun the last balance is now getting added

FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Quota+Service+-+FS
PR: apache#768

Signed-off-by: Rohit Yadav <[email protected]>
Quota service while allowing for scalability will make sure that the cloud is
not exploited by attacks, careless use and program errors. To address this
problem, we propose to employ a quota-enforcement service that allows resource
usage within certain bounds as defined by policies and available quotas for
various entities.  Quota service extends the functionality of usage server to
provide a measurement for the resources used by the accounts and domains using a
common unit referred to as cloud currency in this document. It can be configured
to ensure that your usage won’t exceed the budget allocated to accounts/domain
in cloud currency.  It will let user know how much of the cloud resources he is
using. It will help the cloud admins, if they want, to ensure that a user does
not go beyond his allocated quota. Per usage cycle if a account is found to be
exceeding its quota then it is locked. Locking an account means that it will not
be able to initiat e a new resource allocation request, whether it is more
storage or an additional ip. Needless to say quota service as well as any action
on the account is configurable.

Changes from Github code review:

- Added marvin test for quota plugin API
- removed unused commented code
- debug messages in debug enabled check
- checks for nulls, fixed access to member variables and feature
- changes based on PR comments
- unit tests for UsageTypes
- unit tests for all Cmd classes
- unit tests for all service and manager impls
- try-catch-finally or try-with-resource in dao impls for failsafe db switching
- remove dead code
- add missing quota calculation case (regression fixed)
- replace tabs with spaces in pom.xmls
- quota: though default value for quota_calculated is 0, the usage server
  makes it null while entering usage entries. Flipping the condition so
  as to acocunt for that.
- quotatypes: fix NPE in quota type
- quota framework test fixes
- made statement period configurable
- changed default email templates to reflect the fact that exhausted quota may not result in a locked account
- added quotaUpdateCmd that refreshes quota balances and sends alerts and statements
- report quotaSummary command returns quota balance, quota usage and state for all account
- made UI framework changes to allow for text area input in edit views
- process usage entries that have greater than 0 usage
- orocess quota entries only if tariff is non zero
- if there are credit entries but no balance entry create a dummy balance entry
- remove any credit entries that are before the last balance entry
  when displaying balance statement
- on a rerun the last balance is now getting added

FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Quota+Service+-+FS
PR: apache#768

Signed-off-by: Rohit Yadav <[email protected]>
@yadvr

yadvr commented Dec 7, 2015

Copy link
Copy Markdown
Member Author

@remibergsma LGTM, final issue fixed. Let's merge now!

@asfgit
asfgit merged commit 987fcbd into apache:master Dec 7, 2015
asfgit pushed a commit that referenced this pull request Dec 7, 2015
Implement Quota serviceThis pull request is for quota service implementation, divided into following commits:

Quota server side implementation
a. Quota Framework plugin containing Daos
b. Quota database plugin for quota APIs
c. Quota Usage server enhancements
d. Quota UI plugin
e. Tests

* pr/768:
  CLOUDSTACK-8592: Implement Quota service

Signed-off-by: Remi Bergsma <[email protected]>
@remibergsma

Copy link
Copy Markdown
Contributor

Built it again, turned feature on, still looks good. Merging!

@remibergsma

Copy link
Copy Markdown
Contributor

@abhinandanprateek @bhaisaab @jburwell Normal users / domain admins cannot login any more:

screen shot 2015-12-09 at 11 08 47

@agneya2001

Copy link
Copy Markdown
Contributor

checking. cc @remibergsma

@milamberspace

Copy link
Copy Markdown
Contributor

icon

@bhaisaab Probably a icon with grey layer would be better to respect the UI Design?

@yadvr

yadvr commented Dec 10, 2015

Copy link
Copy Markdown
Member Author

@milamberspace okay, sending a new PR for that

yadvr added a commit to shapeblue/cloudstack that referenced this pull request Dec 10, 2015
Makes the quota ui plugin icon gray, based on comment at:
apache#768 (comment)

Signed-off-by: Rohit Yadav <[email protected]>
asfgit pushed a commit that referenced this pull request Dec 10, 2015
ui/quota: Make the quota UI plugin icon grayMakes the quota ui plugin icon gray, based on comment at:
#768 (comment)

* pr/1208:
  ui/quota: Make the quota UI plugin icon gray

Signed-off-by: Remi Bergsma <[email protected]>
yadvr pushed a commit that referenced this pull request Jan 20, 2021
Fixes #766

For isolated networks, load balancing, port forwarding and firewall
options are not displayed.
For source nat ip of vpc, all options are displayed but it should not be

Below are the expected actions according to legacy UI

for isolated networks

if static nat is disabled then display all options
if static nat is enabled then display only firewall tab

for VPC networks

for source nat IP, dont display any option
for other ip's firewall is always disabled.
Load balancing and port forwarding options are mutually exclusive

Co-authored-by: Rakesh Venkatesh <[email protected]>
Signed-off-by: Rohit Yadav <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.