<div dir="ltr">This is where the ID is retrieved and stored: <a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/create_vm.rb#L79">https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/create_vm.rb#L79</a><br><div><br></div><div>workflow is: create, wait til disks are OK, wait until vm status is "down", create network interfaces[1], start vm[2], wait until up[3]</div><div><br></div><div>[1] <a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/create_network_interfaces.rb#L53">https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/create_network_interfaces.rb#L53</a></div><div>[2] <a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/start_vm.rb#L83">https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/start_vm.rb#L83</a></div><div>[3] <a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/wait_till_up.rb#L43">https://github.com/myoung34/vagrant-ovirt4/blob/master/lib/vagrant-ovirt4/action/wait_till_up.rb#L43</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 7, 2017 at 11:34 AM, Juan Hernández <span dir="ltr"><<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 03/07/2017 06:06 PM, Marc Young wrote:<br>
> Completely isolated docker containers. Jenkins basically runs two<br>
> separate calls to docker...<br>
><br>
> [vagrant-1.9.1] $ docker run -t -d -u 997:994 -v /opt/gemcache:/opt/gemcache -w /var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ -v /var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ:/var/<wbr>lib/jenkins/workspace/oung34_<wbr>vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ:rw -v /var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ@tmp:/<wbr>var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat myoung34/vagrant:1.9.1<br>
> [Pipeline] [vagrant-1.9.1] {<br>
><br>
><br>
><br>
> [Pipeline] [vagrant-1.9.2] withDockerContainer [vagrant-1.9.2] $ docker run -t -d -u 997:994 -v /opt/gemcache:/opt/gemcache -w /var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ -v /var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ:/var/<wbr>lib/jenkins/workspace/oung34_<wbr>vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ:rw -v /var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ@tmp:/<wbr>var/lib/jenkins/workspace/<wbr>oung34_vagrant-ovirt4_PR-79-<wbr>7BRKVM5TQ5BGPECFMXYIEOYZOICCET<wbr>4GY37WXT4D65NSV4F5TADQ@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat myoung34/vagrant:1.9.2<br>
><br>
><br>
> Each of those containers in turn runs:<br>
><br>
><br>
> +gem build *.gemspec<br>
> +/usr/bin/vagrant plugin install *.gem<br>
</span>> +bundle install --path /opt/gemcache --without development plugins<br>
<span class="">> +bundle exec kitchen destroy all<br>
> +rm -rf .kitchen<br>
</span>> +sleep \$(shuf -i 0-10 -n 1) #i did this to see if maybe i could<br>
> stagger the creates<br>
> +export VAGRANT_VERSION=\$(echo ${vagrantVersion} | sed 's/\\.//g')<br>
> +bundle exec kitchen test ^[^singleton-]<br>
<span class="">><br>
><br>
> On Tue, Mar 7, 2017 at 11:01 AM, Juan Hernández <<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
</span><div><div class="h5">> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>>> wrote:<br>
><br>
> On 03/07/2017 05:42 PM, Marc Young wrote:<br>
> > I've been fighting this for roughly two days and I'm starting to think<br>
> > that possibly it's not my code but an interaction with the server.<br>
> ><br>
> > I'm using test-kitchen[1] with the kitchen-vagrant[2] driver to spin up<br>
> > vagrant machines and run tests against them. I'm using Jenkins to run<br>
> > kitchen in containers in parallel.<br>
> ><br>
> > Basically Jenkins runs a docker container with ruby + vagrant 1.9.2 and<br>
> > runs kitchen test all at the same time as another container with ruby +<br>
> > vagrant 1.9.1.<br>
> ><br>
> > If I run these in parallel, on some occasions the server seems to<br>
> > respond with the wrong creation information. If you look at the logs<br>
> > here: <a href="http://home.blindrage.us:8080/job/myoung34/job/vagrant-ovirt4/view/change-requests/job/PR-79/41/console" rel="noreferrer" target="_blank">http://home.blindrage.us:8080/<wbr>job/myoung34/job/vagrant-<wbr>ovirt4/view/change-requests/<wbr>job/PR-79/41/console</a><br>
> <<a href="http://home.blindrage.us:8080/job/myoung34/job/vagrant-ovirt4/view/change-requests/job/PR-79/41/console" rel="noreferrer" target="_blank">http://home.blindrage.us:<wbr>8080/job/myoung34/job/vagrant-<wbr>ovirt4/view/change-requests/<wbr>job/PR-79/41/console</a>><br>
> > <<a href="http://home.blindrage.us:8080/job/myoung34/job/vagrant-ovirt4/view/change-requests/job/PR-79/41/console" rel="noreferrer" target="_blank">http://home.blindrage.us:<wbr>8080/job/myoung34/job/vagrant-<wbr>ovirt4/view/change-requests/<wbr>job/PR-79/41/console</a><br>
> <<a href="http://home.blindrage.us:8080/job/myoung34/job/vagrant-ovirt4/view/change-requests/job/PR-79/41/console" rel="noreferrer" target="_blank">http://home.blindrage.us:<wbr>8080/job/myoung34/job/vagrant-<wbr>ovirt4/view/change-requests/<wbr>job/PR-79/41/console</a>>><br>
> ><br>
> ><br>
> > the container for vagrant 1.9.1 created a VM `vagrant-dynamic-1.9.1:<br>
> ><br>
> > [vagrant-1.9.1] Bringing machine 'default' up with 'ovirt4' provider...<br>
> ><br>
> > [vagrant-1.9.1] ==> default: Creating VM with the following settings...<br>
> ><br>
> > [vagrant-1.9.1] ==> default: -- Name: dynamic-1.9.1<br>
> ><br>
> ><br>
> > And the container for vagrant 1.9.2 (nearly the same time) created a VM<br>
> > `vagrant-dynamic-1.9.2`:<br>
> ><br>
> > [vagrant-1.9.2] ==> default: Creating VM with the following settings...<br>
> ><br>
> > [vagrant-1.9.2] ==> default: -- Name: dynamic-1.9.2<br>
> ><br>
> > [vagrant-1.9.2] ==> default: -- Cluster: Default<br>
> ><br>
> ><br>
> > If you look at the ss:<br>
> ><br>
> > the container 1.9.1 will wait for dynamic-1.9.1 and try to contact it at<br>
> > 192.168.2.54<br>
> ><br>
> > the container 1.9.2 will wait for dynamic-1.9.2 and try to contact it at<br>
> > 192.168.2.55<br>
> ><br>
> > But if you look at the logs, the 1.9.1 container started trying to work<br>
> > with 192.168.2.55 by creating a new key then talking to it:<br>
> ><br>
> > [vagrant-1.9.1] default: Key inserted! Disconnecting and reconnecting using new SSH key...<br>
> ><br>
> > [vagrant-1.9.1] Waiting for SSH service on<br>
</div></div>> <a href="http://192.168.2.55:22" rel="noreferrer" target="_blank">192.168.2.55:22</a> <<a href="http://192.168.2.55:22" rel="noreferrer" target="_blank">http://192.168.2.55:22</a>> <<a href="http://192.168.2.55:22" rel="noreferrer" target="_blank">http://192.168.2.55:22</a>>,<br>
<span class="">> retrying in 3 seconds<br>
> ><br>
> ><br>
> > Because 1.9.1 inserted a generated key into that box, the 1.9.2<br>
> > container which _should_ be talking to it cannot now:<br>
> ><br>
> > [vagrant-1.9.2] ==> default: Rsyncing folder: /home/jenkins/.kitchen/cache/ => /tmp/omnibus/cache<br>
> > [vagrant-1.9.2] SSH authentication failed! This is typically caused by the public/private<br>
> > [vagrant-1.9.2] keypair for the SSH user not being properly set on the guest VM. Please<br>
> > [vagrant-1.9.2] verify that the guest VM is setup with the proper public key, and that<br>
> > [vagrant-1.9.2] the private key path for Vagrant is setup properly as well.<br>
> ><br>
> ><br>
> ><br>
> > Via the ruby sdk I create the VM and store the ID it responded with.<br>
> > Then to get the IP:<br>
> ><br>
<br>
</span>Can you share this ^ code that creates and stores the ID of the virtual<br>
machine?<br>
<span class=""><br>
> > server = env[:vms_service].vm_service(<wbr>env[:machine].id)<br>
> > nics_service = server.nics_service<br>
> > nics = nics_service.list<br>
> > ip_addr = nics.collect { |nic_attachment|<br>
> > env[:connection].follow_link(<wbr>nic_attachment).reported_<wbr>devices.collect {<br>
> > |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } }<br>
> > }.flatten.reject { |ip| ip.nil? }.first rescue nil<br>
> ><br>
><br>
> Is this code running inside the same Ruby process for both virtual<br>
> machines? In multiple threads?<br>
><br>
> > Given this code I can't think of any way that I would get the wrong IP<br>
> > unless somehow the server responded incorrectly, since the NIC's i've<br>
> > scanned and compiled across are tied directly to the server I created.<br>
> ><br>
> > Any thoughts? This only happpens randomly and it seems to happen if I<br>
> > bombard the server with a bunch of VM creations simultaneously<br>
> ><br>
> > [1] <a href="https://github.com/test-kitchen/test-kitchen" rel="noreferrer" target="_blank">https://github.com/test-<wbr>kitchen/test-kitchen</a><br>
> <<a href="https://github.com/test-kitchen/test-kitchen" rel="noreferrer" target="_blank">https://github.com/test-<wbr>kitchen/test-kitchen</a>><br>
> > [2] <a href="https://github.com/test-kitchen/kitchen-vagrant" rel="noreferrer" target="_blank">https://github.com/test-<wbr>kitchen/kitchen-vagrant</a><br>
> <<a href="https://github.com/test-kitchen/kitchen-vagrant" rel="noreferrer" target="_blank">https://github.com/test-<wbr>kitchen/kitchen-vagrant</a>><br>
> ><br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > Devel mailing list<br>
</span>> > <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> <mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>><br>
> > <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
> <<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>><br>
> ><br>
><br>
><br>
<br>
</blockquote></div><br></div>