安装与配置
使用root用户登陆MySQL数据库
# mysql
新建nova_api、nova和nova_cell0数据库
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
对这些数据库授予权限
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
用之前对应生成的十六进制数代替“NOVA_DBPASS”字段
退出数据库,然后运行admin用户的OpenRC脚本文件
$ . admin-openrc
创建nova用户
$ openstack user create --domain default --password-prompt nova
输出结果
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 4b18d3e37951419780ef89ab41aa1ad0 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
授予nova用户在service项目中使用admin角色
$ openstack role add --project service --user nova admin
创建nova服务实体
$ openstack service create --name nova --description "OpenStack Compute" compute
输出结果
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 29e2a95865a647f6adfd0d222cb8a442 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
创建计算服务的API端点
$ openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 76913765de904be9abd346bcfdf4059b |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 29e2a95865a647f6adfd0d222cb8a442 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 03cd49ac026546d894aa4989441404c1 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 29e2a95865a647f6adfd0d222cb8a442 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | ded2aec1e3bf49bc8eb51fc71fb97b20 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 29e2a95865a647f6adfd0d222cb8a442 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
安装相关软件包
# apt-get install nova-api nova-conductor nova-consoleauth nova-novncproxy nova-scheduler nova-compute
输入如下指令编辑nova配置文件
# vim /etc/nova/nova.conf
在打开的文件中修改如下键值
[api_database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
[database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
[DEFAULT]
# ...
transport_url = rabbit://openstack:RABBIT_PASS@controller
my_ip = 192.168.31.118
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = NOVA_PASS
[vnc]
enabled = true
# ...
server_listen = 0.0.0.0
server_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
[placement]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = PLACEMENT_PASS
用之前对应生成的十六进制数代替“NOVA_DBPASS”、“RABBIT_PASS”和“PLACEMENT_PASS”字段
省略号(…)表示保留原有默认配置选项
[keystone_authtoken]部分要注释或删除其他选项
完成后同步nova数据库
# su -s /bin/sh -c "nova-manage api_db sync" nova
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
# su -s /bin/sh -c "nova-manage db sync" nova
# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
完成后重启计算服务
# service nova-api restart
# service nova-consoleauth restart
# service nova-scheduler restart
# service nova-conductor restart
# service nova-novncproxy restart
# service nova-compute restart
验证操作
检查所有计算服务的状态
# openstack compute service list
输出结果
+----+------------------+--------------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+--------------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | guytion-All-Series | internal | enabled | up | 2019-09-12T09:18:27.000000 |
| 2 | nova-scheduler | guytion-All-Series | internal | enabled | up | 2019-09-12T09:18:32.000000 |
| 4 | nova-conductor | guytion-All-Series | internal | enabled | up | 2019-09-12T09:18:27.000000 |
| 5 | nova-compute | guytion-All-Series | nova | enabled | up | 2019-09-12T09:18:30.000000 |
+----+------------------+--------------------+----------+---------+-------+----------------------------+
检查API端点与对应的服务连接以确认身份认证服务正常
$ openstack catalog list
输出结果
+-----------+-----------+-----------------------------------------+
| Name | Type | Endpoints |
+-----------+-----------+-----------------------------------------+
| nova | compute | RegionOne |
| | | internal: http://controller:8774/v2.1 |
| | | RegionOne |
| | | public: http://controller:8774/v2.1 |
| | | RegionOne |
| | | admin: http://controller:8774/v2.1 |
| | | |
| keystone | identity | RegionOne |
| | | internal: http://controller:5000/v3/ |
| | | RegionOne |
| | | admin: http://controller:5000/v3/ |
| | | RegionOne |
| | | public: http://controller:5000/v3/ |
| | | |
| glance | image | RegionOne |
| | | public: http://controller:9292 |
| | | RegionOne |
| | | admin: http://controller:9292 |
| | | RegionOne |
| | | internal: http://controller:9292 |
| | | |
| placement | placement | RegionOne |
| | | public: http://controller:8778 |
| | | RegionOne |
| | | internal: http://controller:8778 |
| | | RegionOne |
| | | admin: http://controller:8778 |
| | | |
+-----------+-----------+-----------------------------------------+
检查Placement服务状态
# nova-status upgrade check
输出结果
Deprecated: Option "enable" from group "cells" is deprecated for removal (Cells v1 is being replaced with Cells v2.). Its value may be silently ignored in the future.
+--------------------------------------------------------------------+
| Upgrade Check Results |
+--------------------------------------------------------------------+
| Check: Cells v2 |
| Result: Success |
| Details: No host mappings or compute nodes were found. Remember to |
| run command 'nova-manage cell_v2 discover_hosts' when new |
| compute hosts are deployed. |
+--------------------------------------------------------------------+
| Check: Placement API |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+
| Check: Request Spec Migration |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+
| Check: Console Auths |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+