vmware: keep IPs when guest tools report no interface at all - #567
Merged
Merged
Conversation
…tive IP removal Old TMOS builds (e.g. BIG-IP 11.5.0, 12.1.4.1) report VMware Tools as running but never populate per-NIC guest.net data. That caused every interface's NetBox IP assignment on those VMs to look "removed" on each sync cycle and get deleted, even though the guest is up and the IP is still live. Skip IP handling for a VM when guest.net comes back completely empty while tools report running; a real per-NIC removal still reports the NIC (just without an IP), so that case is unaffected. (cherry picked from commit 261e338)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Taken from #509 by @dirtycache, his commit is the first one here.
The bug is real and generic: when VMware Tools answer "running" but hand back an empty
guest.net, the sync reads that as "this VM has no addresses any more" and strips every IP-to-interface assignment it has in NetBox, every run. He saw it on old TMOS releases.I moved the guard, though. As written it set
skip_ip_handling, which also stops addresses being assigned, and it treated a missingguest.netthe same as an empty one - that broke four existing tests, where the caller passes the addresses in explicitly and the fake VM object has noguest.netat all. It now only suppresses the removal, and only whenguest.netis actually present and actually empty. A genuine removal still reports the interface without an address, so that path is untouched.tests/test_vmware_empty_guest_net.pyhas both sides: broken tools keep the address, an interface that really is empty still drops it. The first fails without the guard. Suite 143, and a sync against a real NetBox 4.7 is unchanged, 0 errors and a second run with 0 changes.The rest of #509 is a different matter - it has grown to 28 commits with vendor-specific handling for ACOS, TMOS and Alteon, plus DNS-based primary IP selection and VCSA metadata. I'll comment there separately.