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

Invalid ip address fix #193

Merged
6 commits merged into from
May 17, 2016
Merged

Invalid ip address fix #193

6 commits merged into from
May 17, 2016

Conversation

Jkovarik
Copy link
Member

Fix in response to #192

Adds an configurable option to allow the plugin to filter the machine network interfaces for one with an actual adapter and return that IP instead of the vsphere primary ip address.

Jkovarik added 3 commits May 17, 2016 00:34
… behavior when obtaining the ssh IP address

This commit adds an option that forces get_ssh_ip to filter the vm.guest.net entries for a network adapter that ‘exists’ on the VM, as vsphere does not always return the correct primary ipAddress if new interfaces have been defined at provision time or later.   We encountered the situation at NSIDC when provisioning VMs which were running docker/docker-compose and had docker-defined internal interfaces that vsphere picked up and assumed were the primary IP.  

This will not address situations where users have defined a VM with multiple ‘legitimate’ interfaces, and throws an error if that situation is encountered.
@app.call env
end

private

def filter_guest_nic(vm, machine)
return vm.guest.ipAddress unless machine.provider_config.real_nic_ip
adapters = vm.guest.net.select { |g| g.deviceConfigId > 0 }.map { |g| g.ipAddress[0] }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the map call here will end up giving us an array of IP addresses, not adapter objects. If I'm reading this correctly, adapters should be renamed to ips or something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent point. Will update accordingly.

-  Bump version should be a minor rev, not a patch - updated/tagged accordingly
-  Updated variable name from adapter to ip_addresses for clarity
-  Move error text into localization yaml
@@ -1,3 +1,8 @@
## [1.9.0 (2016-05-17)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.8.2)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed a spot (in the link url)

@ghost ghost merged commit a9aba02 into master May 17, 2016
@ghost ghost deleted the invalid_ip_address_fix branch May 17, 2016 18:12
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant