Open junaid-ebrahim opened 10 months ago
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?
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.
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.
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.