openstack 命令行管理九 - flavor管理[主机模板] (备忘)



帮助

[root@station140 tmp(keystone_admin)]# nova help | grep flavor
    flavor-access-add   Add flavor access for the given tenant.
    flavor-access-list  Print access information about the given flavor.
    flavor-access-remove
                        Remove flavor access for the given tenant.
    flavor-create       Create a new flavor
    flavor-delete       Delete a specific flavor
    flavor-key          Set or unset extra_spec for a flavor.
    flavor-list         Print a list of available 'flavors' (sizes of
    flavor-show         Show details about the given flavor.
    volume-type-delete  Delete a specific flavor


创建自定义 flavor
[root@station140 tmp(keystone_admin)]# nova flavor-create m1.vcomputer 6 2048 20 1
+----+--------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name         | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+--------------+-----------+------+-----------+------+-------+-------------+-----------+
| 6  | m1.vcomputer | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
+----+--------------+-----------+------+-----------+------+-------+-------------+-----------+


列出

[root@station140 tmp(keystone_admin)]# nova flavor-list
+----+--------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name         | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+--------------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny      | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small     | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium    | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large     | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5  | m1.xlarge    | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
| 6  | m1.vcomputer | 2048      | 10   | 0         |      | 1     | 1.0         | True      |
+----+--------------+-----------+------+-----------+------+-------+-------------+-----------+

查询一下 tenant ID
[root@station140 ~(keystone_admin)]# keystone tenant-list
+----------------------------------+----------+---------+
|                id                |   name   | enabled |
+----------------------------------+----------+---------+
| 9467f30b8bba4770a06a687e4584636b |  cloud   |   True  |
+----------------------------------+----------+---------+

创建后需要分配到对应的 project

[root@station140 tmp(keystone_admin)]# nova flavor-access-add 6 9467f30b8bba4770a06a687e4584636b
+-----------+----------------------------------+
| Flavor_ID | Tenant_ID                        |
+-----------+----------------------------------+
| 6         | 9467f30b8bba4770a06a687e4584636b |
+-----------+----------------------------------+

注意下面错误信息

[root@station140 tmp(keystone_admin)]# nova  flavor-access-list --flavor 6  <- 不针对 public 哟
ERROR: Failed to get access list for public flavor type.

上一篇:安卓O内核的加固


下一篇:推荐15款创建漂亮幻灯片的 jQuery 插件