Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: use arp when CIM returns no ip #117

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

junaid-ebrahim
Copy link

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.

@junaid-ebrahim junaid-ebrahim requested a review from a team as a code owner November 4, 2023 22:51
@hashicorp-cla
Copy link

hashicorp-cla commented Nov 4, 2023

CLA assistant check
All committers have signed the CLA.

@lbajolet-hashicorp
Copy link
Contributor

Hi @junaid-ebrahim,

Thanks for opening this one! Unfortunately we're not familiar enough with either Powershell or Hyper-V to provide meaningful feedback on this change, so we're calling out on our community for help on this review.

@remi-espie since you've been contributing to the plugin recently, any chance you have some Powershell knowledge that would help review this change?

@remi-espie
Copy link
Contributor

I don't have any machine running Windows 11, so I can't reproduce the bug.

I will try this PR using Windows 10 to ensure it doesn't break anything and come back to you.

@remi-espie
Copy link
Contributor

I've looked into it really fast but it does not work on Windows 10. I have the same following error: Error getting host adapter ip address: No ip address.
However, I also have this error with the packer-plugin-hyperv, so your PR might not be breaking anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants