Skip to content

Conversation

@haseebsyed12
Copy link
Contributor

@haseebsyed12 haseebsyed12 commented Nov 19, 2025

Implement automatic synchronization of Ironic portgroups to Nautobot
as LAG (Link Aggregation Group) interfaces via Oslo event handlers.

  • Created portgroup event handler to sync portgroups to Nautobot LAG interfaces
  • LAG interfaces created with type="lag" and bonding mode in description

@haseebsyed12 haseebsyed12 force-pushed the ironic-portgroups-events branch from a2ecff9 to 0cac23c Compare November 20, 2025 04:15
@haseebsyed12 haseebsyed12 force-pushed the ironic-portgroups-events branch 6 times, most recently from 5fb1597 to cc64582 Compare November 21, 2025 14:22
@haseebsyed12 haseebsyed12 marked this pull request as ready for review November 21, 2025 14:23
@haseebsyed12 haseebsyed12 requested a review from a team November 21, 2025 14:23
Copy link
Contributor

@cardoe cardoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevekeay This will work with the rest of the code?

@cardoe cardoe requested a review from stevekeay November 22, 2025 01:02
Copy link
Contributor

@stevekeay stevekeay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

---EDIT: after I wrote the below I see that Doug Specified exactly this behavior in PUC-917, so obviously disregard this:

While I definitely agree that we should have consistent names and other data in openstack, I am not feeling at all good about the functionality that is being added here.

These workflows/event handlers have a simple job to do: fix up data in Nautobot to look like a mirror of what is in OpenStack.

If there is "bad" data in OpenStack then it should be fixed in OpenStack, for sure, but not here!

At most, bad data in OpenStack should elicit a warning in the log. If the object can't be created in Nautobot due to validation rules or uniqueness or whatever then we must mangle the data or drop the record as required.

The behaviour proposed here is like "autocorrect" -- if an object is created in OpenStack with a bad name it will be automatically and silently changed. I can only think that this is going to confuse the heck out of our future selves.

If we absolutely need this behaviour (and I don't think we do) then it should not be a hidden side-effect of the mirroring workflow, it should be a separate thing.

Comment on lines 165 to 174
logger.info("Existing LAG interface found in Nautobot, updating")
lag_intf.name = event.lag_name # type: ignore
lag_intf.status = "Active" # type: ignore
lag_intf.type = "lag" # type: ignore

if event.address:
lag_intf.mac_address = event.address # type: ignore

if event.mode:
lag_intf.description = f"Bond mode: {event.mode}" # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could DRY this out, maybe extract a function and call it with the dict that you defined above (**attrs).

Also this has several race conditions, although I don't know if the nautobot API allows us to do very much about them. Will the workflow retry on failure?

Copy link
Contributor Author

@haseebsyed12 haseebsyed12 Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding idempotent create with exception handling. Shall I also add retry strategy to openstack-oslo-event.yaml workflow template ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't know - I am not sure if our stack preserves the order of "events" at all, so there is a possibility that (for example) we will attempt to delete something that doesn't exist yet. I suspect that this scheme can result in drift between the two systems, and retries might help with that. Retries would also help with transient failures, e.g. a nautobot outage.

@haseebsyed12 haseebsyed12 force-pushed the ironic-portgroups-events branch 3 times, most recently from 901eb13 to f4a2a08 Compare November 26, 2025 01:32
@haseebsyed12 haseebsyed12 force-pushed the ironic-portgroups-events branch from f4a2a08 to 85e1fef Compare November 26, 2025 01:51
@haseebsyed12 haseebsyed12 changed the title feat: workflow to validate and rename ports and port groups feat: sync Ironic portgroups as LAG interfaces to Nautobot via Oslo event handlers Nov 26, 2025
@haseebsyed12 haseebsyed12 added this pull request to the merge queue Nov 26, 2025
Merged via the queue into main with commit 154def1 Nov 26, 2025
40 checks passed
@haseebsyed12 haseebsyed12 deleted the ironic-portgroups-events branch November 26, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants