openstack 命令行管理四 - 資源管理 (備忘)
配額用於對每個 tenants 進行限製, 如浮動 IP, 內存, CPU, 磁盤, 密鑰, 安全規則, 雲硬盤等
資源管理幫助
[root@station140 ~(keystone_admin)]# nova help | grep quota quota-class-show List the quotas for a quota class. quota-class-update Update the quotas for a quota class. quota-defaults List the default quotas for a tenant. quota-delete Delete quota for a tenant/user so their quota will quota-show List the quotas for a tenant/user. quota-update Update the quotas for a tenant/user.
可管理資源
fixed-ips 每個 project 可用固定 IP 地址, 必須大於等於實例可用的 IP 地址數量 floating-ips 每個 project 可用的浮動 IP 地址 injected-file-content-bytes 添加的文件最大可包含多少 bytes injected-file-path-bytes 指定的文件目錄下最大可包含的文件 bytes injected-files 每個 project 可以包含的文件數量 instances 每個 project 可包含的最多的 instances 數量 key-pairs 每個用戶可用的 key-pairs 的數量 metadata-items 每個實例可擁有的 metadata-items 數量 ram 允許每個 project 中的 instances 可用的 ram (MB) 數量 security-group-rules 可用的安全組規則 security-groups 每個 project 的安全組 cores 每個 project 可用的虛擬 CPU 個數
顯示
[root@station140 ~(keystone_admin)]# nova quota-defaults +-----------------------------+-------+ | Quota | Limit | +-----------------------------+-------+ | instances | 10 | | cores | 20 | | ram | 51200 | | floating_ips | 10 | | fixed_ips | -1 | | metadata_items | 128 | | injected_files | 5 | | injected_file_content_bytes | 10240 | | injected_file_path_bytes | 255 | | key_pairs | 100 | | security_groups | 10 | | security_group_rules | 20 | +-----------------------------+-------+
更新方法
[root@station140 ~(keystone_admin)]# nova quota-class-update --instances 20 default [root@station140 ~(keystone_admin)]# nova quota-defaults +-----------------------------+-------+ | Quota | Limit | +-----------------------------+-------+ | instances | 20 |
建議直接通過 horizon 對每個租戶進行配額限製, 方便簡單, 準確
通過數據庫方法對 quota 進行查詢會更加準確
表一, 用於查詢 內核, 實例, 內存, 安全組資源
mysql> select a.name, b.resource, b.hard_limit from keystone.project a, nova.quotas b where a.enabled=1 and b.deleted=0 and a.id=b.project_id and a.name='admin'; +-------+-----------------------------+------------+ | name | resource | hard_limit | +-------+-----------------------------+------------+ | admin | cores | 500 | | admin | injected_files | 50 | | admin | injected_file_content_bytes | 10240 | | admin | instances | 200 | | admin | metadata_items | 128 | | admin | ram | 1024000 | | admin | security_groups | 10 | | admin | security_group_rules | 20 | +-------+-----------------------------+------------+ 8 rows in set (0.00 sec)
表二, 用於查詢雲盤大小, 雲盤快照, 雲盤數量配額
mysql> select a.name, b.resource, b.hard_limit from keystone.project a, cinder.quotas b where a.enabled=1 and b.deleted=0 and a.id=b.project_id and a.name='admin'; +-------+-----------+------------+ | name | resource | hard_limit | +-------+-----------+------------+ | admin | gigabytes | 10000 | | admin | snapshots | 10 | | admin | volumes | 100 | +-------+-----------+------------+ 3 rows in set (0.00 sec)
表三, 用於查詢對路由, 網絡安全策略, 浮動IP, IP 地址的配額限製
mysql> select a.name, b.resource, b.limit from keystone.project a, neutron.quotas b where a.enabled=1 and a.id=b.tenant_id and a.name='QA'; +------+---------------------+-------+ | name | resource | limit | +------+---------------------+-------+ | QA | router | 1000 | | QA | security_group_rule | 10000 | | QA | subnet | 1000 | | QA | network | 1000 | | QA | security_group | 1000 | | QA | floatingip | 5000 | | QA | port | 8172 | +------+---------------------+-------+ 7 rows in set (0.00 sec)
最後更新:2017-04-03 12:55:07