安装和配置(计算节点)

Compute service支持多个hypervisors来部署实例或虚拟机(VM)。为简单起见,此配置在计算节点上使用Quick EMUlator(QEMU)管理程序和基于内核的VM(KVM)扩展,以支持虚拟机的硬件加速。在传统硬件上,此配置使用通用QEMU管理程序。

安装和配置组件

  • 安装软件包
yum install openstack-nova-compute -y
  • 编辑配置文件/etc/nova/nova.conf

vi /etc/nova/nova.conf
/enabled_apis
/transport_url
/my_ip
/use_neutron
/firewall_driver

[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RABBIT_PASS@controller-150
my_ip=192.168.11.151
##这里配置compute node的管理IP地址
use_neutron=true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

/\[api

[api]
# ...
auth_strategy = keystone

/\[keystone_authtoken

[keystone_authtoken]
# ...
auth_url  = http://controller-150:5000/v3
memcached_servers = controller-150:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 你的密码

/\[vnc

[vnc]
# ...
enabled=true
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://192.168.11.150:6080/vnc_auto.html

/\[glance

[glance]
# ...
api_servers = http://controller-150:9292

/\[oslo_concurrency

[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp

/\[placement

[placement]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller-150:5000/v3
username = placement
password = PLACEMENT_PASS

  • 完成安装

egrep -c '(vmx|svm)' /proc/cpuinfo
没有值,说明计算节点不支持硬件虚拟化,需要将/etc/nova/nova.conf文件中的如下值改成qemu,默认是kvm(但没有验证,还是显式设置一下比较好):
[libvirt]
# ...
virt_type = qemu

  • 启动服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service && \
systemctl status libvirtd.service openstack-nova-compute.service

添加防火墙策略

# firewall-cmd --add-port 5900-5910/tcp --permanent
# firewall-cmd --reload
否则VNC会报:Failed to connect to server

添加compute node到cell数据库

下面的操作在controller节点上

# su - xiao
$ source /etc/openstack/admin-openrc
## 查看是否存在计算节点
$ openstack compute service list --service nova-compute

##查看是否注册到了cell
# nova-manage cell_v2 list_hosts

##发现计算主机
# 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': 2591a44a-a8ea-421e-bde0-f0e3087db102
Checking host mapping for compute host 'compute-151': e17c358b-cdd3-4314-987e-83bddf4ef11d
Creating host mapping for compute host 'compute-151': e17c358b-cdd3-4314-987e-83bddf4ef11d
Found 1 unmapped computes in cell: 2591a44a-a8ea-421e-bde0-f0e3087db102

验证是否注册成功:

# nova-manage cell_v2 list_hosts

当我们增加一个新的计算节点,都要在controller节点上执行:
nova-manage cell_v2 discover_hosts
以将计算节点注册到cell。

编辑/etc/nova/nova.conf,配置下面的参数,以自动注册计算节点。
[scheduler]
discover_hosts_in_cells_interval = 300

具体参见:
https://docs.openstack.org/nova/queens/install/compute-install-rdo.html

 

更多推荐