Ⅰ、在controller节点上配置nova

1.创建nova服务凭据

#先使用脚本登陆admin
[root@controller ~]# . admin-openstack.sh

①创建nova user

openstack user create --domain default --password-prompt nova
OpenStack Pike Minimal安装:四、计算服务

②关联

openstack role add --project service --user nova admin

③创建nova service

openstack service create --name nova --description "OpenStack Compute" compute
OpenStack Pike Minimal安装:四、计算服务

④创建服务API

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
OpenStack Pike Minimal安装:四、计算服务

2.创建placement服务凭据

[root@controller ~]# . admin-openstack.sh

①创建placement user

openstack user create --domain default --password-prompt placement
OpenStack Pike Minimal安装:四、计算服务

②关联

openstack role add --project service --user placement admin

③创建placement service

openstack service create --name placement --description "Placement API" placement
OpenStack Pike Minimal安装:四、计算服务

④创建API

openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
OpenStack Pike Minimal安装:四、计算服务

3.安装nova相关软件

[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y

4.配置nova.conf

[root@controller ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[root@controller ~]# cat /etc/nova/nova.conf
#
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:openstack@controller
my_ip = 20.0.20.21
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[api_database]
connection = mysql+pymysql://nova:nova@controller/nova_api

[database]
connection = mysql+pymysql://nova:nova@controller/nova

[api]
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 = nova

[vnc]
enabled = true
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip

[glance]
api_servers = http://controller: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://controller:35357/v3
username = placement
password = placement

[scheduler]
discover_hosts_in_cells_interval = 300

5.配置00-nova-placement-api.conf

[root@controller ~]# vim /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>

6.重启httpd

[root@controller ~]# systemctl restart httpd

7.填充数据库

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
OpenStack Pike Minimal安装:四、计算服务

8.检测数据

nova-manage cell_v2 list_cells
OpenStack Pike Minimal安装:四、计算服务

mysql -h controller -u nova -pnova -e "use nova_api;show tables;"
mysql -h controller -u nova -pnova -e "use nova;show tables;"
mysql -h controller -u nova -pnova -e "use nova_cell0;show tables;"

9.启动服务

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

Ⅱ、在compute节点配置nova

1.安装nova

[root@compute ~]# yum install openstack-nova-compute -y

2.配置nova.conf

[root@compute ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[root@compute ~]# cat /etc/nova/nova.conf
#
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:openstack@controller
my_ip = 20.0.20.22
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[api]
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 = nova

[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

[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = placement

3.查看计算节点是否支持硬件加速

[root@compute ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
0
#如果返回值为0,则不支持硬件加速,需要配置nova.conf中[libvirt] 部分
[root@compute ~]# vim /etc/nova/nova.conf
[libvirt] 
virt_type  =  qemu

4.启动服务

[root@compute ~]# systemctl enable libvirtd.service openstack-nova-compute.service
[root@compute ~]# systemctl start libvirtd.service openstack-nova-compute.service

.

Ⅲ、在controller上添加compute到cell数据库

1.查看计算节点

[root@controller ~]# . admin-openstack.sh

openstack compute service list --service nova-compute
OpenStack Pike Minimal安装:四、计算服务

2.自动注册compute节点

[root@controller ~]#vim /etc/chrony.conf
[scheduler]
discover_hosts_in_cells_interval = 300

3.验证

openstack compute service list
OpenStack Pike Minimal安装:四、计算服务

openstack catalog list
OpenStack Pike Minimal安装:四、计算服务

openstack image list
OpenStack Pike Minimal安装:四、计算服务

nova-status upgrade check
OpenStack Pike Minimal安装:四、计算服务