1
2
3
4
5
6
7
作者:李晓辉

联系方式:

微信:Lxh_Chat

邮箱:939958092@qq.com

必须执行本文提到的注册动作,不然你的计算节点将不能正常工作

前言

在OpenStack环境中,管理计算节点的状态和配置信息是确保云平台高效运行的关键步骤之一。将计算节点的信息注册到数据库中,不仅便于集中管理,还能确保Nova服务能够正确地识别和调度计算资源。本文将详细介绍如何在OpenStack环境中将计算节点注册到数据库,并确保计算节点能够正常工作。

注册计算节点到数据库的必要性

在OpenStack的分布式架构中,计算节点负责运行虚拟机实例。为了使Nova服务能够有效地管理这些计算资源,计算节点的详细信息(如IP地址、CPU和内存容量等)需要被注册到中央数据库中。这使得Nova服务在调度虚拟机时能够根据最新的计算资源状态进行决策。

将计算节点注册到数据库

注意这个步骤要在控制节点完成

1
2
3
4
5
6
7
8
9
source adminrc.sh
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
2024-05-17 14:07:38.326 10888 WARNING oslo_policy.policy [None req-6a01ed55-7538-44ed-9915-34a1c6ca328c - - - - - -] JSON formatted policy_file support is deprecated since Victoria release. You need to use YAML format which will be default in future. You can use ``oslopolicy-convert-json-to-yaml`` tool to convert existing JSON-formatted policy file to YAML-formatted in backward compatible way: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html.
2024-05-17 14:07:38.327 10888 WARNING oslo_policy.policy [None req-6a01ed55-7538-44ed-9915-34a1c6ca328c - - - - - -] JSON formatted policy_file support is deprecated since Victoria release. You need to use YAML format which will be default in future. You can use ``oslopolicy-convert-json-to-yaml`` tool to convert existing JSON-formatted policy file to YAML-formatted in backward compatible way: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html.
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell 'cell1': a906846b-650e-42c1-8d9e-dcf5cbec6a6e
Found 1 unmapped computes in cell: a906846b-650e-42c1-8d9e-dcf5cbec6a6e

添加新计算节点时,必须在控制节点上执行nova-manage cell_v2 discover_hosts命令注册新计算节点,或者在配置文件/etc/nova/nova.conf设置一个特定的时间间隔来发现

1
2
[scheduler]
discover_hosts_in_cells_interval = 300

创建实例时的注意事项

在创建实例时,如果你是在虚拟机上部署openstack而不是物理机,很有可能无法创建虚拟机,原因是你的虚拟机不支持virtio,指定虚拟机的视频模型就可以了,解决办法是给所有镜像设置一个vga的属性

假设我的openstack镜像为centos9

1
openstack image set --property hw_video_model='vga' centos9