本文主要是介绍Ironic注册/部署/inspect/clean节点操作记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
注册裸机节点
社区链接
实际操作
节点状态变迁图
社区链接
部署裸机节点
社区链接
server状态变迁
node状态变迁
部署流程
实际操作
tftpboot配置文件信息
节点inspect(Hardware Inspection)
社区链接
node状态变迁
实际操作
节点clean
社区链接
node状态变迁
实际操作
注册部署裸机脚本参考
注册裸机节点
社区链接
https://docs.openstack.org/ironic/latest/install/enrollment.html
实际操作
[root@node31 ~]# openstack baremetal node create --driver ipmi --driver-info ipmi_address=${IPMI_ADDRESS} --driver-info ipmi_port=${port} --driver-info ipmi_username=admin --driver-info ipmi_password=password --driver-info ipmi_terminal_port=${terminal_port} --driver-info deploy_kernel=${BM_IMAGE_KERNEL_UUID} --driver-info deploy_ramdisk=${BM_IMAGE_RAMDISK_UUID} --property capabilities=boot_option:local,mac:${mac_t1} --property cpus=2 --property memory_mb=2048 --property local_gb=20 --property cpu_arch=x86_64 --uuid ${uuid} --name ${node_name}
[root@node31 ~]# openstack baremetal port create --node ${uuid} ${mac_t2}
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | available | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node show 698fb3e7-787c-47c1-863c-1f7e84f1b506
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| boot_interface | None |
| chassis_uuid | None |
| clean_step | {} |
| console_enabled | False |
| console_interface | None |
| created_at | 2020-12-24T11:05:57+00:00 |
| deploy_interface | None |
| driver | pxe_ipmitool |
| driver_info | {u'ipmi_password': u'******', u'ipmi_address': u'172.30.123.28', u'ipmi_username': u'USERID', u'deploy_kernel': u'54748425-9c58-4b43-8d31-44b13b26876a', u'deploy_ramdisk': u'e6e50527-8f7b-4a9f-baaa-3a78442814ef'} |
| driver_internal_info | {u'agent_cached_clean_steps_refreshed': u'2020-12-28 08:26:30.737833', u'agent_cached_clean_steps': {u'management': [{u'interface': u'management', u'priority': 0, u'step': u'update_firmware_sum'}], u'raid': [{u'interface': u'raid', u'priority': 0, u'step': u'delete_configuration'}, {u'interface': u'raid', u'priority': 0, u'step': u'create_configuration'}], u'deploy': [{u'priority': 99, u'interface': u'deploy', u'reboot_requested': False, u'abortable': True, u'step': u'erase_devices_metadata'}, {u'interface': u'deploy', u'priority': 0, u'step': u'erase_devices'}]}, u'clean_steps': None, u'hardware_manager_version': {u'generic_hardware_manager': u'3'}, u'is_whole_disk_image': True, u'agent_continue_if_ata_erase_failed': False, u'agent_erase_devices_iterations': 1, u'agent_erase_devices_zeroize': True, u'root_uuid_or_disk_id': u'0x000b7e63', u'agent_url': u'http://172.30.250.102:9999'} |
| extra | {} |
| inspect_interface | None |
| inspection_finished_at | 2020-12-28T08:40:01+00:00 |
| inspection_started_at | None |
| instance_info | {} |
| instance_uuid | None |
| last_error | None |
| maintenance | False |
| maintenance_reason | None |
| management_interface | None |
| name | bm28 |
| network_interface | flat |
| power_interface | None |
| power_state | power off |
| properties | {u'memory_mb': u'393216', u'cpu_arch': u'x86_64', u'local_gb': u'372', u'cpus': u'48', u'capabilities': u'mac:08-94-ef-3c-8d-92,boot_option:local'} |
| provision_state | available |
| provision_updated_at | 2020-12-29T02:35:28+00:00 |
| raid_config | {} |
| raid_interface | None |
| reservation | None |
| resource_class | None |
| storage_interface | noop |
| target_power_state | None |
| target_provision_state | None |
| target_raid_config | {} |
| updated_at | 2020-12-29T02:35:28+00:00 |
| uuid | 698fb3e7-787c-47c1-863c-1f7e84f1b506 |
| vendor_interface | None |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@node31 ~]# openstack baremetal port list
+--------------------------------------+-------------------+
| UUID | Address |
+--------------------------------------+-------------------+
| 7f0b6774-6719-4d8a-bdc7-5f72f9876639 | 08:94:ef:3c:8d:92 |
+--------------------------------------+-------------------+
[root@node31 ~]# openstack baremetal port show 7f0b6774-6719-4d8a-bdc7-5f72f9876639
+-----------------------+--------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------+
| address | 08:94:ef:3c:8d:92 |
| created_at | 2020-12-28T07:36:55+00:00 |
| extra | {} |
| internal_info | {} |
| local_link_connection | {} |
| node_uuid | 698fb3e7-787c-47c1-863c-1f7e84f1b506 |
| physical_network | physnet2 |
| portgroup_uuid | None |
| pxe_enabled | True |
| updated_at | 2020-12-29T02:35:28+00:00 |
| uuid | 7f0b6774-6719-4d8a-bdc7-5f72f9876639 |
+-----------------------+--------------------------------------+
[root@node31 ~]# openstack baremetal node validate 698fb3e7-787c-47c1-863c-1f7e84f1b506
+------------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Interface | Result | Reason |
+------------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| boot | False | Cannot validate image information for node 698fb3e7-787c-47c1-863c-1f7e84f1b506 because one or more parameters are missing from its instance_info. Missing are: ['ramdisk', 'kernel', 'image_source'] |
| console | False | Missing 'ipmi_terminal_port' parameter in node's driver_info. |
| deploy | False | Cannot validate image information for node 698fb3e7-787c-47c1-863c-1f7e84f1b506 because one or more parameters are missing from its instance_info. Missing are: ['ramdisk', 'kernel', 'image_source'] |
| inspect | True | |
| management | True | |
| network | True | |
| power | True | |
| raid | True | |
| storage | True | |
+------------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@node31 ~]# openstack baremetal node manage 698fb3e7-787c-47c1-863c-1f7e84f1b506
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | manageable | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node provide 698fb3e7-787c-47c1-863c-1f7e84f1b506
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | available | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
节点状态变迁图
社区链接
https://docs.openstack.org/ironic/latest/contributor/states.html
状态
ENROLL: ironic知道节点存在,并没有进一步的action,一旦一个节点拥有driver和properties,通过manage API调用使节点过度到VERIFYING
VERIFYING: ironic验证是否可以通过分配的drivers(例如,电源状态管理)和证书管理节点
MANAGEABLE: 用driver和证书验证通过可以管理节点,电源power off可选的,从MANAGEABLE节点过度到
- MANAGEABLE(从CLEANING)通过clean API调用
- MANAGEABLE(从INSPECTING)通过inspect API调用
- AVAILABLE(从CLEANING)通过provide API调用
INSPECTING:根据硬件属性变更来更新硬件属性,来反应当前硬件的状态,失败则过度到INSPECTFAIL
CLEANING:清理以准备步入AVAILABLE,正确成功的CLEANING包括任务:
- 擦除驱动器
- 固件完整性验证
- 验证节点传入属性是否与实际硬件配置匹配
- booting到一个长时间运行的deploy ramdisk
当一个节点为CLEANING状态,意味着节点执行带外清理步骤,或者准备环境(建立PXE配置文件, 配置DHCP等)来boot randisk
CLEANWAIT:与CLEANING不同是conductor等待boot ramdisk, 在带内清理步骤,处于CLEANWAIT状态的节点可以被abort API调用中断
AVAILABLE:处于AVAILABLE状态的是已经被清理,重新配置的,准备好的可以用来provisioned,处于AVALIABLE状态节点可以过度:
- ACTIVE(从DEPLOYING)通过active API调用
- MANABGEABLE通过manage API调用
DEPLOYING:主要包括一系列短任务:
- 设置适当的BIOS配置
- 驱动器分区,生成文件系统
- 创建一些子系统需要的附加资源(网络配置等)
DEPLOYWAIT:已经DEPLOYED的,不同的是conductor等待boot ramdisk,或执行部分需要带内运行的部署工作(例如:安装bootloader,当没有使用iscsi写image到disk),处于DEPLOYWAIT状态的节点可以被deleted API调用中断
ACTIVE:裸机可以正常使用了
部署裸机节点
社区链接
https://docs.openstack.org/ironic/latest/admin/node-deployment.html
https://docs.openstack.org/ironic/latest/user/index.html
server状态变迁
BUILD——ACTIVE
node状态变迁
available——deploying——wait call-back——deploying——active——deleting——available
部署流程
- 部署物理机的请求通过 Nova API 进入Nova;
- Nova Scheduler 根据请求参数中的信息(指定的镜像和硬件模板等)选择合适的物理节点;通过flavor中extra_spec(比如cpu_arch, baremetal:deploy_kerner_id, baremmetal:deploy_ramdisk_id)
- Nova 创建一个 spawn 任务,并调用 Ironic API 部署物理节点,Ironic 将此次任务中所需要的硬件资源保留,并更新数据库;
- Ironic 与 OpenStack 的其他服务交互,从 Glance 服务获取部署物理节点所需的镜像资源,并调用 Neutron 服务为物理机创建网路端口;
- Ironic 开始部署物理节点,PXE driver 准备 tftp bootloader,IPMI driver 设置物理机启动模式并将机器上电;
- 物理机启动后,通过 DHCP 获得 Ironic Conductor 的地址并尝试通过 tftp 协议从 Conductor 获取镜像,Conductor 将部署镜像部署到物理节点上后,通过 iSCSI 协议将物理节点的硬盘暴露出来,随后写入用户镜像,成功部署用户镜像后,物理节点的部署就完成了。
实际操作
[root@node31 ~]# openstack server create --image e7d21978-73af-4a9e-9179-7c94970cab46 --flavor 162da6f1-80a1-41e6-8afc-fa097e66a3ae --nic net-id=f6564dac-f639-4c84-bd37-f1bbb99befc5 bm28
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | available | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | power off | deploying | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | power on | wait call-back | False |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | power on | deploying | False |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | power on | active | False |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | power on | deleting | False |
+--------------------------------------+------+--------------------------------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | available | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack server list
+--------------------------------------+-----------------+---------+------------------------+------------------------------------------------------+-----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-----------------+---------+------------------------+------------------------------------------------------+-----------+
| b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | bm28 | BUILD | pxe-net=172.30.250.102 | CentOS-7-x86_64-1810-qcow2 | node28 |
+--------------------------------------+-----------------+---------+------------------------+------------------------------------------------------+-----------+
[root@node31 ~]# openstack server list
+--------------------------------------+-----------------+---------+------------------------+------------------------------------------------------+-----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-----------------+---------+------------------------+------------------------------------------------------+-----------+
| b5b004de-1bbb-4ea9-9a1d-60d329165fb5 | bm28 | ACTIVE | pxe-net=172.30.250.102 | CentOS-7-x86_64-1810-qcow2 | node28 |
+--------------------------------------+-----------------+---------+------------------------+------------------------------------------------------+-----------+
[root@node31 ~]# openstack baremetal node show 698fb3e7-787c-47c1-863c-1f7e84f1b506
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| boot_interface | None |
| chassis_uuid | None |
| clean_step | {} |
| console_enabled | False |
| console_interface | None |
| created_at | 2020-12-24T11:05:57+00:00 |
| deploy_interface | None |
| driver | pxe_ipmitool |
| driver_info | {u'ipmi_password': u'******', u'ipmi_address': u'172.30.123.28', u'ipmi_username': u'USERID', u'deploy_kernel': u'54748425-9c58-4b43-8d31-44b13b26876a', u'deploy_ramdisk': u'e6e50527-8f7b-4a9f-baaa-3a78442814ef'} |
| driver_internal_info | {u'agent_cached_clean_steps_refreshed': u'2020-12-29 06:44:34.388709', u'agent_cached_clean_steps': {u'management': [{u'interface': u'management', u'priority': 0, u'step': u'update_firmware_sum'}], u'raid': [{u'interface': u'raid', u'priority': 0, u'step': u'delete_configuration'}, {u'interface': u'raid', u'priority': 0, u'step': u'create_configuration'}], u'deploy': [{u'priority': 99, u'interface': u'deploy', u'reboot_requested': False, u'abortable': True, u'step': u'erase_devices_metadata'}, {u'interface': u'deploy', u'priority': 0, u'step': u'erase_devices'}]}, u'clean_steps': None, u'hardware_manager_version': {u'generic_hardware_manager': u'3'}, u'is_whole_disk_image': True, u'agent_continue_if_ata_erase_failed': False, u'agent_erase_devices_iterations': 1, u'agent_erase_devices_zeroize': True, u'root_uuid_or_disk_id': u'0x000f17c3', u'agent_url': u'http://172.30.250.102:9999'} |
| extra | {} |
| inspect_interface | None |
| inspection_finished_at | 2020-12-29T06:28:02+00:00 |
| inspection_started_at | None |
| instance_info | {u'root_gb': u'372', u'display_name': u'bm28', u'image_source': u'e7d21978-73af-4a9e-9179-7c94970cab46', u'capabilities': u'{"mac": "08-94-ef-3c-8d-92", "boot_option": "local"}', u'memory_mb': u'393216', u'vcpus': u'48', u'local_gb': u'372', u'swap_mb': u'0', u'nova_host_id': u'node33-ironic'} |
| instance_uuid | a01ece89-aacb-446d-96dc-6f4bdfac4aa8 |
| last_error | None |
| maintenance | False |
| maintenance_reason | None |
| management_interface | None |
| name | bm28 |
| network_interface | flat |
| power_interface | None |
| power_state | power on |
| properties | {u'memory_mb': 393216, u'cpu_arch': u'x86_64', u'local_gb': 372, u'cpus': u'48', u'capabilities': u'boot_option:local,mac:08-94-ef-3c-8d-92'} |
| provision_state | active |
| provision_updated_at | 2020-12-29T07:29:03+00:00 |
| raid_config | {} |
| raid_interface | None |
| reservation | None |
| resource_class | None |
| storage_interface | noop |
| target_power_state | None |
| target_provision_state | None |
| target_raid_config | {} |
| updated_at | 2020-12-29T07:29:03+00:00 |
| uuid | 698fb3e7-787c-47c1-863c-1f7e84f1b506 |
| vendor_interface | None |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@node31 ~]# openstack server show a01ece89-aacb-446d-96dc-6f4bdfac4aa8
+-------------------------------------+-------------------------------------------------------------------+
| Field | Value |
+-------------------------------------+-------------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | node33-ironic |
| OS-EXT-SRV-ATTR:hypervisor_hostname | 698fb3e7-787c-47c1-863c-1f7e84f1b506 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000042 |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2020-12-29T07:29:03.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | pxe-net=172.30.250.102 |
| config_drive | |
| created | 2020-12-29T07:18:00Z |
| flavor | node28 (162da6f1-80a1-41e6-8afc-fa097e66a3ae) |
| hostId | 75cf68376cc1a22aa32e8d4badbe1517697d378108cdc7435bba223e |
| id | a01ece89-aacb-446d-96dc-6f4bdfac4aa8 |
| image | CentOS-7-x86_64-1810-qcow2 (e7d21978-73af-4a9e-9179-7c94970cab46) |
| key_name | None |
| name | bm28 |
| progress | 0 |
| project_id | 1afb00115a714e29a3eaa2effc257cf3 |
| properties | |
| security_groups | name='default' |
| status | ACTIVE |
| updated | 2020-12-29T07:29:03Z |
| user_id | 2d7ab342bc0949eda234adc23c364995 |
| volumes_attached | |
+-------------------------------------+-------------------------------------------------------------------+
[root@node31 ~]# openstack hypervisor show 698fb3e7-787c-47c1-863c-1f7e84f1b506
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| aggregates | [] |
| cpu_info | |
| current_workload | 0 |
| disk_available_least | 0 |
| free_disk_gb | 0 |
| free_ram_mb | 0 |
| host_ip | 172.30.126.33 |
| hypervisor_hostname | 698fb3e7-787c-47c1-863c-1f7e84f1b506 |
| hypervisor_type | ironic |
| hypervisor_version | 1 |
| id | 18 |
| local_gb | 372 |
| local_gb_used | 372 |
| memory_mb | 393216 |
| memory_mb_used | 393216 |
| running_vms | 1 |
| service_host | node33-ironic |
| service_id | 153 |
| state | up |
| status | enabled |
| vcpus | 48 |
| vcpus_used | 48 |
+----------------------+--------------------------------------+
[root@node31 ~]#
tftpboot配置文件信息
[root@node31 ~]# glance image-list
+--------------------------------------+------------------------------------------------------+
| ID | Name |
+--------------------------------------+------------------------------------------------------+
| e7d21978-73af-4a9e-9179-7c94970cab46 | CentOS-7-x86_64-1810-qcow2 | # 用户操作系统镜像
| e6e50527-8f7b-4a9f-baaa-3a78442814ef | ironic-deploy-centos7-pike-ywt.initramfs | # initrd文件系统
| 54748425-9c58-4b43-8d31-44b13b26876a | ironic-deploy-centos7-pike.kernel | #kernel镜像
+--------------------------------------+------------------------------------------------------+
(ironic-pxe)[root@node33 tftpboot]# pwd
/tftpboot
(ironic-pxe)[root@node33 tftpboot]# ll -rth
total 55M
-rw-r--r-- 1 ironic ironic 27K Dec 24 18:48 pxelinux.0 # pxelinux.0 pxe启动文件
-rw-r--r-- 1 ironic ironic 21K Dec 24 18:48 chain.c32
drwxr-xr-x 2 ironic ironic 182 Dec 28 13:49 master_images # kernel和initrd文件
-rw-r--r-- 1 root root 3.7M Dec 28 16:31 tinyipa-stable-pike.vmlinuz # 用于inspect发现的kernel镜像
-rw-r--r-- 1 root root 51M Dec 28 16:31 tinyipa-stable-pike-ywt.gz # 用于inspect发现的initrd镜像
drwxr-xr-x 2 ironic ironic 105 Dec 29 15:00 pxelinux.cfg #pxelinux.cfg配置文件
drwxr-xr-x 2 ironic ironic 63 Dec 29 15:00 698fb3e7-787c-47c1-863c-1f7e84f1b506 # 被部署裸机的id
(ironic-pxe)[root@node33 tftpboot]# ll -rth 698fb3e7-787c-47c1-863c-1f7e84f1b506/
total 312M
-rw-r--r-- 2 ironic ironic 305M Dec 28 13:49 deploy_ramdisk # e6e50527-8f7b-4a9f-baaa-3a78442814ef
-rw-r--r-- 2 ironic ironic 6.5M Dec 28 13:49 deploy_kernel # 54748425-9c58-4b43-8d31-44b13b26876a
-rw-r--r-- 1 ironic ironic 717 Dec 29 15:00 config
(ironic-pxe)[root@node33 tftpboot]# ll -rth pxelinux.cfg/
total 4.0K
-rw-r--r-- 1 ironic ironic 231 Dec 28 16:32 default
lrwxrwxrwx 1 ironic ironic 46 Dec 29 15:00 01-08-94-ef-3c-8d-92 -> ../698fb3e7-787c-47c1-863c-1f7e84f1b506/config
(ironic-pxe)[root@node33 tftpboot]# ll -rth master_images/
total 311M
-rw-r--r-- 2 ironic ironic 305M Dec 28 13:49 e6e50527-8f7b-4a9f-baaa-3a78442814ef
-rw-r--r-- 2 ironic ironic 6.5M Dec 28 13:49 54748425-9c58-4b43-8d31-44b13b26876a
(ironic-pxe)[root@node33 tftpboot]#
(ironic-pxe)[root@node33 pxelinux.cfg]# cat 01-08-94-ef-3c-8d-92 # 被部署裸机的部署配置信息
default deploy
label deploy
kernel 698fb3e7-787c-47c1-863c-1f7e84f1b506/deploy_kernel
append initrd=698fb3e7-787c-47c1-863c-1f7e84f1b506/deploy_ramdisk selinux=0 troubleshoot=0 text nofb nomodeset vga=normal console=tty0 console=ttyS0,115200n8 ipa-api-url=http://172.30.250.33:6385 coreos.configdrive=0
ipappend 3
label boot_partition
kernel no_kernel
append initrd=no_ramdisk root={{ ROOT }} ro text nofb nomodeset vga=normal console=tty0 console=ttyS0,115200n8
label boot_whole_disk
COM32 chain.c32
append mbr:{{ DISK_IDENTIFIER }}
label trusted_boot
kernel mboot
append tboot.gz --- no_kernel root={{ ROOT }} ro text nofb nomodeset vga=normal console=tty0 console=ttyS0,115200n8 intel_iommu=on --- no_ramdisk
(ironic-pxe)[root@node33 pxelinux.cfg]#
节点inspect(Hardware Inspection)
社区链接
https://docs.openstack.org/ironic/latest/admin/inspection.html
node状态变迁
manageable——inspecting——manageable
实际操作
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | available | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node manage 698fb3e7-787c-47c1-863c-1f7e84f1b506
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | manageable | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node inspect 698fb3e7-787c-47c1-863c-1f7e84f1b506
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | inspecting | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node show 698fb3e7-787c-47c1-863c-1f7e84f1b506
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| boot_interface | None |
| chassis_uuid | None |
| clean_step | {} |
| console_enabled | False |
| console_interface | None |
| created_at | 2020-12-24T11:05:57+00:00 |
| deploy_interface | None |
| driver | pxe_ipmitool |
| driver_info | {u'ipmi_password': u'******', u'ipmi_address': u'172.30.123.28', u'ipmi_username': u'USERID', u'deploy_kernel': u'54748425-9c58-4b43-8d31-44b13b26876a', u'deploy_ramdisk': u'e6e50527-8f7b-4a9f-baaa-3a78442814ef'} |
| driver_internal_info | {u'agent_cached_clean_steps_refreshed': u'2020-12-28 08:26:30.737833', u'agent_cached_clean_steps': {u'management': [{u'interface': u'management', u'priority': 0, u'step': u'update_firmware_sum'}], u'raid': [{u'interface': u'raid', u'priority': 0, u'step': u'delete_configuration'}, {u'interface': u'raid', u'priority': 0, u'step': u'create_configuration'}], u'deploy': [{u'priority': 99, u'interface': u'deploy', u'reboot_requested': False, u'abortable': True, u'step': u'erase_devices_metadata'}, {u'interface': u'deploy', u'priority': 0, u'step': u'erase_devices'}]}, u'clean_steps': None, u'hardware_manager_version': {u'generic_hardware_manager': u'3'}, u'is_whole_disk_image': True, u'agent_continue_if_ata_erase_failed': False, u'agent_erase_devices_iterations': 1, u'agent_erase_devices_zeroize': True, u'root_uuid_or_disk_id': u'0x000f17c3', u'agent_url': u'http://172.30.250.102:9999'} |
| extra | {} |
| inspect_interface | None |
| inspection_finished_at | 2020-12-29T06:28:02+00:00 |
| inspection_started_at | None |
| instance_info | {} |
| instance_uuid | None |
| last_error | None |
| maintenance | False |
| maintenance_reason | None |
| management_interface | None |
| name | bm28 |
| network_interface | flat |
| power_interface | None |
| power_state | power off |
| properties | {u'memory_mb': u'262144', u'cpu_arch': u'x86_64', u'local_gb': u'370', u'cpus': u'48', u'capabilities': u'cpu_vt:true,mac:08-94-ef-3c-8d-92,cpu_hugepages:true,boot_option:local,cpu_txt:true,cpu_aes:true,cpu_hugepages_1g:true'} |
| provision_state | manageable |
| provision_updated_at | 2020-12-29T06:28:02+00:00 |
| raid_config | {} |
| raid_interface | None |
| reservation | None |
| resource_class | None |
| storage_interface | noop |
| target_power_state | None |
| target_provision_state | None |
| target_raid_config | {} |
| updated_at | 2020-12-29T06:28:02+00:00 |
| uuid | 698fb3e7-787c-47c1-863c-1f7e84f1b506 |
| vendor_interface | None |
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@node31 ~]#
节点clean
社区链接
https://docs.openstack.org/ironic/latest/admin/cleaning.html
node状态变迁
manageable——cleaning——clean wait——cleaning——manageable
实际操作
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | available | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node manage 698fb3e7-787c-47c1-863c-1f7e84f1b506
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | manageable | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node clean 698fb3e7-787c-47c1-863c-1f7e84f1b506 --clean-steps '[{"interface": "deploy", "step": "erase_devices_metadata"}]'
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | cleaning | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
[root@node31 ~]# openstack baremetal node list
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 698fb3e7-787c-47c1-863c-1f7e84f1b506 | bm28 | None | power off | clean wait | False |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
注册部署裸机脚本参考
#!/bin/bash
set -o xtraceARCH=$(uname -m)
IMAGE_PATH=/opt/cache/files/
IMAGE_URL=http://172.16.193.5/images/standard/vm/cirros/
IMAGE=cirros-0.3.4-x86_64-disk.img
IMAGE_NAME=cirros
IMAGE_TYPE=linux# This EXT_NET_CIDR is your public network,that you want to connect to the internet via.
EXT_NET_CIDR='10.0.2.0/24'
EXT_NET_RANGE='start=10.0.2.150,end=10.0.2.199'
EXT_NET_GATEWAY='10.0.2.1'# Sanitize language settings to avoid commands bailing out
# with "unsupported locale setting" errors.
unset LANG
unset LANGUAGE
LC_ALL=C
export LC_ALL
for i in curl openstack; doif [[ ! $(type ${i} 2>/dev/null) ]]; thenif [ "${i}" == 'curl' ]; thenecho "Please install ${i} before proceeding"elseecho "Please install python-${i}client before proceeding"fiexitfi
done# Test for credentials set
if [[ "${OS_USERNAME}" == "" ]]; thenecho "No Keystone credentials specified. Try running source /etc/kolla/admin-openrc.sh command"exit
fi# Test to ensure configure script is run only once
if openstack image list | grep -q cirros; thenecho "This tool should only be run once per deployment."exit
fiecho Checking for locally available cirros image.
# Let's first try to see if the image is available locally
# nodepool nodes caches them in $IMAGE_PATH
if ! [ -f "${IMAGE_PATH}/${IMAGE}" ]; thenIMAGE_PATH='./'if ! [ -f "${IMAGE_PATH}/${IMAGE}" ]; thenecho None found, downloading cirros image.curl -L -o ${IMAGE_PATH}/${IMAGE} ${IMAGE_URL}/${IMAGE}fi
elseecho Using cached cirros image from the nodepool node.
fiEXTRA_PROPERTIES=
if [ ${ARCH} == aarch64 ]; thenEXTRA_PROPERTIES="--property hw_firmware_type=uefi"
fiecho Creating glance image.
openstack image create --disk-format qcow2 --container-format bare --public \--property os_type=${IMAGE_TYPE} ${EXTRA_PROPERTIES} --file ${IMAGE_PATH}/${IMAGE} ${IMAGE_NAME}echo Configuring neutron.
openstack network create --share --external --provider-physical-network physnet1 \--provider-segment 100 --provider-network-type vlan public1
openstack subnet create --no-dhcp \--allocation-pool ${EXT_NET_RANGE} --network public1 \--subnet-range ${EXT_NET_CIDR} --gateway ${EXT_NET_GATEWAY} public1-subnetopenstack network create --provider-network-type vxlan demo-net
openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net \--gateway 10.0.0.1 --dns-nameserver 8.8.8.8 demo-subnetopenstack router create demo-router
openstack router add subnet demo-router demo-subnet
openstack router set --external-gateway public1 demo-router# Get admin user and tenant IDs
ADMIN_USER_ID=$(openstack user list | awk '/ admin / {print $2}')
ADMIN_PROJECT_ID=$(openstack project list | awk '/ admin / {print $2}')
ADMIN_SEC_GROUP=$(openstack security group list --project ${ADMIN_PROJECT_ID} | awk '/ default / {print $2}')# Sec Group Config
openstack security group rule create --ingress --ethertype IPv4 \--protocol icmp ${ADMIN_SEC_GROUP}
openstack security group rule create --ingress --ethertype IPv4 \--protocol tcp --dst-port 22 ${ADMIN_SEC_GROUP}
# Open heat-cfn so it can run on a different host
openstack security group rule create --ingress --ethertype IPv4 \--protocol tcp --dst-port 8000 ${ADMIN_SEC_GROUP}
openstack security group rule create --ingress --ethertype IPv4 \--protocol tcp --dst-port 8080 ${ADMIN_SEC_GROUP}if [ ! -f ~/.ssh/id_rsa.pub ]; thenecho Generating ssh key.ssh-keygen -t rsa -f ~/.ssh/id_rsa
fi
if [ -r ~/.ssh/id_rsa.pub ]; thenecho Configuring nova public key and quotas.openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
fi# Increase the quota to allow 40 m1.small instances to be created# 40 instances
openstack quota set --instances 40 ${ADMIN_PROJECT_ID}# 40 cores
openstack quota set --cores 40 ${ADMIN_PROJECT_ID}# 96GB ram
openstack quota set --ram 96000 ${ADMIN_PROJECT_ID}# add default flavors, if they don't already exist
if ! openstack flavor list | grep -q m1.tiny; thenopenstack flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tinyopenstack flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.smallopenstack flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.mediumopenstack flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.largeopenstack flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
fiDEMO_NET_ID=$(openstack network list | awk '/ demo-net / {print $2}')cat << EOFDone.To deploy a demo instance, run:openstack server create \\--image ${IMAGE_NAME} \\--flavor m1.tiny \\--key-name mykey \\--nic net-id=${DEMO_NET_ID} \\demo1
EOFopenstack server create --image ${IMAGE_NAME} --flavor m1.tiny --key-name mykey --nic net-id=${DEMO_NET_ID} demo1sleep 30openstack volume create --size 5 voltestopenstack volume listopenstack server add volume demo1 voltest#
## test ironic env
#
BM_IMAGE_URL="http://172.16.193.5/ironic-images/rocky/"
BM_IMAGE_KERNEL="ironic-deploy-centos7-rocky.vmlinuz"
BM_IMAGE_RAMDISK="ironic-deploy-centos7-rocky.initramfs"
BM_IMAGE_OS="CentOS-7-x86_64-GenericCloud-1708-passw0rd.qcow2"
BM_IMAGE_KERNEL_NAME="ironic-deploy-centos7-rocky_vmlinuz"
BM_IMAGE_RAMDISK_NAME="ironic-deploy-centos7-rocky_initramfs"
BM_IMAGE_OS_NAME="CentOS-7-x86_64-GenericCloud-1708-passw0rd"
BM_IMAGE_KERNEL_UUID="7840c264-9b9c-4227-b548-71cfbe2f633a"
BM_IMAGE_RAMDISK_UUID="ec9183b2-3730-4cd1-9aaa-c9c1d5e992d2"
BM_IMAGE_OS_UUID="5255f0d8-198b-4484-8fcb-74ec38242d19"BM_NET_CIDR='192.168.40.0/24'
BM_NET_RANGE='start=192.168.40.201,end=192.168.40.230'
BM_NET_GATEWAY='192.168.40.1'if ! [ -f "${IMAGE_PATH}/${BM_IMAGE_KERNEL}" ]; thenIMAGE_PATH='./'if ! [ -f "${IMAGE_PATH}/${BM_IMAGE_KERNEL}" ]; thenecho "None found, downloading ${BM_IMAGE_KERNEL} image."curl -L -o ${IMAGE_PATH}/${BM_IMAGE_KERNEL} ${BM_IMAGE_URL}/${BM_IMAGE_KERNEL}fi
elseecho "Using cached ${BM_IMAGE_KERNEL} image from the nodepool node."
fi
if ! [ -f "${IMAGE_PATH}/${BM_IMAGE_RAMDISK}" ]; thenIMAGE_PATH='./'if ! [ -f "${IMAGE_PATH}/${BM_IMAGE_RAMDISK}" ]; thenecho None found, downloading ${BM_IMAGE_RAMDISK} image.curl -L -o ${IMAGE_PATH}/${BM_IMAGE_RAMDISK} ${BM_IMAGE_URL}/${BM_IMAGE_RAMDISK}fi
elseecho Using cached ${BM_IMAGE_RAMDISK} image from the nodepool node.
fi
if ! [ -f "${IMAGE_PATH}/${BM_IMAGE_OS}" ]; thenIMAGE_PATH='./'if ! [ -f "${IMAGE_PATH}/${BM_IMAGE_OS}" ]; thenecho None found, downloading ${BM_IMAGE_OS} image.curl -L -o ${IMAGE_PATH}/${BM_IMAGE_OS} ${BM_IMAGE_URL}/${BM_IMAGE_OS}fi
elseecho Using cached ${BM_IMAGE_OS} image from the nodepool node.
fiecho Creating glance image for ironic.
openstack image create --disk-format raw --container-format bare --public --id ${BM_IMAGE_KERNEL_UUID}\--property architecture=x86_64 --file ${IMAGE_PATH}/${BM_IMAGE_KERNEL} ${BM_IMAGE_KERNEL_NAME}
openstack image create --disk-format raw --container-format bare --public --id ${BM_IMAGE_RAMDISK_UUID}\--property architecture=x86_64 --file ${IMAGE_PATH}/${BM_IMAGE_RAMDISK} ${BM_IMAGE_RAMDISK_NAME}
openstack image create --disk-format qcow2 --container-format bare --public\▽--property architecture=x86_64 --property hypervisor_type=baremetal\--id ${BM_IMAGE_OS_UUID} --file ${IMAGE_PATH}/${BM_IMAGE_OS} ${BM_IMAGE_OS_NAME}echo Configuring neutron for ironic.
openstack network create --provider-physical-network physnet2 \--provider-network-type flat pxe-net
openstack subnet create \--allocation-pool ${BM_NET_RANGE} --network pxe-net \--subnet-range ${BM_NET_CIDR} --gateway ${BM_NET_GATEWAY} pxe-subnet
PXE_NET_ID=$(openstack network list | awk '/ pxe-net / {print $2}')echo reconfiguring ironic conductor.
for control_node in $( awk '/control/{print $2}' /etc/hosts ); doecho $control_nodessh -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o ConnectTimeout=10 ${control_node} "\test -f /etc/kolla/ironic-conductor/ironic.conf && \sed -i '/cleaning_network/ccleaning_network= ${PXE_NET_ID}' /etc/kolla/ironic-conductor/ironic.conf && \docker restart ironic_conductor" &
done
sleep 30echo Boot bare-metal node.
port=6260
terminal_port=6030
mac_t1="52-54-01-a0-b0-30"
mac_t2="52:54:01:a0:b0:30"
node_name="bm-30"
uuid=$(uuidgen)echo openstack baremetal node create.
openstack baremetal node create --driver ipmi --driver-info ipmi_address=192.168.121.1 --driver-info ipmi_port=${port} --driver-info ipmi_username=admin --driver-info ipmi_password=password --driver-info ipmi_terminal_port=${terminal_port} --driver-info deploy_kernel=${BM_IMAGE_KERNEL_UUID} --driver-info deploy_ramdisk=${BM_IMAGE_RAMDISK_UUID} --property capabilities=boot_option:local,mac:${mac_t1} --property cpus=2 --property memory_mb=2048 --property local_gb=20 --property cpu_arch=x86_64 --uuid ${uuid} --name ${node_name}openstack baremetal port create --node ${uuid} ${mac_t2}
openstack baremetal node validate ${uuid}
openstack baremetal node show ${uuid}openstack baremetal node manage ${uuid}
sleep 30
openstack baremetal node provide ${uuid}
sleep 30openstack flavor create ${node_name} --ram 2048 --disk 20 --vcpus 2 \--property "capabilities:boot_option"="local" \--property "cpu_arch"="x86_64" \--property "capabilities:mac"="${mac_t1}"sleep 30
echo openstack server create bm-demo1.
openstack server create --image ${BM_IMAGE_OS_UUID} --flavor ${node_name} --nic net-id=${PXE_NET_ID} bm-demo1echo openstack baremetal node list.
openstack baremetal node listecho openstack server list.
openstack server list
这篇关于Ironic注册/部署/inspect/clean节点操作记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!