Red Hat Training
A Red Hat training course is available for Red Hat OpenStack Platform
第 15 章 自动发现裸机节点
您可以使用 auto-discovery 来注册 undercloud 节点并生成它们的元数据,而无需首先创建 instackenv.json
文件。这种改进有助于缩短初始收集节点信息花费的时间,例如,这种方法无需核对 IPMI IP 地址并在随后创建 instackenv.json
。
15.1. 要求
- 所有 overcloud 节点必须将其 BMC 配置为可由 director 通过 IPMI 进行访问。
- 所有 overcloud 节点必须配置为可通过连接到 undercloud 控制层网络的 NIC 进行 PXE 引导。
15.2. 启用自动发现
在
undercloud.conf
中可启用裸机自动发现:enable_node_discovery = True discovery_default_driver = ipmi
-
enable_node_discovery
- 启用之后,任何使用 PXE 来引导内省虚拟内存盘的节点都将在 ironic 中注册。 -
discovery_default_driver
- 设置用于已发现节点的驱动程序。例如,ipmi
。
-
将您的 IPMI 凭证添加到 ironic:
将您的 IPMI 凭证添加到名为
ipmi-credentials.json
的文件。您需要替换本例中的用户名和密码值以适应您的环境:[ { "description": "Set default IPMI credentials", "conditions": [ {"op": "eq", "field": "data://auto_discovered", "value": true} ], "actions": [ {"action": "set-attribute", "path": "driver_info/ipmi_username", "value": "SampleUsername"}, {"action": "set-attribute", "path": "driver_info/ipmi_password", "value": "RedactedSecurePassword"}, {"action": "set-attribute", "path": "driver_info/ipmi_address", "value": "{data[inventory][bmc_address]}"} ] } ]
将 IPMI 凭证文件导入 ironic:
$ openstack baremetal introspection rule import ipmi-credentials.json
15.3. 测试自动发现
- 打开所需节点。
运行
openstack baremetal node list
。应该看到新节点以enrolled
状态列出:$ openstack baremetal node list +--------------------------------------+------+---------------+-------------+--------------------+-------------+ | UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance | +--------------------------------------+------+---------------+-------------+--------------------+-------------+ | c6e63aec-e5ba-4d63-8d37-bd57628258e8 | None | None | power off | enroll | False | | 0362b7b2-5b9c-4113-92e1-0b34a2535d9b | None | None | power off | enroll | False | +--------------------------------------+------+---------------+-------------+--------------------+-------------+
为各个节点设置资源类:
$ for NODE in `openstack baremetal node list -c UUID -f value` ; do openstack baremetal node set $NODE --resource-class baremetal ; done
为各个节点配置内核和 ramdisk:
$ for NODE in `openstack baremetal node list -c UUID -f value` ; do openstack baremetal node manage $NODE ; done $ openstack overcloud node configure --all-manageable
将所有节点设置为 available:
$ for NODE in `openstack baremetal node list -c UUID -f value` ; do openstack baremetal node provide $NODE ; done
15.4. 使用规则发现不同供应商的硬件
如果拥有异构硬件环境,您可以使用内省规则来分配凭证和远程管理凭证。例如,您可能需要单独的发现规则来处理使用 DRAC 的 Dell 节点:
创建名为
dell-drac-rules.json
的文件,并包含以下内容。您需要替换本例中的用户名和密码值以适应您的环境:[ { "description": "Set default IPMI credentials", "conditions": [ {"op": "eq", "field": "data://auto_discovered", "value": true}, {"op": "ne", "field": "data://inventory.system_vendor.manufacturer", "value": "Dell Inc."} ], "actions": [ {"action": "set-attribute", "path": "driver_info/ipmi_username", "value": "SampleUsername"}, {"action": "set-attribute", "path": "driver_info/ipmi_password", "value": "RedactedSecurePassword"}, {"action": "set-attribute", "path": "driver_info/ipmi_address", "value": "{data[inventory][bmc_address]}"} ] }, { "description": "Set the vendor driver for Dell hardware", "conditions": [ {"op": "eq", "field": "data://auto_discovered", "value": true}, {"op": "eq", "field": "data://inventory.system_vendor.manufacturer", "value": "Dell Inc."} ], "actions": [ {"action": "set-attribute", "path": "driver", "value": "idrac"}, {"action": "set-attribute", "path": "driver_info/drac_username", "value": "SampleUsername"}, {"action": "set-attribute", "path": "driver_info/drac_password", "value": "RedactedSecurePassword"}, {"action": "set-attribute", "path": "driver_info/drac_address", "value": "{data[inventory][bmc_address]}"} ] } ]
将规则导入 ironic:
$ openstack baremetal introspection rule import dell-drac-rules.json