Skip to content

Feature/source openstack - #633

Merged
semx merged 21 commits into
bb-Ricardo:developmentfrom
ekrichbaum:feature/source-openstack
Nov 15, 2026
Merged

semx merged 21 commits into
bb-Ricardo:developmentfrom
ekrichbaum:feature/source-openstack

Conversation

@ekrichbaum

Copy link
Copy Markdown

Re-base on development.

Document the setup and configuration for VMware source integration with NetBox, including user roles, object synchronization, and filtering options.
This test file implements various tests for OpenStack discovery against fake SDK resources and real NetBox models, including authentication, resource handling, and filtering.
Added OpenStack source configuration with various settings.
Added OpenStack as a new source type with installation details.
Updated documentation to reflect OpenStack source configuration and usage, replacing VMware references with OpenStack-specific details.
Added support for OpenStack dependencies in the Dockerfile.
@semx

semx commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the rebase, CI is green again. With #615 in, servers with the same name in two availability zones now keep their own disks, so that point is done.

module/sources/openstack/connection.py is byte for byte the last head of #616 though, so the other points are still open. I re-ran them on this branch with openstacksdk 4.22.0:

  • two ports on private, detach the first: vNIC2 (private) still loses 10.0.0.42 to vNIC1 (private)
  • the port on private replaced by one on public: the interface stays vNIC1 (private) with description vNIC1 (public)
  • openstack.connect() still has no load_yaml_config=False, load_envvars=False: with OS_INTERFACE=admin the source uses the admin endpoints, and with OS_CLOUD set it fails with Region RegionOne is not a valid region name for cloud …

The new paragraphs in docs/source_openstack.md describe these as fixed, plus a stale-IP repair for all_projects that isn't in the code. load_envvars, load_yaml_config, repair and orphan don't appear in connection.py, and the PR doesn't touch the shared code. Could you push the code those paragraphs describe, or drop them? The docs should only cover what the source actually does. The merge-time items from my last review stay on our side.

@ekrichbaum

Copy link
Copy Markdown
Author

I'll re-check that pulled branch to see where those changes were missed to validate. My tests take several hours to run due to the volume of machines I'm working with so I'm hoping it is fairly obvious. Each time I have to rebase adds several hours to that process in order to unmerge and remerge from my consolidated version.

SDK configuration: Prevents OS_* variables and clouds.yaml from overriding source settings.
VM interfaces: Matches existing ports by MAC, preserving the surviving port’s IP when another is detached and updating the name when a port is replaced.
Stale IPs: Checks the complete server snapshot, ownership and IP uniqueness before allowing reassignment. This part depends on the shared-source hook
Added tests for detaching ports and handling stale IPs.
Add method to check if stale IP can be reassigned.
Refactor service_object method to simplify matching logic and remove legacy handling.

Remove patched version from other fix
@ekrichbaum

Copy link
Copy Markdown
Author

that was annoying because when I replaced the files I had to back out the separated fix again as well.

semx added 3 commits November 15, 2026 12:28
…e stale IP guards

Also drops the local copy of object_synced_by_other_source, dumps
service_details as the dict it is and sends the netbox-sync version.
A new server that got the address of a deleted one was matched to the
deleted server's VM by its primary IP and renamed, so the stale IP repair
never ran. A VM found that way is skipped now if it stores another server
UUID. The kept interface also gets its name as description again.
@semx
semx merged commit 4c2b879 into bb-Ricardo:development Nov 15, 2026
1 check passed
@semx

semx commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks, this closes the three points from the review. Before merging I ran it against a DevStack all-in-one (stable/2026.2) syncing into NetBox 4.7.5. The run covered:

  • the hypervisor and VMs in nova while the host is also in internal
  • two networks, two ports on one network, IPv6 and a floating IP
  • an attached volume, boot from volume and SHUTOFF
  • the same name in two projects
  • all_projects, the VM and cluster filters, the relations, custom attributes and set_vm_name_to_uuid

Reruns wrote nothing, apart from setting the new primary IP one run after a port swap.

That run found two more things, fixed in the commits I pushed on top:

  • A new server that got the fixed IP of a deleted one was matched to the deleted server's VM by its primary IP and renamed into it, so the stale IP repair never ran. A VM found by MAC or primary IP is not reused now if it stores another server UUID, and the address moves over through the repair.
  • A VM with two NetBox interfaces sharing a MAC raised a ValueError that nothing caught, so the whole run stopped. That port now falls back to name matching with a warning.

The other commits:

  • add tests for the stale IP guards (before, every check except all_projects could be dropped with the tests still green)
  • keep the description of a kept interface equal to its name
  • do the merge-time items from my earlier review: openstacksdk==4.22.0 with uv.lock, no removed-settings block, no local object_synced_by_other_source, the DEBUG3 dump, app_version, the copyright headers, and you in CODEOWNERS for the source and its docs

Merged as a squash. Disk sizes stay in decimal MB as documented.

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.

2 participants