cloudstack/setup/db/db
Abhinandan Prateek 987fcbd441 CLOUDSTACK-8592: Implement Quota service
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: https://github.com/apache/cloudstack/pull/768

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-12-07 23:02:48 +05:30
..
data-217to218.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-20to21.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-21to22-cleanup.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-21to22-premium.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-21to22.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-22beta1to22beta2.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-22beta3to22beta4.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-30to301.sql Ensuring system user has password set. 2012-10-07 12:51:52 -07:00
schema-40to410-cleanup.sql db: Fix Upgrade40to41 and add cleaning path schema-40to410-cleanup.sql 2013-02-16 12:28:00 +05:30
schema-40to410.sql CLOUDSTACK-6603 [Upgrade]DB Exception while Autoscale monitoring after upgrading from 4.3 to 4.4 2014-10-12 23:46:05 -04:00
schema-217to218.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-221to222-cleanup.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-221to222-premium.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-221to222.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-222to224-cleanup.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-222to224-premium.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-222to224.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-224to225-cleanup.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-224to225.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-225to226.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-227to228-premium.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-227to228.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-228to229.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-229to2210.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-301to302-cleanup.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-301to302.sql Ensuring system user has password set. 2012-10-07 12:51:52 -07:00
schema-302to40-cleanup.sql Fixed version number in upgrade script comment (replaced 3.0.3 with 3.0.2) 2012-08-13 16:50:06 -07:00
schema-302to40.sql CLOUDSTACK-528: Config value has to be encrypted for Hidden category configs 2013-05-24 12:37:18 +05:30
schema-302to303.sql CLOUDSTACK-3936: db upgrade - added upgrade path from CCP 2.2.15,2.2.16 to CS 4.2 2013-07-30 10:53:23 -07:00
schema-304to305-cleanup.sql DB upgrade: upgraded the bunch of db upgrade files with Apache license header 2013-07-26 15:37:07 -07:00
schema-304to305.sql DB upgrade: upgraded the bunch of db upgrade files with Apache license header 2013-07-26 15:37:07 -07:00
schema-305to306-cleanup.sql DB upgrade: upgraded the bunch of db upgrade files with Apache license header 2013-07-26 15:37:07 -07:00
schema-305to306.sql DB upgrade: upgraded the bunch of db upgrade files with Apache license header 2013-07-26 15:37:07 -07:00
schema-306to307.sql DB upgrade: upgraded the bunch of db upgrade files with Apache license header 2013-07-26 15:37:07 -07:00
schema-307to410-cleanup.sql CLOUDSTACK-3898: fixed 303-42 db upgrade - handle situation when the field is already inserted, when try to insert it again with 41-42 upgrade 2013-07-29 10:43:04 -07:00
schema-307to410.sql schema: fix foreign key checks for 3.0.7 to 4.1.0 upgrade path 2015-05-13 14:11:56 +02:00
schema-410to420-cleanup.sql 41-42 db upgrade - added `cloud` db reference to the upgrade statements for remote access vpn 2013-04-02 11:11:18 -07:00
schema-410to420.sql Revert "CLOUDSTACK-6967: Initial OVM3 drop" 2014-06-24 10:24:01 +02:00
schema-420to421.sql Cloudstack-5077: reserve cpu and memory only when vmware.reserve.cpu/mem are set to true. Insted of setting the ovecommit values to one on upgrade, we popultate them from the global values. 2014-05-05 11:39:10 +05:30
schema-421to430-cleanup.sql CLOUDSTACK-8592: Implement Quota service 2015-12-07 23:02:48 +05:30
schema-421to430.sql Fix schema-421to430.sql issue after MariaDB upgrade 2015-08-27 16:21:22 +02:00
schema-430to440-cleanup.sql CLOUDSTACK-6231: network acl item cidrs loaded from a seperate table 2014-04-30 15:39:00 +02:00
schema-430to440.sql CLOUDSTACK-6603 [Upgrade]DB Exception while Autoscale monitoring after upgrading from 4.3 to 4.4 2014-10-12 23:46:05 -04:00
schema-440to441-cleanup.sql schema: add upgrade path from 4.4.0 to 4.5.0 via 4.4.1 2014-07-29 00:21:39 +02:00
schema-440to441.sql cleaning more conflicts 2014-10-13 00:19:20 -04:00
schema-441to442.sql 4.4.2 upgrade schema 2014-11-24 16:25:44 +01:00
schema-442to450-cleanup.sql 4.4.2 upgrade schema 2014-11-24 16:25:44 +01:00
schema-442to450.sql disable foreign key checks when altering them 2015-04-14 14:50:58 +05:30
schema-443to444.sql 4.4.4 to 4.5.2 upgrade 2015-06-26 00:07:44 +02:00
schema-450to451-cleanup.sql engine: Add Upgrade path from 4.5.0 to 4.5.1 2015-03-12 13:02:45 +05:30
schema-450to451.sql CLOUDSTACK-5236 : ability to identify where the user is from (ex. LDAP) 2015-03-16 14:53:53 +05:30
schema-451to452-cleanup.sql CLOUDSTACK-8457: SAML auth plugin improvements for production usage 2015-06-29 12:31:51 +02:00
schema-451to452.sql CLOUDSTACK-8696: Port Rajani's regions fix to 451to452 sql upgrade path 2015-08-14 13:16:58 +05:30
schema-452to453-cleanup.sql schema: add 4.5.2 to 4.5.3 upgrade path stubs 2015-09-16 11:53:41 +05:30
schema-452to453.sql schema: add 4.5.2 to 4.5.3 upgrade path stubs 2015-09-16 11:53:41 +05:30
schema-452to460-cleanup.sql CLOUDSTACK-8737: Remove out-of-band VR reboot code based on persistent VR configuration changes 2015-08-17 14:49:32 +05:30
schema-452to460.sql CLOUDSTACK-9046 - Add new ACS systemVMs website 2015-11-09 15:13:53 +01:00
schema-460to461-cleanup.sql implemented upgrade path from 4.6.0 to 4.6.1 2015-11-15 14:43:22 +01:00
schema-460to461.sql CLOUDSTACK-6276 Fixing affinity groups for projects 2015-11-27 14:43:02 -05:00
schema-461to470-cleanup.sql implement upgrade paths from 4.6.0/4.6.1 to 4.7.0 2015-11-15 19:11:50 +01:00
schema-461to470.sql CLOUDSTACK-8592: Implement Quota service 2015-12-07 23:02:48 +05:30
schema-2210to2211.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-2211to2212-premium.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-2211to2212.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-2212to2213.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-2213to2214.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-2214to30-cleanup.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-2214to30.sql CLOUDSTACK-3005: fix template_spool_ref.local_patch error after upgrade from 2.2.14 to 3.X 2013-06-14 10:32:47 +02:00
schema-level.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-snapshot-217to224.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00
schema-snapshot-223to224.sql applying the commits from Chip Childers licensing cleanup 2012-06-26 10:44:04 -04:00