|
| 1 | +.. Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +contributor license agreements. See the NOTICE file distributed with this work |
| 3 | +for additional information# regarding copyright ownership. The ASF licenses this |
| 4 | +file to you under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | +use this file except in compliance with the License. You may obtain a copy of |
| 6 | +the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by |
| 7 | +applicable law or agreed to in writing, software distributed under the License |
| 8 | +is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 9 | +KIND, either express or implied. See the License for the specific language |
| 10 | +governing permissions and limitations under the License. |
| 11 | + |
| 12 | + |
| 13 | +Quota Plugin |
| 14 | +============= |
| 15 | + |
| 16 | +Quota service, while allowing for scalability, will make sure that the cloud is |
| 17 | +not exploited by attacks, careless use and program errors. To address this |
| 18 | +problem, employ the quota-enforcement service that allows resource |
| 19 | +usage within certain bounds as defined by policies and available quotas for |
| 20 | +various entities. Quota service extends the functionality of usage server to |
| 21 | +provide a measurement for the resources used by the accounts and domains using a |
| 22 | +common unit referred to as cloud currency in this document. It can be configured |
| 23 | +to ensure that your usage won’t exceed the budget allocated to accounts/domain |
| 24 | +in cloud currency. It will let user know how much of the cloud resources he is |
| 25 | +using. It will help the cloud admins, if they want, to ensure that a user does |
| 26 | +not go beyond his allocated quota. Per usage cycle if an account is found to be |
| 27 | +exceeding its quota then it is locked. Locking an account means that it will not |
| 28 | +be able to initiate a new resource allocation request, whether it is more |
| 29 | +storage or an additional ip. To unlock an account you need to add more credit to it. |
| 30 | +In case you want the locking to be disabled on global or on account scope those |
| 31 | +provisions are also provided. Needless to say quota service as well as any action |
| 32 | +on the account is configurable. |
| 33 | + |
| 34 | +Enabling the Quota Service |
| 35 | +---------------------------- |
| 36 | + |
| 37 | +Before installing and configuring the quota service you need to make sure that |
| 38 | +the Usage Server has been installed. This requires extra steps beyond just |
| 39 | +installing the CloudStack software. See Installing the Usage Server (Optional) |
| 40 | +in the Advanced Installation Guide. |
| 41 | + |
| 42 | +#. enable.usage.server: Set to true to enable usage server. |
| 43 | + |
| 44 | +The quota plugin is disabled by default. To enable it goto Global Settings and |
| 45 | +set the following global configuration to true: |
| 46 | + |
| 47 | +#. quota.enable.service |
| 48 | + |
| 49 | +By default Quota service does not lock the accounts that have exceeded the quota |
| 50 | +usage. To enable quota service to lock accounts set the following global |
| 51 | +configuration to true: |
| 52 | + |
| 53 | +#. quota.enable.enforcement |
| 54 | + |
| 55 | +The other configurations that are there for quota service are as: |
| 56 | + |
| 57 | +#. quota.currency.symbol : The symbol that is used before any currency |
| 58 | + figure in various quota forms and reports. |
| 59 | +#. quota.usage.smtp.host: Quota SMTP host for sending quota alerts. |
| 60 | +#. quota.usage.smtp.port: Quota SMTP port. |
| 61 | +#. quota.usage.smtp.user: Quota SMTP user. |
| 62 | +#. quota.usage.smtp.password: Quota SMTP password. |
| 63 | +#. quota.usage.smtp.sender: Quota SMTP alert sender email address. |
| 64 | +#. quota.usage.smtp.useAuth: If true, use secure SMTP authentication when sending emails. |
| 65 | +#. quota.usage.smtp.connection.timeout: Quota SMTP server connection timeout duration. |
| 66 | + |
| 67 | +There are several configuration variables that are inherited from usage server, |
| 68 | +these are listed below: |
| 69 | + |
| 70 | +#. usage.aggregation.timezone |
| 71 | + |
| 72 | +All these are described in details in Usage Server documentation. |
| 73 | + |
| 74 | +Restart the Management Server and the Usage Server to enable the set configuration |
| 75 | +values. |
| 76 | + |
| 77 | +.. code:: bash |
| 78 | +
|
| 79 | + service cloudstack-management restart |
| 80 | + service cloudstack-usage restart |
| 81 | +
|
| 82 | +Once the quota service is running it will calculate the quota balance for each account. |
| 83 | +The quota usage is calculated as per the quota tariff provided by the site administrator. |
| 84 | + |
| 85 | + |
| 86 | +Quota Tariff |
| 87 | +------------- |
| 88 | + |
| 89 | +The following table shows all quota types for which you can specify tariff. |
| 90 | + |
| 91 | +.. cssclass:: table-striped table-bordered table-hover |
| 92 | + |
| 93 | ++------------------+-----------------------------------+-------------------------+ |
| 94 | +| Type ID | Type Name | Tariff Description | |
| 95 | +| | | | |
| 96 | ++==================+===================================+=========================+ |
| 97 | +| 1 | RUNNING\_VM | One month of running | |
| 98 | +| | | Compute-Month | |
| 99 | ++------------------+-----------------------------------+-------------------------+ |
| 100 | +| 2 | ALLOCATED\_VM | One month of allocated | |
| 101 | +| | | VM | |
| 102 | ++------------------+-----------------------------------+-------------------------+ |
| 103 | +| 3 | IP\_ADDRESS | Quota for a month of | |
| 104 | +| | | allocated IP | |
| 105 | ++------------------+-----------------------------------+-------------------------+ |
| 106 | +| 4 | NETWORK\_BYTES\_SENT | Quota for 1GB bytes sent| |
| 107 | ++------------------+-----------------------------------+-------------------------+ |
| 108 | +| 5 | NETWORK\_BYTES\_RECEIVED | Quota for 1GB bytes sent| |
| 109 | ++------------------+-----------------------------------+-------------------------+ |
| 110 | +| 6 | VOLUME | Quota for 1 GB of | |
| 111 | +| | | Volume use for a month | |
| 112 | ++------------------+-----------------------------------+-------------------------+ |
| 113 | +| 7 | TEMPLATE | Quota for 1 GB of | |
| 114 | +| | |Template use for a month | |
| 115 | ++------------------+-----------------------------------+-------------------------+ |
| 116 | +| 8 | ISO | Quota for 1 GB of | |
| 117 | +| | | ISO use for a month | |
| 118 | ++------------------+-----------------------------------+-------------------------+ |
| 119 | +| 9 | SNAPSHOT | Quota for 1 GB of | |
| 120 | +| | |SNAPSHOT use for a month | |
| 121 | ++------------------+-----------------------------------+-------------------------+ |
| 122 | +| 11 | LOAD\_BALANCER\_POLICY | Quota for load balancer | |
| 123 | +| | | policy month | |
| 124 | ++------------------+-----------------------------------+-------------------------+ |
| 125 | +| 12 | PORT\_FORWARDING\_RULE |Quota for port forwarding| |
| 126 | +| | | policy month | |
| 127 | ++------------------+-----------------------------------+-------------------------+ |
| 128 | +| 13 | NETWORK\_OFFERING | Quota for network | |
| 129 | +| | | Offering for a month | |
| 130 | ++------------------+-----------------------------------+-------------------------+ |
| 131 | +| 14 | VPN\_USERS | Quota for VPN usage | |
| 132 | +| | | for a month | |
| 133 | ++------------------+-----------------------------------+-------------------------+ |
| 134 | +| 15 | CPU\_CLOCK\_RATE | The tariff for using | |
| 135 | +| | | 1 CPU i100 MHz clock | |
| 136 | ++------------------+-----------------------------------+-------------------------+ |
| 137 | +| 16 | CPU\_NUMBER | The quota tariff for | |
| 138 | +| | | using 1 virtual CPU. | |
| 139 | ++------------------+-----------------------------------+-------------------------+ |
| 140 | +| 17 | MEMORY | The quota tariff for | |
| 141 | +| | | using 1MB RAM size. | |
| 142 | ++------------------+-----------------------------------+-------------------------+ |
| 143 | + |
| 144 | +The quota tariff can be listed using listQuotaTariff API. |
| 145 | + |
| 146 | +quotaTariff: Lists all quota tariff plans |
| 147 | + |
| 148 | +The tariff for each of the above can be set by using the updateQuotaTariff API. |
| 149 | + |
| 150 | +Quota Credits |
| 151 | +------------- |
| 152 | + |
| 153 | +The quota credit (quotaCredit) API lets you add or remove quota currency credits to |
| 154 | +an account. With this API you can also control the quota enforcement policy at |
| 155 | +account level. This will enable you to have some accounts where the quota policy is |
| 156 | +not enforced. The overall quota enforcement is controlled by the quota.enable.enforcement |
| 157 | +global setting. |
| 158 | + |
| 159 | +In addition to above the quota API lets you can fine tune the alert generation by specifying |
| 160 | +the quota threshold for each account. If not explictly stated, the threshold is taken as 80% |
| 161 | +of the last deposit. |
| 162 | + |
| 163 | +Quota Balance |
| 164 | +-------------- |
| 165 | + |
| 166 | +Quota balance API states the start balance and end balance(optional) from a start date |
| 167 | +to end date (optional). |
| 168 | + |
| 169 | +Quota Statement |
| 170 | +---------------- |
| 171 | + |
| 172 | +Quota statement for a period consist of the quota usage under various quota types for |
| 173 | +the given period from a start date to an end date. |
| 174 | + |
| 175 | +Quota Monthly Statement |
| 176 | +------------------------ |
| 177 | + |
| 178 | +Quota service emails the monthly quota statement for the last month at the beginning of |
| 179 | +each month. For this service to work properly you need to ensure that the usage server |
| 180 | +is running. |
| 181 | + |
| 182 | +Quota Alert Management |
| 183 | +----------------------- |
| 184 | + |
| 185 | +Quota module also provides APIs to customize various email templates that are used to |
| 186 | +alert account owners about quota going down below threshold and quota getting over. |
| 187 | + |
| 188 | + |
| 189 | +All the above functionality is also available via quota UI plugin. |
0 commit comments