分享

openstack 命令行管理三:磁盘配额、用户管理命令总结

xioaxu790 发表于 2014-8-28 19:25:53 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 12841
问题导读
1、配额为什么使用用户级别更方便管理?
2、如何运用用户管理的帮组命令?
3、如何添加用户和更新用户消息?





磁盘配额由 Swift 1.8 (OpenStack Grizzly) 管理
Container Quotas: Limits the total size (in bytes) or number of objects that can be stored in a single container.
Account Quotas: Limits the total size (in bytes) that a user has available in the Object Storage service.
  1. [root@station140 ~(keystone_admin)]# cinder 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-show          List the quotas for a tenant.  
  6.     quota-update        Update the quotas for a tenant.  
  7.     quota-usage         List the quota usage for a tenant.
复制代码


配额默认针对 tenants 级别, 倒不如改成针对用户级别更方便管理
下面方法限制用户在所有 project 中的磁盘总大小
/etc/glance/glance-api.conf
  1. user_storage_quota = 0  <- 以 byte 进行计算 ex: 5368709120 (5G)
复制代码


ex: icehouse 版本后, 需要修改配置文件 glance-api.conf 中 image_member_quota 配置
默认配额配置文件
/etc/cinder/cinder.conf
  1. #quota_volumes=10  
  2. #quota_snapshots=10  
  3. #quota_gigabytes=1000
复制代码


分别查询, 默认或某个 project 配额
  1. [root@station140 ~(keystone_admin)]# cinder quota-defaults default  
  2. +-----------+-------+  
  3. |  Property | Value |  
  4. +-----------+-------+  
  5. | gigabytes |  1000 |  
  6. | snapshots |   10  |  
  7. |  volumes  |   10  |  
  8. +-----------+-------+  
  9.   
  10. [root@station140 ~(keystone_admin)]# cinder quota-show 9467f30b8bba4770a06a687e4584636b <- 可选 cloud  
  11. +-----------+-------+  
  12. |  Property | Value |  
  13. +-----------+-------+  
  14. | gigabytes |  1000 |  
  15. | snapshots |   10  |  
  16. |  volumes  |   10  |  
  17. +-----------+-------+
复制代码


修改 cloud 配额
  1. [root@station140 ~(keystone_admin)]# cinder quota-update --volumes 15 cloud
复制代码


查询修改后设定
  1. [root@station140 ~(keystone_admin)]# cinder quota-show cloud  
  2. +-----------+-------+  
  3. |  Property | Value |  
  4. +-----------+-------+  
  5. | gigabytes |  1000 |  
  6. | snapshots |   10  |  
  7. |  volumes  |   15  |  
  8. +-----------+-------+  
复制代码



openstack 命令行管理 - 用户管理
帮助
  1. [root@station140 ~(keystone_admin)]# keystone  | grep user  
  2.                 [--os-username <auth-user-name>]  
  3.                         Create EC2-compatible credentials for user per tenant.  
  4.                         List EC2-compatible credentials for a user  
  5.     token-get           Display the current user token.  
  6.     user-create         Create new user  
  7.     user-delete         Delete user  
  8.     user-get            Display user details.  
  9.     user-list           List users.  
  10.     user-password-update  
  11.                         Update user password.  
  12.     user-role-add       Add role to user  
  13.     user-role-list      List roles granted to a user  
  14.     user-role-remove    Remove role from user  
  15.     user-update         Update user's name, email, and enabled status.  
  16.     bootstrap           Grants a new role to a new user on a new tenant, after  
  17.   --os-username <auth-user-name>  
  18.                         one via authentication (e.g. with username &
复制代码


添加用户方法
  1. [root@station140 ~(keystone_admin)]# keystone user-create --name terry --tenant cloud --pass vipshop --email <a target="_blank" href="mailto:signmem@hotmail.com">signmem@hotmail.com</a> --enabled true  
  2. +----------+----------------------------------+  
  3. | Property |              Value               |  
  4. +----------+----------------------------------+  
  5. |  email   |      <a target="_blank" href="mailto:signmem@hotmail.com">signmem@hotmail.com</a>         |  
  6. | enabled  |               True               |  
  7. |    id    | 8f6478593aa845b3b44eded4aade0f6f |  
  8. |   name   |              terry               |  
  9. | tenantId | 9467f30b8bba4770a06a687e4584636b |  <- 对应 cloud 的 id  
  10. +----------+----------------------------------+
复制代码


更新用户信息
  1. keystone user-update --name terry --email terry@111.com terry
复制代码


keystone user-list 命令只能够列出所有用户 或使用参数指定属于某个 project 中的用户
  1. [root@station140 ~(keystone_admin)]# keystone user-list --tenant cloud  
  2. +----------------------------------+-------+---------+---------------+  
  3. |                id                |  name | enabled |     email     |  
  4. +----------------------------------+-------+---------+---------------+  
  5. | 8f6478593aa845b3b44eded4aade0f6f | terry |   True  | terry@111.com |  
  6. +----------------------------------+-------+---------+---------------+  
复制代码





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

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

本版积分规则

关闭

推荐上一条 /2 下一条