Compute:用来交互并管理虚拟机的生命周期;
Scheduler:从可用池中根据各种策略选择最合适的计算节点来创建新的虚拟机;
Conductor:为数据库的访问提供统一的接口层。
Compute Service Nova 是 OpenStack 最核心的服务,负责维护和管理云环境的计算资源。
OpenStack 作为 IaaS 的云操作系统,虚拟机生命周期管理也就是通过 Nova 来实现的
在上图中可以看到,Nova 处于 Openstak 架构的中心,其他组件都为 Nova 提供支持:
Glance 为 VM 提供 image
Cinder 和 Swift 分别为 VM 提供块存储和对象存储
Neutron 为 VM 提供网络连接
Nova 架构如下
[iyunv@linux-node1 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[iyunv@linux-node1 ~]# su -s /bin/sh -c "nova-manage db sync" nova
[iyunv@linux-node1 ~]#
[iyunv@linux-node1 ~]# systemctl enable openstack-nova-api.service \
> openstack-nova-consoleauth.service openstack-nova-scheduler.service \
> openstack-nova-conductor.service openstack-nova-novncproxy.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.
[iyunv@linux-node1 ~]# systemctl start openstack-nova-api.service \
> openstack-nova-consoleauth.service openstack-nova-scheduler.service \
> openstack-nova-conductor.service openstack-nova-novncproxy.service
[iyunv@linux-node1 ~]#
启动后,它要去keystone上注册
8、创建 nova 服务实体和端点
下面步骤之前已经操作了,这里就不做了,以删除线标识
1、获得 admin 凭证来获取只有管理员能执行的命令的访问权限
source admin-openrc
2、 要创建服务证书,完成这些步骤
创建 nova 用户
openstack user create --domain default \
--password-prompt nova
3、给 nova 用户添加 admin 角色
$ openstack role add --project service --user nova admin
创建 nova 服务实体:
openstack service create --name nova --description "OpenStack Compute" compute
执行过程如下
[iyunv@linux-node1 ~]# source admin-openstack.sh
[iyunv@linux-node1 ~]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | e1e90d1948fb4384a8d2b09edb2c0cf6 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
[iyunv@linux-node1 ~]#
创建 Compute 服务 API 端点
nova_api端口是8774
创建public端点
命令如下
openstack endpoint create --region RegionOne compute public http://192.168.56.11:8774/v2.1/%\(tenant_id\)s
操作如下
[iyunv@linux-node1 ~]# openstack endpoint create --region RegionOne compute public http://192.168.56.11:8774/v2.1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
| id | 7017bf5b4990451296c6b51aff13e6f4 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | e1e90d1948fb4384a8d2b09edb2c0cf6 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.56.11:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------+
[iyunv@linux-node1 ~]#
[iyunv@linux-node1 ~]# openstack host list
+----------------------+-------------+----------+
| Host Name | Service | Zone |
+----------------------+-------------+----------+
| linux-node1.nmap.com | scheduler | internal |
| linux-node1.nmap.com | consoleauth | internal |
| linux-node1.nmap.com | conductor | internal |
+----------------------+-------------+----------+
[iyunv@linux-node1 ~]#
计算节点安装和配置nova
nova compute通过libvirt管理kvm,计算节点是真正运行虚拟机的
vmware支持嵌套虚拟机,其它虚拟机软件不支持 计算节点机器必须打开vt-x
计算节点操作之前先同步下时间
[iyunv@linux-node2 ~]# ntpdate time1.aliyun.com
18 Feb 12:53:43 ntpdate[3184]: adjust time server 115.28.122.198 offset -0.005554 sec
[iyunv@linux-node2 ~]# date
Sat Feb 18 12:53:45 CST 2017
[iyunv@linux-node2 ~]#
1、安装软件包
[iyunv@linux-node2 ~]# yum install openstack-nova-compute -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.163.com
* updates: mirrors.aliyun.com
Package 1:openstack-nova-compute-13.1.2-1.el7.noarch already installed and latest version
Nothing to do
[iyunv@linux-node2 ~]#
[iyunv@linux-node1 ~]# ls /etc/nova/ -l
total 224
-rw-r----- 1 root nova 3673 Oct 10 21:20 api-paste.ini
-rw-r----- 1 root nova 184346 Feb 18 11:20 nova.conf
-rw-r----- 1 root nova 27914 Oct 10 21:20 policy.json
-rw-r--r-- 1 root root 72 Oct 13 20:01 release
-rw-r----- 1 root nova 966 Oct 10 21:20 rootwrap.conf
[iyunv@linux-node1 ~]#
拷贝文件过去
[iyunv@linux-node1 ~]# rsync -avz /etc/nova/nova.conf root@192.168.56.12:/etc/nova/
root@192.168.56.12's password:
sending incremental file list
sent 41 bytes received 12 bytes 15.14 bytes/sec
total size is 184346 speedup is 3478.23
[iyunv@linux-node1 ~]#
推送过来的文件权限是正确的
[iyunv@linux-node2 ~]# ll /etc/nova/
total 224
-rw-r----- 1 root nova 3673 Oct 10 21:20 api-paste.ini
-rw-r----- 1 root nova 184346 Feb 18 11:20 nova.conf
-rw-r----- 1 root nova 27914 Oct 10 21:20 policy.json
-rw-r--r-- 1 root root 72 Oct 13 20:01 release
-rw-r----- 1 root nova 966 Oct 10 21:20 rootwrap.conf
[iyunv@linux-node2 ~]#
[iyunv@linux-node2 ~]# systemctl enable libvirtd.service openstack-nova-compute.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
[iyunv@linux-node2 ~]# systemctl start libvirtd.service openstack-nova-compute.service
[iyunv@linux-node2 ~]#
控制节点查看,有了计算节点。说明计算节点的服务正常启动了,而且配置没问题
[iyunv@linux-node1 ~]# source admin-openstack.sh
[iyunv@linux-node1 ~]# openstack host list
+----------------------+-------------+----------+
| Host Name | Service | Zone |
+----------------------+-------------+----------+
| linux-node1.nmap.com | scheduler | internal |
| linux-node1.nmap.com | consoleauth | internal |
| linux-node1.nmap.com | conductor | internal |
| linux-node2.nmap.com | compute | nova |
+----------------------+-------------+----------+
[iyunv@linux-node1 ~]#
控制节点列出nova的服务,后面的update时间都几乎一致,如果差距过大,可能造成无法创建虚拟机
[iyunv@linux-node1 ~]# nova service-list
+----+------------------+----------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+----------------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-scheduler | linux-node1.nmap.com | internal | enabled | up | 2017-02-18T05:41:14.000000 | - |
| 2 | nova-consoleauth | linux-node1.nmap.com | internal | enabled | up | 2017-02-18T05:41:14.000000 | - |
| 3 | nova-conductor | linux-node1.nmap.com | internal | enabled | up | 2017-02-18T05:41:13.000000 | - |
| 7 | nova-compute | linux-node2.nmap.com | nova | enabled | up | 2017-02-18T05:41:13.000000 | - |
+----+------------------+----------------------+----------+---------+-------+----------------------------+-----------------+
[iyunv@linux-node1 ~]#
下面命令测试nova连接glance是否正常
[iyunv@linux-node1 ~]# nova image-list
+--------------------------------------+--------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+--------+--------+--------+
| 9969eaa3-0296-48cc-a42e-a02251b778a6 | cirros | ACTIVE | |
+--------------------------------------+--------+--------+--------+
[iyunv@linux-node1 ~]#