Skip to content

fix: skip_host_nics must skip only the physical interfaces, not the host - #555

Merged
semx merged 2 commits into
developmentfrom
fix/skip-host-nics
Sep 9, 2026
Merged

fix: skip_host_nics must skip only the physical interfaces, not the host#555
semx merged 2 commits into
developmentfrom
fix/skip-host-nics

Conversation

@semx

@semx semx commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #442, raised in its review.

The early return sat in add_host() before the host is added to the inventory, so with skip_host_nics = True the whole host was dropped instead of just its physical interfaces. Verified with the vcsim suite: on current development the option leaves zero hosts; with this change the hosts, their VMkernel interfaces and the VMs are synced and only the pNICs are skipped. The vswitch/port-group data is still collected because the VM interface parsing relies on it.

Also adds the option to settings-example.ini, which #442 did not, and documents that existing physical interfaces are no longer updated by the source once the option is on.

Test: tests/test_vmware_skip_host_nics.py fails on development (no hosts) and passes here. Full suite green.

@bb-Ricardo

Copy link
Copy Markdown
Owner

This appears to add the missing parts for #442.

And I would leave it as it is. If the user decides to flip this option once hosts are already synced then the user needs to decide what to do with the inconstent data. You could keep the interfaces by removing the source tag, or just let netbox-sync take care of it and delete orphan objects.

Not sure what's the better approach here.

@semx
semx merged commit e76db2d into development Sep 9, 2026
1 check passed
@semx

semx commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Agreed. I put exactly those two choices into the example-config comment (remove the source tag to keep the interfaces, or let the prune run remove them as orphaned) and merged after CI.

@semx

semx commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

One option to avoid the inconsistent state altogether, if you want it: while skip_host_nics is on, the host's existing physical interfaces are still claimed by the source (marked as seen in this run) without being updated. They are then neither modified nor tagged orphaned, and switching the option off simply resumes the updates. That is the same rule #545 applies to check_redfish inventory items a scan reports none of, and #550 to IPs the source cannot see, so it would be consistent with what the code already does elsewhere.

Three possible behaviours, for you to pick:

  1. as merged now: interfaces become unreported; the user removes the source tag to keep them or lets prune remove them;
  2. claim but don't update (above): no data change, no manual step, reversible;
  3. release: the source removes its own tag from those interfaces when the option is on, so they become user-managed.

I'd go with 2, it is the only one that needs no decision from the user and loses nothing. If you agree I'll send it as a small follow-up with a test; if you prefer 1, nothing to do.

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