BerlinVagrant / vagrant-dns

A plugin to manage DNS records for vagrant environments
MIT License
489 stars 50 forks source link

Getting dynamic IP fails when starting multiple hosts #78

Closed mattiasb closed 1 year ago

mattiasb commented 1 year ago

Hey!

With the latest 2.4.0 release vagrant-dns works really great compared to Landrush on Fedora and Ubuntu. Thanks for that!

One issue a colleague saw today was that given three VMs (kub01.test – kub03.test) the following:

$ vagrant up /kub/ # Or: vagrant up kub0{1..3}.test

... gets the correct IP for only one of the machines. Which one that is, seems to be a race condition.

For now we just do either:

$ for i in 1 2 3; do vagrant up kub0${i}.test; done

... or ...

$ vagrant up /kub/ && vagrant dns -r

I tried to understand where the issue comes from but failed unfortunately.

fnordfish commented 1 year ago

Do you see any logs? They should be VM specific and look like that:

"[vagrant-dns] Identified DHCP IP as '#{ip}'." or "[vagrant-dns] Could not identify DHCP IP."

mattiasb commented 1 year ago

I was a bit stressed when I was looking at the code earlier so it didn't click why I didn't see the messages you mention. Because I saw the debug calls in the code.

I'll re-run with VAGRANT_LOG=info set tomorrow! ☺️

mattiasb commented 1 year ago

I'm actually stuck not being able to start several machines at the same time due to vagrant-libvirt/vagrant-libvirt#1445 (and Fedora having a very old version of vagrant-libvirt still). I had forgotten that (and I never start several machines at the same time myself). My colleague got a log though, one sec.

mattiasb commented 1 year ago

I searched the logs and it only found an IP address for kub02.test (even though kub01.test and kub03.test was started at the same time):

$ grep "Identified DHCP IP" ./kubes.vagrant.log 
==> kub02.test: [vagrant-dns] Identified DHCP IP as '192.168.121.183'.
 INFO interface: info: [vagrant-dns] Identified DHCP IP as '192.168.121.183'.
 INFO interface: info: ==> kub02.test: [vagrant-dns] Identified DHCP IP as '192.168.121.183'.

Logs

We generated the logs like this:

$ export VAGRANT_LOG=info
$ vagrant up /kub/ |& tee kubes.vagrant.log

kubes.vagrant.log