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

DHCP/IPv6 Issue Fix? #84

Open
kbrowns opened this issue Jul 31, 2016 · 6 comments
Open

DHCP/IPv6 Issue Fix? #84

kbrowns opened this issue Jul 31, 2016 · 6 comments

Comments

@kbrowns
Copy link

kbrowns commented Jul 31, 2016

We're looking at moving to chef-provisioning-vsphere from knife-vsphere. One thing we hit with knife-vsphere was that sometimes the query happening under the covers to get the guest's IP address would sometimes return the IPv6 first. I experienced this same issue with chef-provisioning-vsphere during my playing and it bombs with something like this:

RI::InvalidURIError: machine[server02] (setup_vm::default line 52) had an error: URI::InvalidURIError: the scheme http does not accept registry part: fe80::c9bb:d19a:ed30:2443:5985 (or bad hostname?)

I noticed this was reported with Issue 67. The advise there was to disable IPv6. I found a few other mentions of this category of problem in

I made a small tweak to lib/chef/provisioning/vsphere_driver/driver.rb that seems to have fixed this. This is in general the same logic we have in place in the knife-vsphere processing. I changed this:

    def wait_until_ready(action_handler, machine_spec, machine_options, vm)
      if vm.guest.toolsRunningStatus != "guestToolsRunning"
        if action_handler.should_perform_actions
          action_handler.report_progress "waiting for #{machine_spec.name} (#{vm.config.instanceUuid} on #{driver_url}) to be ready ..."
          until remaining_wait_time(machine_spec, machine_options) < 0 ||
            (vm.guest.toolsRunningStatus == "guestToolsRunning" && !vm.guest.ipAddress.nil? && vm.guest.ipAddress.length > 0) do
            print "."
            sleep 5
          end
          action_handler.report_progress "#{machine_spec.name} is now ready"
        end
      end
    end

to this:

    def wait_until_ready(action_handler, machine_spec, machine_options, vm)
      if vm.guest.toolsRunningStatus != "guestToolsRunning"
        if action_handler.should_perform_actions
          action_handler.report_progress "waiting for #{machine_spec.name} (#{vm.config.instanceUuid} on #{driver_url}) to be ready ..."
          until remaining_wait_time(machine_spec, machine_options) < 0 ||
            (vm.guest.toolsRunningStatus == "guestToolsRunning" &&
              !vm.guest.ipAddress.nil? &&
                vm.guest.ipAddress.length > 0 &&
                  vm.guest.ipAddress.split('.').length == 3) do # ******* check it's an IPv4 address *******
            print "."
            sleep 5
          end
          action_handler.report_progress "#{machine_spec.name} is now ready"
        end
      end
    end

I'm happy to submit this as a PR and sex it up with some regex, but before I do I wanted to check w/ the community that this is an appropriate fix to the problem.

@mwrock
Copy link
Contributor

mwrock commented Jul 31, 2016

That seems reasonable. Are you on version 0.8.4? So do you find that an ipv6 address is assigned to the vm and then eventually it gets an ipv4 address?

@kbrowns
Copy link
Author

kbrowns commented Jul 31, 2016

Yes 0.8.4

Yes that's the behavior I see. I actually see this happen randomly in
all three contexts: knife-vsphere; chef-provisioning-vsphere; and
vsphere web client

In the web client context I see that ipv6 will occasionally show first
as the lonely ip and then anywhere between 1 and 20 seconds later it
refreshes and shows two ip's with IPv4 then taking the primary slot.
This is inconsistent behavior but far from rare for me.

On Sun, Jul 31, 2016, at 04:33 PM, Matt Wrock wrote:

That seems reasonable. Are you on version 0.8.4? So do you find that
an ipv6 address is assigned to the vm and then eventually it gets an
ipv4 address?
— You are receiving this because you authored the thread. Reply to
this email directly, view it on GitHub[1], or mute the thread[2].

Links:

  1. DHCP/IPv6 Issue Fix? #84 (comment)
  2. https://github.com/notifications/unsubscribe-auth/AAvFA-YMRHARqzA6tMAtxA4makZyf2H7ks5qbQaIgaJpZM4JZG0E

@mwrock
Copy link
Contributor

mwrock commented Aug 1, 2016

I think ip_to_bootstrap may be a better place.

@bender-the-greatest
Copy link

@mwrock I submitted a PR for this feature (in ip_to_bootstrap as requested above).

@kbrowns
Copy link
Author

kbrowns commented Nov 14, 2016

This is great - would love to see this incorporated. I was neck deep in this in the past, but got distracted as we were looking to go another direction.

@josh-barker
Copy link

+1

When might this be merged?

jjlimepoint pushed a commit to jjlimepoint/chef-provisioning-vsphere that referenced this issue Jul 13, 2018
…l-disks-added-twice

Fixes bug where additional disks added twice
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

No branches or pull requests

4 participants