A06. openstack架构实战-计算机节点安装nova服务
在计算节点上安装和配置Compute服务。该服务支持多个虚拟机管理程序来部署实例或虚拟机(VM)。为简单起见,此配置在支持虚拟机硬件加速的计算节点上使用快速EMUlator(QEMU)管理程序和基于内核的VM(KVM)扩展。在旧硬件上,此配置使用通用QEMU管理程序。
nova-compute调用libvirtd来创建虚拟机:
1:安装软件包:
[root@compute01 ~]# yum install openstack-nova-compute -y
2:编辑/etc/nova/nova.conf
文件并完成以下操作:
在此[DEFAULT]
部分中,仅启用计算和元数据API:
[DEFAULT]
enabled_apis = osapi_compute,metadata
在该[DEFAULT]
部分中,配置RabbitMQ
消息队列访问:
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:huayun@controller01
在[api]
和[keystone_authtoken]
部分中,配置身份服务访问:
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://controller01:5000/v3
memcached_servers = controller01:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = huayun
在该[DEFAULT]
部分中,配置my_ip
选项:
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:huayun@controller01
my_ip = 10.100.214.202
在本[DEFAULT]
节中,启用对网络服务的支持:
[DEFAULT]
.......
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
在该[vnc]
部分中,启用和配置远程控制台访问:
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller01:6080/vnc_auto.html
在该[glance]
部分中,配置图像服务API的位置:
[glance]
api_servers = http://controller01:9292
在该[oslo_concurrency]
部分中,配置锁定路径:
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
在该[placement]
部分中,配置Placement API:
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller01:5000/v3
username = placement
password = huayun
最终却确定安装:
1. 确定您的计算节点是否支持虚拟机的硬件加速:
[root@compute01 ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
2
编辑文件中的[libvirt]
部分,/etc/nova/nova.conf
如下所示:
[libvirt]
virt_type = qemu
启动Compute服务及其相关性,并将其配置为在系统启动时自动启动:
[root@compute01 ~]# 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.
[root@compute01 ~]# systemctl start libvirtd.service openstack-nova-compute.service
[root@compute01 ~]#
验证:
在控制节点上进行验证:
[root@controller01 ~]# source admin-openrc
[root@controller01 ~]#
[root@controller01 ~]#
[root@controller01 ~]# openstack compute service list
+----+------------------+--------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+--------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller01 | internal | enabled | up | 2020-05-24T10:18:56.000000 |
| 2 | nova-conductor | controller01 | internal | enabled | up | 2020-05-24T10:18:57.000000 |
| 3 | nova-scheduler | controller01 | internal | enabled | up | 2020-05-24T10:18:57.000000 |
| 6 | nova-compute | compute01 | nova | enabled | up | 2020-05-24T10:18:57.000000 |
+----+------------------+--------------+----------+---------+-------+----------------------------+
发现计算节点主机:
[root@controller01 ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell 'cell1': f6a79410-c689-466c-ad20-705a87170ea9
Checking host mapping for compute host 'compute01': 6bdf239a-4667-49d7-892f-4379c3c40fe6
Creating host mapping for compute host 'compute01': 6bdf239a-4667-49d7-892f-4379c3c40fe6
Found 1 unmapped computes in cell: f6a79410-c689-466c-ad20-705a87170ea9
注意:When you add new compute nodes, you must run nova-manage cell_v2 discover_hosts
on the controller node to register those new compute nodes. Alternatively, you can set an appropriate interval in /etc/nova/nova.conf
:
[scheduler]
discover_hosts_in_cells_interval = 300