1、用命令行创建一个flavor
查看帮助命令:
[root@controllerwn]# nova help flavor-create
usage: nova flavor-create [--ephemeral <ephemeral>][--swap <swap>]
[--rxtx-factor <factor>] [--is-public <is-public>]
<name> <id> <ram> <disk> <vcpus>
新建flavor:
[root@controllerwn]# nova flavor-create m1.wn 6 2048 20 1
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs| RXTX_Factor | Is_Public |
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
| 6 | m1.wn | 2048 | 20 | 0 | | 1 | 1.0 | True |
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
这边,我的flavor的disk建的太大了,导致我下面磁盘不够,无法用这个flavor来启动vm。
资源不够会报错NoValidHost: No valid host was found. There arenot enough hosts available.
2、用命令行上传一个image:
[root@controllerwn]# glance image-create --name "cirros-wn-123" --file/var/wn/cirros-0.3.4-x86_64-disk.img --disk-format ami --container-format ovf--visibility public --progress
[=============================>]100%
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum |354403308a54291f3d7b3c464bac70a6 |
| container_format| ovf |
| created_at | 2015-12-11T02:30:42Z |
| disk_format | ami |
| id |4de7212e-2ad5-411e-a2d2-32a8204039fe |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros-wn-123 |
| owner | 4bbba9b45a054efaa91c18edf8136fe0 |
| protected | False |
| size | 2692162 |
| status | active |
| tags | [] |
| updated_at | 2015-12-11T02:30:42Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
3、基于image用cinder创建一个启动盘
这一步其实没什么作用,创建一个vm,必须先指定一个image,然后根据image生成的volume来启动,不能直接根据自己创建的volume直接启动。
显示所有的volume
[root@controllerwn]# cinder list
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size |Volume Type | Bootable | Attached to |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
|4143d374-84a0-4a17-b903-55456ae7c0f1 | in-use | - | 1 | - | true |62ad7732-3f8b-4141-9f7b-02b0eab0976b |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
[root@controllerwn]# cinder create --image-id 4de7212e-2ad5-411e-a2d2-32a8204039fe --name wn-volume1 1
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2015-12-11T03:10:37.000000 |
| description | None |
| encrypted | False |
| id |0b21bc62-9515-4aa1-b171-2ac46822d2cd |