手动安装Openstack Mikita的第四部分: 计算服务Nova安装. 这部分内容主要是对OpenStack Installation Guide for Red Hat Enterprise Linux and CentOS在Nova这部分内容的实践总结.
首先, 我们在controller节点上部署Nova服务.
一. controller节点安装前准备
1. 为Nova创建数据库
[root@controller ~]# mysql -u root -p
CREATE DATABASE nova_api;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
IDENTIFIED BY 'NOVA_DBPASS';
其中, NOVA_DBPASS是Nova访问数据库时使用的密码.
2. 创建Service和API Endpoint
(1) 获取admin-only CLI指令的权限
[root@controller ~]# . admin-openrc
(2) 创建nova用户
[root@controller ~]# openstack user create --domain default --password-prompt nova
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | 23445595d52c44be995b0b393870b5ef |
| enabled | True |
| id | a98e05efe7c54f7d901e5ca61f8a27f7 |
| name | nova |
+-----------+----------------------------------+
这里nova用户的密码为: zzr.
(3) 把nova用户增加到admin角色和service租户
[root@controller ~]# openstack role add --project service --user nova admin
(4) 创建compute服务
[root@controller ~]# openstack service create --name nova \
--description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 42730828ce28424ca64c1eed4260b824 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
(5) 创建compute服务的Endpoints
- public endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \
compute public http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 1b90d3d65a16476dbe7a9e063a667132 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 42730828ce28424ca64c1eed4260b824 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
- internal endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \
compute internal http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | b48495ef28324beb9d68fda27a988300 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 42730828ce28424ca64c1eed4260b824 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
- admin endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \
compute admin http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 5481feea724849c9898889cfa6d90d94 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 42730828ce28424ca64c1eed4260b824 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
二. controller节点安装nova组件
1. 安装nova
[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler -y
2. 配置nova
编辑文件 /etc/nova/nova.conf :
- 配置数据库访问权限:
[DEFAULT]
...
enabled_apis = osapi_compute,metadata
[api_database]
...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
[database]
...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
- 配置RabbitMQ消息队列的访问权限:
[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
- 配置Identity service的访问权限:
[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = zzr
其中, zzr为上一步骤中为nova用户设置的密码. 删除[keystone_authtoken]里的除了上述内容以外的东西.
- configure the my_ip option to use the management interface IP address of the controller node:
[DEFAULT]
...
my_ip = 10.0.0.11
- enable support for the Networking service:
[DEFAULT]
...
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
- 其余部分:
[vnc]
...
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
...
api_servers = http://controller:9292
[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp
(3) 同步nove配置到数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova
(4) 开启Image服务
[root@controller ~]# systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller ~]# systemctl start openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
配置完controller节点以后, 我们继续在compute节点进行配置.
三. compute节点安装nova
1. 安装
[root@controller ~]# yum install openstack-nova-compute -y
2. 配置
编辑 /etc/nova/nova.conf 文件.
[DEFAULT]
...
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 10.0.0.31
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = zzr
[vnc]
...
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
[glance]
...
api_servers = http://controller:9292
[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp
判断该虚拟机是否支持硬件加速:
[root@controller ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
如果上述指令返回0, 说明该虚拟机不支持硬件加速, 则需进一步设置:
[libvirt]
...
virt_type = qemu
3. 启动
[root@controller ~]# systemctl enable libvirtd.service openstack-nova-compute.service
[root@controller ~]# systemctl start libvirtd.service openstack-nova-compute.service
四. controller节点验证
(1) 获取admin-only CLI指令的权限
[root@controller ~]# . admin-openrc
(2) 查看可用的计算节点
[root@controller ~]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| Id | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller | internal | enabled | up | 2016-08-01T12:42:06.000000 |
| 2 | nova-conductor | controller | internal | enabled | up | 2016-08-01T12:42:06.000000 |
| 3 | nova-scheduler | controller | internal | enabled | up | 2016-08-01T12:42:07.000000 |
| 6 | nova-compute | compute1 | nova | enabled | up | 2016-08-01T12:42:04.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+