openstack_配额管理
官方文档版本日期2015.4,openstack软件版本日期2013.3
1、配额管理
1.1 Set Default Image Quotas
To enable this feature, edit the /etc/glance/glance-api.conf file, and under the [DEFAULT] section, add:
user_storage_quota = <bytes>
For example, to restrict a project's image storage to 5 GB, do this:
user_storage_quota = 5368709120
All projects in your cloud will be able to store only 5 GB of images and snapshots.
1.2 Set Compute Service Quotas
As an administrative user, you can update the Compute Service quotas for an existing tenant, as well as update the quota defaults for a new tenant.
1.2.1 Compute quotas
fixed-ips: Number of fixed IP addresses allowed per tenant. This number must be equal to or greater than the number of allowed instances.
floating-ips: Number of floating IP addresses allowed per tenant.
injected-file-content-bytes: Number of content bytes allowed per injected file.
injected-file-path-bytes: Number of bytes allowed per injected file path.
injected-files: Number of injected files allowed per tenant.
instances: Number of instances allowed per tenant.
key-pairs: Number of key pairs allowed per user.
metadata-items: Number of metadata items allowed per instance.
ram: Megabytes of instance RAM allowed per tenant.
security-group-rules: Number of rules per security group.
security-groups: Number of security groups per tenant.
cores: Number of instance cores allowed per tenant.
1.2.2 查看与更新默认的计算配额
List all default quotas for all tenants, as follows:
$ nova quota-defaults
Update a default value for a new tenant, as follows:
$ nova quota-class-update default key value
For example:
$ nova quota-class-update default instances 15
1.2.3 查看与更新租户的计算配额
Place the tenant ID in a useable variable, as follows:
$ tenant=$(keystone tenant-list | awk '/tenantName/ {print $2}')
List the currently set quota values for a tenant, as follows:
$ nova quota-show --tenant $tenant
Obtain the tenant ID, as follows:
$ tenant=$(keystone tenant-list | awk '/tenantName/ {print $2}')
Update a particular quota value, as follows:
# nova quota-update --quotaName quotaValue tenantID
1.3 Set Object Storage Quotas
To view account quotas placed on a project:
$ swift stat
Account: AUTH_b36ed2d326034beba0a9dd1fb19b70f9
Containers: 0
Objects: 0
Bytes: 0
Meta Quota-Bytes: 214748364800
X-Timestamp: 1351050521.29419
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
To apply or update account quotas on a project:
$ swift post -m quota-bytes:
<bytes>
For example, to place a 5 GB quota on an account:
$ swift post -m quota-bytes:
5368709120
To verify the quota, run the swift stat command again:
$ swift stat
Account: AUTH_b36ed2d326034beba0a9dd1fb19b70f9
Containers: 0
Objects: 0
Bytes: 0
Meta Quota-Bytes: 5368709120
X-Timestamp: 1351541410.38328
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
1.4 Set Block Storage Quotas
Block Storage quotas:
gigabytes: Number of volume gigabytes allowed per tenant
snapshots: Number of Block Storage snapshots allowed per tenant.
volumes: Number of Block Storage volumes allowed per tenant
1.4.1 查看并修改默认的块存储配额
List all default quotas for all tenants, as follows:
$ cinder quota-defaults
For example:
$ cinder quota-defaults
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 10 |
+-----------+-------+
To update a default value for a new tenant, update the property in
the /etc/cinder/cinder.conf file.
1.4.2 查看并修改某租户的块存储配额
View quotas for the tenant, as follows:
# cinder quota-show tenantName
For example:
# cinder quota-show tenant01
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 10 |
+-----------+-------+
Place the tenant ID in a useable variable, as follows:
$ tenant=$(keystone tenant-list | awk '/tenantName/ {print $2}')
Update a particular quota value, as follows:
# cinder quota-update --quotaName NewValue tenantID
2、测试