问题导读
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.
[root@station140 ~(keystone_admin)]# cinder 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-show List the quotas for a tenant.
quota-update Update the quotas for a tenant.
quota-usage List the quota usage for a tenant. 复制代码
配额默认针对 tenants 级别, 倒不如改成针对用户级别更方便管理
下面方法限制用户在所有 project 中的磁盘总大小
/etc/glance/glance-api.conf
user_storage_quota = 0 <- 以 byte 进行计算 ex: 5368709120 (5G) 复制代码
ex: icehouse 版本后, 需要修改配置文件 glance-api.conf 中 image_member_quota 配置
默认配额配置文件
/etc/cinder/cinder.conf
#quota_volumes=10
#quota_snapshots=10
#quota_gigabytes=1000 复制代码
分别查询, 默认或某个 project 配额
[root@station140 ~(keystone_admin)]# cinder quota-defaults default
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 10 |
+-----------+-------+
[root@station140 ~(keystone_admin)]# cinder quota-show 9467f30b8bba4770a06a687e4584636b <- 可选 cloud
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 10 |
+-----------+-------+ 复制代码
修改 cloud 配额
[root@station140 ~(keystone_admin)]# cinder quota-update --volumes 15 cloud 复制代码
查询修改后设定
[root@station140 ~(keystone_admin)]# cinder quota-show cloud
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 15 |
+-----------+-------+ 复制代码
openstack 命令行管理 - 用户管理
帮助
[root@station140 ~(keystone_admin)]# keystone | grep user
[--os-username <auth-user-name>]
Create EC2-compatible credentials for user per tenant.
List EC2-compatible credentials for a user
token-get Display the current user token.
user-create Create new user
user-delete Delete user
user-get Display user details.
user-list List users.
user-password-update
Update user password.
user-role-add Add role to user
user-role-list List roles granted to a user
user-role-remove Remove role from user
user-update Update user's name, email, and enabled status.
bootstrap Grants a new role to a new user on a new tenant, after
--os-username <auth-user-name>
one via authentication (e.g. with username & 复制代码
添加用户方法
[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
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | <a target="_blank" href="mailto:signmem@hotmail.com">signmem@hotmail.com</a> |
| enabled | True |
| id | 8f6478593aa845b3b44eded4aade0f6f |
| name | terry |
| tenantId | 9467f30b8bba4770a06a687e4584636b | <- 对应 cloud 的 id
+----------+----------------------------------+ 复制代码
更新用户信息
keystone user-update --name terry --email terry@111.com terry 复制代码
keystone user-list 命令只能够列出所有用户 或使用参数指定属于某个 project 中的用户
[root@station140 ~(keystone_admin)]# keystone user-list --tenant cloud
+----------------------------------+-------+---------+---------------+
| id | name | enabled | email |
+----------------------------------+-------+---------+---------------+
| 8f6478593aa845b3b44eded4aade0f6f | terry | True | terry@111.com |
+----------------------------------+-------+---------+---------------+ 复制代码