-
Notifications
You must be signed in to change notification settings - Fork 8
feat(ironic): Add update_baremetal_port ironic inspection hook #1347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9ff91f9 to
21d33c6
Compare
30e1717 to
6038946
Compare
9949abc to
3b3481f
Compare
1d0d819 to
68ce0f1
Compare
9006136 to
3ade42b
Compare
ed99ae7 to
6dc2467
Compare
cardoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two suggestions that I'm fine if they don't happen.
| extra = baremetal_port.extra | ||
| current_bios_name = extra.get("bios_name") | ||
|
|
||
| if current_bios_name != required_bios_name: | ||
| LOG.info( | ||
| "Port %(mac)s updating bios_name from %(old)s to %(new)s", | ||
| {"mac": mac, "old": current_bios_name, "new": required_bios_name}, | ||
| ) | ||
|
|
||
| if required_bios_name: | ||
| extra["bios_name"] = required_bios_name | ||
| else: | ||
| extra.pop("bios_name", None) | ||
|
|
||
| baremetal_port.extra = extra | ||
| baremetal_port.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also unconditionally set baremetal_port.description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description is cool, however the "description" suggests to me "human readable" whereas this field is intended for a machine to consume. Parsing a description seems fragile because people might be tempted to add other "helpful" information in there.
Also, our openstack today doesn't seem to have a description field:
openstack --os-cloud=prod-infra baremetal port show 57951a4b-ae40-4e1a-9ff6-524e36ec976c
+-----------------------+---------------------------------------------------------+
| Field | Value |
+-----------------------+---------------------------------------------------------+
| address | c4:cb:e1:d5:92:54 |
| created_at | 2025-03-31T14:33:26+00:00 |
| extra | {} |
| internal_info | {} |
| is_smartnic | False |
| local_link_connection | {} |
| name | 57951a4b-ae40-4e1a-9ff6-524e36ec976c NIC.Embedded.1-1-1 |
| node_uuid | 11fe6307-3c25-47eb-911c-a470e6094913 |
| physical_network | None |
| portgroup_uuid | None |
| pxe_enabled | False |
| updated_at | None |
| uuid | 57951a4b-ae40-4e1a-9ff6-524e36ec976c |
+-----------------------+---------------------------------------------------------+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's intended for machines then I agree with the field in extra. As far as the field not showing up, upgrade your client.
9e7dfa3 to
40c284e
Compare
40c284e to
089cacc
Compare
After out-of-band inspection we run port-bios-name. The interface names returned by the BMC are generally more meaningful to the data center than the linux names we get in the agent inspection data After Agent Inspection we run update-baremetal-port. This consumes the LLDP information, so it must run after agent inspection. Out-of-band inspection doesn't give us the full LLDP data. The default ironic local-link-connection is removed because the new hook updates the same fields. We add "validate-interfaces" because that populates data we consume.
089cacc to
bb4bd7a
Compare
Understack operation requires that every baremetal node has baremetal ports for each NIC we want to use.
Upstream ironic includes inspection hooks which can create baremetal ports and set local_link_info based on LLDP information, but UnderStack requires that Baremetal ports have specific attributes populated:
In addition, the baremetal node should have traits indicating the networks (VLAN Groups) to which it is connected, for example if it has NICs connected to the
STORAGEswitch then we would add theCUSTOM_STORAGE_SWITCHtrait.Switch uplink connections for the node are identified during node inspection using LLDP. The "agent" inspector does this today, and we are enhancing the out-of-band inspection to provide the same data (where the hardware permits).
This inspection hook is understack-specific in that it assumes our switch hostnames will follow a certain naming convention, however the details of that convention are supplied as configuration.
We previously performed these activities as part of the "enrol" process, but performing these activities inside Ironic gives operators more visibility and allows them to drive remediation or updates via the openstack API. For example, if a physical node had cabling issues during enrol, these can be resolved and the node can be "inspected" to straighten out the baremetal ports without needing to trigger an external workflow or process.
Once this PR is done, we can remove those steps from the enrol process - see #1416
PREREQUISITES
Today when a node undergoes cleaning, provisioning or agent inspection, all but one of its ports are shut down. This defeats LLDP and prevents the inspection from seeing the link on the other ports. We need to change our network design/template so that during inspection all ports are UP (and talk LLDP) but don't have any other traffic. This includes ports already documented in ironic (being re-inspected) as well as ports that are currently unknown (ports being discovered and created in ironic for the first time).
NOTE that when these baremetal port updates occur, ironic emits events which should trigger a workflow to make corresponding changes in nautobot)