openstack-havana云平台实验(7)
时间:2016-10-10 09:32 来源:潇湘夜雨 作者:华嵩阳 点击:次
+---------+-------------------------------------------------+
| testkey | df:af:a2:1c:5b:7b:7e:4d:2d:08:1c:a8:bd:e3:af:95 |
+---------+-------------------------------------------------+
[root@node1 ~(keystone_admin)]# ssh-keygen -l -f .ssh/id_rsa.pub
2048 df:af:a2:1c:5b:7b:7e:4d:2d:08:1c:a8:bd:e3:af:95 .ssh/id_rsa.pub (RSA)
4.3 确保Compute节点的每个服务都已正常运行
在启动任何VM实例前,要确认Compute节点上的如下服务都已经正常运行。
libvirtd:所有的nova服务均依赖于此服务;
nova-api:用于响应请求以启动VM实例,及提供VM实例的元数据信息等;
nova-scheduler:响应用户请求将用户请求启动的VM实例调度至某Compute节点运行;
nova-compute:与hypervisor进行交互以管理VM实例;
nova-network:执行Openstack的网络任务,如将IP地址分配给某VM实例,以及启用安全组规则等;
[root@node1 ~(keystone_admin)]# nova-manage service list
Binary Host Zone Status State Updated_At
nova-console node1.test.com internal enabled :-) 2016-10-06 05:23:09
nova-scheduler node1.test.com internal enabled :-) 2016-10-06 05:23:09
nova-cert node1.test.com internal enabled :-) 2016-10-06 05:23:17
nova-network node1.test.com internal enabled :-) 2016-10-06 05:23:17
nova-conductor node1.test.com internal enabled :-) 2016-10-06 05:23:11
nova-compute node1.test.com nova enabled :-) 2016-10-06 05:23:16
注意:如果compute服务不能启动,可以先启动conductor节点再重启compute。
4.4 启动一个实例
在启动一个VM实例时,需要为其指定一个flavor,也即实例类型,其用于指定此实例的规格,如内存大小、磁盘数量及空间大小、VCPU的个数等。“nova flavor-list”可以查看所有的flavor。
[root@node1 ~(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 |
+----+-----------+-----------+------+-----------+------+-------+-------------+------
“nova flavor-create”可用于创建一个新的flavor,其使用格式请自行获取命令的使用帮助。下面就创建了一个名为“flavor.cirros”的flavor。
[root@node1 ~(keystone_admin)]# nova flavor-create --swap 256 flavor.cirros 6 128 2 2
+----+---------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+---------------+-----------+------+-----------+------+-------+-------------+-----------+
| 6 | flavor.cirros | 128 | 2 | 0 | 256 | 2 | 1.0 | True |
+----+---------------+-----------+------+-----------+------+-------+-------------+-----------+
[root@node1 ~(keystone_admin)]# nova image-list
+--------------------------------------+---------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------+--------+--------+
| e094ce6c-7384-47fa-a535-f1ab8fb7a0e5 | cirros-0.3.0-i386 | ACTIVE | |
| 46e5df15-8adb-46c7-aa4c-a57f2da8acc5 | cirros-0.3.0-x86_64 | ACTIVE | |
+--------------------------------------+---------------------+--------+--------+
另外,启动实例还依赖于可用的映像文件。在前文的演示中已经添加过两个示例性的映像文件,可以使用“nova image-list”获取其相关信息。
[root@node1 ~(keystone_admin)]# nova boot --flavor 6 --image 46e5df15-8adb-46c7-aa4c-a57f2da8acc5 --key_name testkey --security_group default cirros1
+--------------------------------------+------------------------------------------------------------+
| Property | Value |
+--------------------------------------+------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | - |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | - |
| OS-SRV-USG:terminated_at | - | (责任编辑:liangzh) |