bugfix: use arp when CIM returns no ip #117
Open
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.
On windows 11 pro using the "Default Switch" or any other internal switch I notice that Ubuntu VMs hang at the step "Waiting for SSH to become available...". I believe that this is because we rely on CIM Hyper-V calls that fail to return IP addresses of running machines, they do however return MAC addresses. This could be due to many factors but most likely the requirement for Hyper-V extensions needed to be loaded on linux guest VMs.
This change resolves the issue by doing an ARP table mac address lookup and comparing it to the Hyper-V VM's first NIC mac, then finding the first IPv4 address. This resolved my issue, and is just an additional check to perform before giving up on SSH ip lookup.
Can be improved and re-written if IPv6 and Multi-Nic logic is needed but my case was a simple one.