1. 程式人生 > >openstack 命令列管理九

openstack 命令列管理九



幫助

[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.