分享

openstack 命令行管理二 :tenant 管理、资源管理命令总结

xioaxu790 发表于 2014-8-28 18:26:01 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 21984
本帖最后由 pig2 于 2014-8-28 19:11 编辑
问题导读
1、如何使用keystone 命令帮助  ?
2、如何使用nova资源管理帮助?
3、怎样添加和列出tenant?




project 等同于 tenants
OpenStack Compute Service (nova) 作为认证时候, 称为 project
OpenStack Identity Service (keystone) 作为认证时候, 称为 tenants
添加用户前需要添加对应 project

keystone 命令帮助  
  1.     tenant-create       Create new tenant.  
  2.     tenant-delete       Delete tenant.  
  3.     tenant-get          Display tenant details.  
  4.     tenant-list         List all tenants.  
  5.     tenant-update       Update tenant name, description, enabled status.  
  6.     bootstrap           Grants a new role to a new user on a new tenant, after  
  7.   --os-tenant-name <auth-tenant-name>  
  8.   --os-tenant-id <tenant-id>
复制代码

添加 tenant
  1. [root@station140 ~(keystone_admin)]# keystone tenant-create --name cloud  
  2. +-------------+----------------------------------+  
  3. |   Property  |              Value               |  
  4. +-------------+----------------------------------+  
  5. | description |                                  |  
  6. |   enabled   |               True               |  
  7. |      id     | 9467f30b8bba4770a06a687e4584636b |   <- 创建后, 使用 keystone tenant-get cloud 能够重新调回信息  
  8. |     name    |              cloud               |  
  9. +-------------+----------------------------------+  
复制代码

列出 tenant
  1. [root@station140 ~(keystone_admin)]# keystone tenant-list  
  2. +----------------------------------+----------+---------+  
  3. |                id                |   name   | enabled |  
  4. +----------------------------------+----------+---------+  
  5. | e3a71a59840c4e88b8740b789c3afb9c |  admin   |   True  |  
  6. | fa30a4cd2eba46f0b58d591b7335d660 | alt_demo |   True  |  
  7. | 9467f30b8bba4770a06a687e4584636b |  cloud   |   True  |  
  8. | 87c63116e3b4440eaa9640494b53cd43 |   demo   |   True  |  
  9. | bc95edec7a674bb8873d067d9ddedaec | services |   True  |  
  10. +----------------------------------+----------+---------+  
复制代码


更新信息
  1. [root@station140 ~(keystone_admin)]# keystone tenant-update --description="use for test." --enabled=true cloud  
  2. [root@station140 ~(keystone_admin)]# keystone tenant-get cloud  
  3. +-------------+----------------------------------+  
  4. |   Property  |              Value               |  
  5. +-------------+----------------------------------+  
  6. | description |          use for test.           |  
  7. |   enabled   |               True               |  
  8. |      id     | 9467f30b8bba4770a06a687e4584636b |  
  9. |     name    |              cloud               |  
  10. +-------------+----------------------------------+  
复制代码





openstack- 资源管理

配额可限制 tenants 用光资源, 如浮动 IP, 内存, CPU 等
资源管理帮助
  1. [root@station140 ~(keystone_admin)]# nova help | grep quota  
  2.     quota-class-show    List the quotas for a quota class.  
  3.     quota-class-update  Update the quotas for a quota class.  
  4.     quota-defaults      List the default quotas for a tenant.  
  5.     quota-delete        Delete quota for a tenant/user so their quota will  
  6.     quota-show          List the quotas for a tenant/user.  
  7.     quota-update        Update the quotas for a tenant/user.  
复制代码

可管理资源
  1. fixed-ips                                         每个 project 可用固定 IP 地址, 必须大于等于实例可用的 IP 地址数量  
  2. floating-ips                                     每个 project 可用的浮动 IP 地址  
  3. injected-file-content-bytes             添加的文件最大可包含多少 bytes   
  4. injected-file-path-bytes                  指定的文件目录下最大可包含的文件 bytes  
  5. injected-files                                   每个 project可以包含的文件数量  
  6. instances                                        每个 project可包含的最多的 instances 数量  
  7. key-pairs                                        每个用户可用的  key-pairs 的数量  
  8. metadata-items                              每个实例可拥有的 metadata-items  数量  
  9. ram                                                允许每个 project 中的 instances 可用的 ram (MB) 数量  
  10. security-group-rules                        可用的安全组规则  
  11. security-groups                               每个 project 的安全组  
  12. cores                                               每个 project可用的虚拟 CPU 个数  
复制代码

显示
  1. [root@station140 ~(keystone_admin)]# nova quota-defaults  
  2. +-----------------------------+-------+  
  3. | Quota                       | Limit |  
  4. +-----------------------------+-------+  
  5. | instances                   | 10    |  
  6. | cores                       | 20    |  
  7. | ram                         | 51200 |  
  8. | floating_ips                | 10    |  
  9. | fixed_ips                   | -1    |  
  10. | metadata_items              | 128   |  
  11. | injected_files              | 5     |  
  12. | injected_file_content_bytes | 10240 |  
  13. | injected_file_path_bytes    | 255   |  
  14. | key_pairs                   | 100   |  
  15. | security_groups             | 10    |  
  16. | security_group_rules        | 20    |  
  17. +-----------------------------+-------+  
复制代码

更新方法
  1. [root@station140 ~(keystone_admin)]# nova quota-class-update --instances 20 default  
  2. [root@station140 ~(keystone_admin)]# nova quota-defaults  
  3. +-----------------------------+-------+  
  4. | Quota                       | Limit |  
  5. +-----------------------------+-------+  
  6. | instances                   | 20    |  
复制代码





没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条