一、创建数据库(控制节点)
创建数据库以及用户:
CREATE DATABASE nova_api; CREATE DATABASE nova; CREATE DATABASE nova_cell0; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova2018'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova2018'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova2018'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova2018'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova2018'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova2018'; flush privileges; exit;
二、创建nova认证相关信息(控制节点)
用admin用户凭证创建nova用户凭证
source admin-openrc
openstack user create --domain default --password-prompt nova #设置密码nova2018
给nova用户添加admin角色
openstack role add --project service --user nova admin
创建nova服务
openstack service create --name nova --description "OpenStack Compute" compute
创建计算api端口
openstack endpoint create --region RegionOne compute public http://10.1.80.110:8774/v2.1 openstack endpoint create --region RegionOne compute internal http://10.1.80.110:8774/v2.1 openstack endpoint create --region RegionOne compute admin http://10.1.80.110:8774/v2.1
创建placement服务用户
openstack user create --domain default --password-prompt placement #密码设置的placement2018
添加placement用户到服务项目
openstack role add --project service --user placement admin
创建placement api服务
openstack service create --name placement --description "Placement API" placement
创建placement api服务端口
openstack endpoint create --region RegionOne placement public http://10.1.80.110:8778 openstack endpoint create --region RegionOne placement internal http://10.1.80.110:8778 openstack endpoint create --region RegionOne placement admin http://10.1.80.110:8778
三、安装软件包并配置组件(控制节点)
(1)控制节点安装服务
yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y
(2)编辑/etc/nova/nova.conf文件并完成以下配置
[DEFAULT] enabled_apis = osapi_compute,metadata my_ip = 10.1.80.110 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver transport_url = rabbit://openstack:openstack2018@10.1.80.110 [api_database] connection = mysql://nova:nova2018@localhost/nova_api [database] connection = mysql://nova:nova2018@localhost/nova [api] auth_strategy = keystone [keystone_authtoken] auth_uri = http://10.1.80.110:5000 auth_url = http://10.1.80.110:35357 memcached_servers = 10.1.80.110:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = nova2018 [vnc] enabled = true server_listen = $my_ip server_proxyclient_address = $my_ip [glance] api_servers = http://10.1.80.110:9292 [oslo_concurrency] lock_path = /var/lib/nova/tmp [placement] os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://10.1.80.110:35357/v3 username = placement password = placement2018
因为软件包的bug,编辑/etc/httpd/conf.d/00-nova-placement-api.conf文件最后增加如下内容:
<Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory>
重启httpd服务
systemctl restart httpd
同步api数据库
su -s /bin/sh -c "nova-manage api_db sync" nova
此处竟然有报错
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported exception.NotSupportedWarning 解决方案如下: bug:https://bugs.launchpad.net/nova/+bug/1746530 pacth:https://github.com/openstack/oslo.db/commit/c432d9e93884d6962592f6d19aaec3f8f66ac3a2
同步cell0数据库:
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
创建cell1:
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
同步nova数据库:
su -s /bin/sh -c "nova-manage db sync" nova
确认cell0和cell1:
nova-manage cell_v2 list_cells
启动服务:
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl status openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service