Open jkugler opened 5 years ago
Looks like some caching could be done here: https://github.com/nsidc/vagrant-vsphere/blob/master/lib/vSphere/cap/public_address.rb
Another example where it found the good address, but when asked for it later, returned a bad address.
-----> Creating <source-rhel-6-bento>...
Bringing machine 'default' up with 'vsphere' provider...
==> default: Calling vSphere CloneVM with the following settings:
==> default: -- Template VM: B5 Lab - OpSun/vm/CICD/bento-rhel-6.10-x86_64-LATEST
==> default: -- Target VM: B5 Lab - OpSun/vm/CICD/source-rhel-6-bento-testing-utils-1549399882-d7
==> default: New virtual machine successfully cloned
==> default: Waiting for the machine to report its IP address...
default: Timeout: 240 seconds
default: IP: 10.199.251.191
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 10.199.251.191:22
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Setting hostname...
==> default: Machine not provisioned because `--no-provision` is specified.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #create action: [Invalid argument - connect(2) for [fe80::250:56ff:fe97:52b4]:22] on source-rhel-6-bento
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
As a work-around for this issue, disabling IPv6 on the guest images (whether VMs or templates) seems to fix the issue.
I have a very odd case. I'm using vagrant with vCenter, and using rsync folders. Most of the time it works, but some times the VM will boot, properly report its IPv4 address, swap out the ssh keys, but when it goes to connect for the rsync, it tries to use the VM's link-local address, and fails. Like so (please forgive the Jenkins copy/paste)
It had the "good" IPv4 address, and it worked. Then it got the IPv6 link-local address from somewhere, which did not work. Can we cache the first-reported address? Or ignore link-local addresses, and ask again? I guess some environments do use link local addresses, so discarding may not be the best course of action. But caching the address first acquired seems like a sane thing to do.