Repository navigation
fix(VMware): query network hints of all host NICs - #581
Conversation
QueryNetworkHint() expects an optional list of device names. Passing "" makes vCenter look up a NIC with an empty name and raise vim.fault.NotFound, which was silently ignored. As a result no CDP/LLDP data was ever read: the neighbor info was missing from the pNIC descriptions and sync_host_cables never created any cables. Call QueryNetworkHint() without arguments and log a failing query instead of discarding it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
semx
left a comment
There was a problem hiding this comment.
Thanks, this is right, and it took someone with a real vCenter to see it.
I checked what pyVmomi sends (vcsim -trace): QueryNetworkHint("") goes out as <device></device>, one NIC with an empty name, which vCenter answers with NotFound; QueryNetworkHint() and ([]) send no device element at all. A plain string such as "vmnic0" is serialized as a single element, which is why the per-NIC calls from #535 worked. I brought the "" from #350 back in #565 to save those round trips and only checked it against vcsim, which ignores the argument and returns whatever the capture holds (simulator/host_network_system.go, QueryNetworkHint). That is also why the suite stayed green; a test that answers the call the way vCenter does follows separately.
Two small things, neither blocks: {e} of a pyVmomi fault is a multi-line dump in the log, e.msg is the one-line text. And the branch is off main, so the PR carries the CODEOWNERS commit along; development already has it and the merge is clean, but please branch from development next time, main only receives releases.
QueryNetworkHint("")raisesvim.fault.NotFoundon every host, so no CDP/LLDP data is read andsync_host_cablesnever creates cables. Call it without arguments and log a failing query instead of silently ignoring it.Tested against vCenter 8.0.3 / NetBox 4.7.2: cables are created and CDP neighbors show up in the pNIC descriptions again.
Fixes #580
🤖 Generated with Claude Code