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

chef-client failed when docker interface IP is returned by vm.guest.ipAddress #92

Open
jessehu opened this issue Aug 29, 2018 · 0 comments

Comments

@jessehu
Copy link

jessehu commented Aug 29, 2018

Versions:

  • Version of Chef-Provisioning: 2.7.1
  • Version of Chef-Provisioning-vSphere: 2.3.1

Platform Details

  • Version of vSphere/vCenter: 6.5.0

Scenario:

In my Ubuntu 16.04.2 VM created by chef-provisioning-vsphere, there is a network interface 'docker0' created for docker. Its IP 172.17.0.1 will be displayed on vSphere Client and returned by vm.guest.ipAddress.

$ ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:b7:b2:67:04  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ens192    Link encap:Ethernet  HWaddr 00:50:56:b7:97:ad  
          inet addr:10.192.73.189  Bcast:10.192.95.255  Mask:255.255.224.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:102675064 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3118171 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:27109757101 (27.1 GB)  TX bytes:20799244852 (20.7 GB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:176 errors:0 dropped:0 overruns:0 frame:0
          TX packets:176 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:16409 (16.4 KB)  TX bytes:16409 (16.4 KB)

After adding the following configuration in /etc/vmware-tools/tools.conf, the vSphere Client will not display docker0 IP, but only the expected ens192 IP. However, when powering on the VM, there is still a few seconds that vSphere Client gets docker0 IP and displays it, and it's captured by chef-provisioning-vsphere's vm.guest.ipAddress call. Then chef-provisioning-vsphere still use 172.17.0.1 to connect to the VM. If stop the stuck chef-client and run again, chef-client will get the expected IP of ens192.

[guestinfo]
exclude-nics=docker*,veth*

In order to bypass this issue, I changed this line https://github.com/chef-partners/chef-provisioning-vsphere/blob/master/lib/chef/provisioning/vsphere_driver/driver.rb#L651 to:

(vm.guest.toolsRunningStatus == "guestToolsRunning" && vm.guest.ipAddress && !vm.guest.ipAddress.start_with?("172") && !vm.guest.ipAddress.empty?)
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

1 participant