<div dir="ltr">Still no change...<div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><br></div></blockquote></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div> myoung dev ~ repos github vagrant-ovirt4 feature/gh65 ✎ $ vagrant up</div></div><div><div>You appear to be running Vagrant outside of the official installers.</div></div><div><div>Note that the installers are what ensure that Vagrant has all required</div></div><div><div>dependencies, and Vagrant assumes that these dependencies exist. By</div></div><div><div>running outside of the installer environment, Vagrant may not function</div></div><div><div>properly. To remove this warning, install Vagrant using one of the</div></div><div><div>official packages from <a href="http://vagrantup.com">vagrantup.com</a>.</div></div><div><div><br></div></div><div><div>Bringing machine 'default' up with 'ovirt4' provider...</div></div><div><div>==> default: Creating VM with the following settings...</div></div><div><div>==> default: -- Name: testing</div></div><div><div>==> default: -- Cluster: Default</div></div><div><div>==> default: -- Template: vagrant-centos7</div></div><div><div>==> default: -- Console Type: vnc</div></div><div><div>==> default: -- Memory:</div></div><div><div>==> default: ---- Memory: 2048 MB</div></div><div><div>==> default: ---- Maximum: 2048 MB</div></div><div><div>==> default: ---- Guaranteed: 2048 MB</div></div><div><div>==> default: -- Cpu:</div></div><div><div>==> default: ---- Cores: 2</div></div><div><div>==> default: ---- Sockets: 1</div></div><div><div>==> default: ---- Threads: 1</div></div><div><div>==> default: -- Cloud-Init: false</div></div><div><div>==> default: Waiting for VM to become "ready" to start...</div></div><div><div>==> default: Starting VM.</div></div><div><div><br></div></div><div><div>From: /home/myoung/repos/github/vagrant-ovirt4/lib/vagrant-ovirt4/action/start_vm.rb @ line 79 VagrantPlugins::OVirtProvider::Action::StartVM#call:</div></div><div><div><br></div></div><div><div> 74: vm_configuration[:initialization][:dns_search] = iface_options[:dns_search] unless iface_options[:dns_search].nil?</div></div><div><div> 75:</div></div><div><div> 76: require 'pry'</div></div><div><div> 77: binding.pry</div></div><div><div> 78:</div></div><div><div> => 79: machine.start(</div></div><div><div> 80: use_cloud_init: true,</div></div><div><div> 81: vm: vm_configuration</div></div><div><div> 82: )</div></div><div><div> 83:</div></div><div><div> 84: @app.call(env)</div></div><div><div><br></div></div><div><div>[1] pry(#<VagrantPlugins::OVirtProvider::Action::StartVM>)> vm_configuration</div></div><div><div>=> {:initialization=></div></div><div><div> {:host_name=>"testing",</div></div><div><div> :nic_configurations=>[{:name=>"eth0", :on_boot=>true, :boot_protocol=>"static", :ip=>{:version=>"v4", :address=>"192.168.2.120", :gateway=>"192.168.2.1", :netmask=>"255.255.255.0"}}],</div></div><div><div> :custom_script=>nil,</div></div><div><div> :dns_servers=>"192.168.2.1",</div></div><div><div> :dns_search=>"test.local"}}</div></div><div><div>[2] pry(#<VagrantPlugins::OVirtProvider::Action::StartVM>)></div></div><div><div>==> default: Waiting for VM to get an IP address...</div></div><div><div>==> default: Machine is booted and ready for use!</div></div><div><div>==> default: Rsyncing folder: /home/myoung/repos/github/vagrant-ovirt4/ => /vagrant</div></div><div><div>==> default: Setting hostname...</div></div><div><div> default:</div></div><div><div> default: Vagrant insecure key detected. Vagrant will automatically replace</div></div><div><div> default: this with a newly generated keypair for better security.</div></div><div><div> default:</div></div><div><div> default: Inserting generated public key within guest...</div></div><div><div> default: Removing insecure key from the guest if it's present...</div></div><div><div> default: Key inserted! Disconnecting and reconnecting using new SSH key...</div></div><div><div> myoung dev ~ repos github vagrant-ovirt4 feature/gh65 ✎ $ vagrant ssh</div></div><div><div>You appear to be running Vagrant outside of the official installers.</div></div><div><div>Note that the installers are what ensure that Vagrant has all required</div></div><div><div>dependencies, and Vagrant assumes that these dependencies exist. By</div></div><div><div>running outside of the installer environment, Vagrant may not function</div></div><div><div>properly. To remove this warning, install Vagrant using one of the</div></div><div><div>official packages from <a href="http://vagrantup.com">vagrantup.com</a>.</div></div><div><div><br></div></div><div><div>Last login: Wed Feb 15 00:23:35 2017 from 192.168.2.32</div></div><div><div>[vagrant@testing ~]$ cat /etc/resolv.conf</div></div><div><div># Generated by NetworkManager</div></div><div><div>search localdomain</div></div><div><div>[vagrant@testing ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0</div></div><div><div>NM_CONTROLLED=no</div></div><div><div>NETMASK=255.255.255.0</div></div><div><div>BOOTPROTO=static</div></div><div><div>DEVICE=eth0</div></div><div><div>IPADDR=192.168.2.120</div></div><div><div>GATEWAY=192.168.2.1</div></div><div><div>ONBOOT=yes</div></div></blockquote><div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><br></div></blockquote>If i check out the floppy attached to that VM:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>[myoung@ovirt ~]$ sudo ps -ef | grep qemu-kvm | grep test</div></div><div><div>[sudo] password for myoung:</div></div><div><div>qemu 24311 1 87 01:38 ? 00:00:18 .....</div></div><div><div>[myoung@ovirt ~]$ sudo cp /var/run/vdsm/payload/9964609e-8d85-4a5c-9416-8e11b2fd5883.d0d0739973bfb4b6eb67d1f4974c3e0c.img .</div></div><div><div>[myoung@ovirt ~]$ mkdir a; sudo mount -o loop,ro 9964609e-8d85-4a5c-9416-8e11b2fd5883.d0d0739973bfb4b6eb67d1f4974c3e0c.img a</div></div><div><div>[myoung@ovirt ~]$ sudo cat $(sudo find a -name 0000 -type f)</div></div><div><div>auto eth0</div></div><div><div>iface eth0 inet static</div></div><div><div> address 192.168.2.120</div></div><div><div> netmask 255.255.255.0</div></div><div><div> gateway 192.168.2.1</div></div><div><div> dns-nameservers 192.168.2.1</div></div><div><div> dns-search test.local</div></div><div><div>[myoung@ovirt ~]$ sudo umount a</div></div></blockquote><div><br></div><div><br></div><div>What's the next step? Is there a way to verify on the upstream that dns-search and dns-nameservers actually populate the ifcfg-eth0 file ?</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 18, 2017 at 6:58 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-m_5845533094908090176HOEnZb"><div class="gmail-m_5845533094908090176h5">On 02/17/2017 08:11 PM, Marc Young wrote:<br>
> Per the script, i'll change that, probably just wasnt paying attention<br>
> to where i ran chkconfig<br>
><br>
> Per cloud-init YAML, not sure. It was in a previous reply so i gave it a<br>
> shot. But i can't find that usage anywhere either so i gave up on it.<br>
><br>
> Per troubleshooting:<br>
><br>
> Spinning up a VM with dns_servers and dns_search:<br>
><br>
> 66: vm_configuration[:initializat<wbr>ion][:dns_servers] =<br>
> iface_options[:dns_servers] unless iface_options[:dns_servers].ni<wbr>l?<br>
> 67: vm_configuration[:initializat<wbr>ion][:dns_search] =<br>
> iface_options[:dns_search] unless iface_options[:dns_search].nil<wbr>?<br>
> 68: require 'pry'<br>
> 69: binding.pry<br>
> 70:<br>
> => 71: machine.start(<br>
> 72: use_cloud_init: true,<br>
> 73: vm: vm_configuration<br>
> 74: )<br>
> 75:<br>
> 76: @app.call(env)<br>
><br>
> [1] pry(#<VagrantPlugins::OVirtPro<wbr>vider::Action::StartVM>)><br>
> vm_configuration<br>
> => {:initialization=><br>
> {:host_name=>"test",<br>
> :nic_configurations=>[{:name=><wbr>"eth0", :on_boot=>true,<br>
> :boot_protocol=>"static", :ip=>{:version=>"v4",<br>
> :address=>"192.168.2.200", :gateway=>"192.168.2.1",<br>
> :netmask=>"255.255.255.0"}}],<br>
> :custom_script=><br>
> "manage-resolv-conf: true\n\nresolv_conf:\n nameservers:<br>
> ['8.8.4.4', '8.8.8.8']\n searchdomains:\n - <a href="http://foo.example.com" rel="noreferrer" target="_blank">foo.example.com</a><br>
</div></div>> <<a href="http://foo.example.com" rel="noreferrer" target="_blank">http://foo.example.com</a>>\n - <a href="http://bar.example.com" rel="noreferrer" target="_blank">bar.example.com</a><br>
> <<a href="http://bar.example.com" rel="noreferrer" target="_blank">http://bar.example.com</a>>\n domain: <a href="http://example.com" rel="noreferrer" target="_blank">example.com</a><br>
> <<a href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>>\n options:\n rotate: true\n timeout: 1\n",<br>
<div><div class="gmail-m_5845533094908090176h5">> :dns_servers=>"192.168.2.1",<br>
> :dns_search=>"test.local"}}<br>
> [2] pry(#<VagrantPlugins::OVirtPro<wbr>vider::Action::StartVM>)><br>
> ==> default: Waiting for VM to get an IP address...<br>
> ==> default: Machine is booted and ready for use!<br>
> ==> default: Rsyncing folder:<br>
> /home/myoung/repos/github/vag<wbr>rant-ovirt4/ => /vagrant<br>
> ==> default: Setting hostname...<br>
> default:<br>
> default: Vagrant insecure key detected. Vagrant will<br>
> automatically replace<br>
> default: this with a newly generated keypair for better security.<br>
> default:<br>
> default: Inserting generated public key within guest...<br>
> default: Removing insecure key from the guest if it's present...<br>
> default: Key inserted! Disconnecting and reconnecting using new<br>
> SSH key...<br>
><br>
><br>
> now ill ssh in and look around<br>
><br>
> myoung dev ~ repos github vagrant-ovirt4 <br>
> feature/gh65 ✎ 5❓ 1 $ vagrant ssh<br>
> You appear to be running Vagrant outside of the official installers.<br>
> Note that the installers are what ensure that Vagrant has all required<br>
> dependencies, and Vagrant assumes that these dependencies exist. By<br>
> running outside of the installer environment, Vagrant may not function<br>
> properly. To remove this warning, install Vagrant using one of the<br>
</div></div>> official packages from <a href="http://vagrantup.com" rel="noreferrer" target="_blank">vagrantup.com</a> <<a href="http://vagrantup.com" rel="noreferrer" target="_blank">http://vagrantup.com</a>>.<br>
<span>><br>
> Last login: Thu Feb 16 23:04:00 2017 from 192.168.2.198<br>
> [vagrant@test ~]$ sudo cat /var/lib/cloud/instance/user-d<wbr>ata.txt<br>
> #cloud-config<br>
> output:<br>
> all: '>> /var/log/cloud-init-output.log<wbr>'<br>
> disable_root: 0<br>
> runcmd:<br>
> - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo<br>
> ''datasource_list:<br>
> ["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'<br>
> ssh_pwauth: true<br>
> chpasswd:<br>
> expire: false<br>
> user: root<br>
> manage-resolv-conf: true<br>
><br>
> resolv_conf:<br>
> nameservers: ['8.8.4.4', '8.8.8.8']<br>
> searchdomains:<br>
</span>> - <a href="http://foo.example.com" rel="noreferrer" target="_blank">foo.example.com</a> <<a href="http://foo.example.com" rel="noreferrer" target="_blank">http://foo.example.com</a>><br>
> - <a href="http://bar.example.com" rel="noreferrer" target="_blank">bar.example.com</a> <<a href="http://bar.example.com" rel="noreferrer" target="_blank">http://bar.example.com</a>><br>
> domain: <a href="http://example.com" rel="noreferrer" target="_blank">example.com</a> <<a href="http://example.com" rel="noreferrer" target="_blank">http://example.com</a>><br>
<span>> options:<br>
> rotate: true<br>
> timeout: 1<br>
<br>
</span>Apparently you are passing in the 'custom_script' some DNS<br>
configuration, which may conflict with the DNS configuration that you<br>
are passing in the 'dns_servers' and 'dns_search' options. It could be<br>
that cloud-init ignores one of them. I'd suggest that you try to remove<br>
completely the 'custom_script' parameter.<br>
<div><div class="gmail-m_5845533094908090176h5"><br>
> [vagrant@test ~]$ sudo cat /etc/resolv.conf<br>
> # Generated by NetworkManager<br>
> search localdomain<br>
><br>
> [vagrant@test ~]$ cat /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
> NM_CONTROLLED=no<br>
> NETMASK=255.255.255.0<br>
> BOOTPROTO=static<br>
> DEVICE=eth0<br>
> IPADDR=192.168.2.200<br>
> GATEWAY=192.168.2.1<br>
> ONBOOT=yes<br>
><br>
> [vagrant@test ~]$ sudo cat /var/log/cloud-init* | grep -i dns<br>
> [vagrant@test ~]$ sudo cat /var/log/cloud-init* | grep -i local<br>
> Feb 14 23:16:45 vagrant cloud-init: Cloud-init v. 0.7.5 running<br>
> 'init-local' at Wed, 15 Feb 2017 05:16:45 +0000. Up 11.00 seconds.<br>
> Feb 16 23:03:35 test cloud-init: Cloud-init v. 0.7.5 running<br>
> 'init-local' at Fri, 17 Feb 2017 05:03:35 +0000. Up 5.23 seconds.<br>
> Cloud-init v. 0.7.5 running 'init-local' at Thu, 09 Feb 2017<br>
> 03:45:01 +0000. Up 1310.61 seconds.<br>
> Cloud-init v. 0.7.5 running 'init-local' at Wed, 15 Feb 2017<br>
> 05:16:45 +0000. Up 11.00 seconds.<br>
> Cloud-init v. 0.7.5 running 'init-local' at Fri, 17 Feb 2017<br>
> 05:03:35 +0000. Up 5.23 seconds.<br>
> Cloud-init v. 0.7.5 finished at Fri, 17 Feb 2017 05:03:45 +0000.<br>
> Datasource DataSourceConfigDrive [local,ver=2][source=/dev/sr1]<wbr>. Up<br>
> 15.37 seconds<br>
><br>
><br>
><br>
> On the vm host running that VM:<br>
><br>
><br>
> [myoung@ovirt ~]$ sudo ps -ef | grep qemu-kvm | grep test<br>
> qemu 12456 1 9 05:03 ? 00:00:19<br>
> /usr/libexec/qemu-kvm -name ...snipped<br>
> [myoung@ovirt ~]$ sudo cp<br>
> /var/run/vdsm/payload/c65751c<wbr>3-431d-44e4-836c-963b81b1f846.<wbr>20fc2db0517e8c06579d7719d8f3fb<wbr>35.img<br>
> .<br>
> [myoung@ovirt ~]$ sudo mount -o loop,ro<br>
> c65751c3-431d-44e4-836c-963b8<wbr>1b1f846.20fc2db0517e8c06579d77<wbr>19d8f3fb35.img<br>
> /mnt<br>
> [myoung@ovirt ~]$ find /mnt -type f<br>
> find: ‘/mnt’: Permission denied<br>
> [myoung@ovirt ~]$ sudo find /mnt -type f<br>
> /mnt/openstack/content/0000<br>
> /mnt/openstack/latest/meta_da<wbr>ta.json<br>
> /mnt/openstack/latest/user_da<wbr>ta<br>
> [myoung@ovirt ~]$ sudo cat /mnt/openstack/content/0000<br>
> auto eth0<br>
> iface eth0 inet static<br>
> address 192.168.2.200<br>
> netmask 255.255.255.0<br>
> gateway 192.168.2.1<br>
> dns-nameservers 192.168.2.1<br>
> dns-search test.local<br>
> [myoung@ovirt ~]$ sudo umount<br>
> c65751c3-431d-44e4-836c-963b8<wbr>1b1f846.20fc2db0517e8c06579d77<wbr>19d8f3fb35.img<br>
><br>
> Cloud-init definitely isn't working right away with resolv.conf, but I'm<br>
> definitely passing it correctly to the API, it shows up on the floppy as<br>
> you described but it's not making its way to<br>
> /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0 even though the other settings<br>
> for sure are (such as address, netmask,)<br>
><br>
> If i add that information to /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
> and bounce network it all works:<br>
><br>
</div></div>> [vagrant@test ~]$ ping -c 3 <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> ping: <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>>: Name or service not known<br>
<span>> [vagrant@test ~]$ echo $'DNS1=192.168.2.113\nDNS2=192<wbr>.168.2.1' |<br>
> sudo tee -a /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0 >/dev/null<br>
</span>> [vagrant@test ~]$ ping -c 3 <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> ping: <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>>: Name or service not known<br>
<span>> [vagrant@test ~]$ sudo service network restart<br>
> Restarting network (via systemctl): [ OK ]<br>
</span>> [vagrant@test ~]$ ping -c 3 <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> PING <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>> (216.58.217.4) 56(84)<br>
<span>> bytes of data.<br>
> 64 bytes from <a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">den03s09-in-f4.1e100.net</a><br>
</span>> <<a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net</a>> (216.58.217.4): icmp_seq=1 ttl=54<br>
<span>> time=55.8 ms<br>
> 64 bytes from <a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">den03s09-in-f4.1e100.net</a><br>
</span>> <<a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net</a>> (216.58.217.4): icmp_seq=2 ttl=54<br>
> time=43.9 ms<br>
> ^C<br>
> --- <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>> ping statistics ---<br>
<span>> 2 packets transmitted, 2 received, 0% packet loss, time 1001ms<br>
> rtt min/avg/max/mdev = 43.939/49.916/55.894/5.981 ms<br>
> [vagrant@test ~]$ sudo cat /etc/resolv.conf<br>
> # Generated by NetworkManager<br>
> search localdomain<br>
> nameserver 192.168.2.113<br>
> nameserver 192.168.2.1<br>
><br>
><br>
><br>
><br>
> On Fri, Feb 17, 2017 at 2:21 AM, Juan Hernández <<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a><br>
</span><span>> <mailto:<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>>> wrote:<br>
><br>
> On 02/17/2017 06:00 AM, Marc Young wrote:<br>
> > I'm apparently really bad at email, I replied only to Shahar, not the<br>
> > whole thread.<br>
> ><br>
> > Vinzenz your email slipped first, so to answer your question:<br>
> ><br>
> > It's the latest Centos 7 with these installed:<br>
> ><br>
> > cloud-init-0.7.5-10.el7.centos<wbr>.1<br>
</span>> > kernel-<a href="tel:3.10.0-514" value="+13100514" target="_blank">3.10.0-514</a> <tel:<a href="tel:3.10.0-514" value="+13100514" target="_blank">3.10.0-514</a>> <tel:<a href="tel:3.10.0-514" value="+13100514" target="_blank">3.10.0-514</a><br>
<div><div class="gmail-m_5845533094908090176h5">> <tel:<a href="tel:3.10.0-514" value="+13100514" target="_blank">3.10.0-514</a>>>.el7<br>
> > ovirt-guest-agent-common-1.0.1<wbr>3-1.20161220085008.git165fff1.<wbr>el7.centos<br>
> ><br>
> > The setup script I use to create a template is here:<br>
> > <a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/tools/prepare_redhat_for_box.sh" rel="noreferrer" target="_blank">https://github.com/myoung34/va<wbr>grant-ovirt4/blob/master/tools<wbr>/prepare_redhat_for_box.sh</a><br>
> <<a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/tools/prepare_redhat_for_box.sh" rel="noreferrer" target="_blank">https://github.com/myoung34/<wbr>vagrant-ovirt4/blob/master/too<wbr>ls/prepare_redhat_for_box.sh</a>><br>
> ><br>
> <<a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/tools/prepare_redhat_for_box.sh" rel="noreferrer" target="_blank">https://github.com/myoung34/<wbr>vagrant-ovirt4/blob/master/too<wbr>ls/prepare_redhat_for_box.sh</a><br>
> <<a href="https://github.com/myoung34/vagrant-ovirt4/blob/master/tools/prepare_redhat_for_box.sh" rel="noreferrer" target="_blank">https://github.com/myoung34/<wbr>vagrant-ovirt4/blob/master/too<wbr>ls/prepare_redhat_for_box.sh</a>>><br>
> ><br>
><br>
> In that script you run "chkconfig cloud-init on" *before* installing the<br>
> cloud-init package. That is irrelevant, as the cloud-init services are<br>
> enabled by default when the package is installed. But worth changing.<br>
><br>
> > The engine-host is oVirt Engine Version: 4.1.0.4-1.el7.centos<br>
> > The ruby SDK i'm working with is 4.1.2<br>
> ><br>
> > Halfway through I realized that it's actually supported in the API:<br>
> ><br>
> > custom_script String<br>
> > dns_search String<br>
> > dns_servers String<br>
> ><br>
> ><br>
> > It also shows usage here:<br>
> ><br>
> <a href="https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/start_vm_with_cloud_init.rb" rel="noreferrer" target="_blank">https://github.com/oVirt/ovir<wbr>t-engine-sdk-ruby/blob/master/<wbr>sdk/examples/start_vm_with_<wbr>cloud_init.rb</a><br>
> <<a href="https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/start_vm_with_cloud_init.rb" rel="noreferrer" target="_blank">https://github.com/oVirt/ovi<wbr>rt-engine-sdk-ruby/blob/master<wbr>/sdk/examples/start_vm_with_<wbr>cloud_init.rb</a>><br>
> ><br>
> <<a href="https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/start_vm_with_cloud_init.rb" rel="noreferrer" target="_blank">https://github.com/oVirt/ovi<wbr>rt-engine-sdk-ruby/blob/master<wbr>/sdk/examples/start_vm_with_<wbr>cloud_init.rb</a><br>
> <<a href="https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/start_vm_with_cloud_init.rb" rel="noreferrer" target="_blank">https://github.com/oVirt/ovi<wbr>rt-engine-sdk-ruby/blob/master<wbr>/sdk/examples/start_vm_with_<wbr>cloud_init.rb</a>>><br>
> ><br>
> > Here's some verification:<br>
> ><br>
> > 66:<br>
> vm_configuration[:initializati<wbr>on][:dns_servers] =<br>
> > iface_options[:dns_servers] unless<br>
> iface_options[:dns_servers].n<wbr>il?<br>
> > 67: vm_configuration[:initializat<wbr>ion][:dns_search] =<br>
> > iface_options[:dns_search] unless iface_options[:dns_search].nil<wbr>?<br>
> > 68: require 'pry'<br>
> > 69: binding.pry<br>
> > 70:<br>
> > => 71: machine.start(<br>
> > 72: use_cloud_init: true,<br>
> > 73: vm: vm_configuration<br>
> > 74: )<br>
> > 75:<br>
> > 76: @app.call(env)<br>
> ><br>
> > [1] pry(#<VagrantPlugins::OVirtPro<wbr>vider::Action::StartVM>)><br>
> > vm_configuration<br>
> > => {:initialization=><br>
> > {:host_name=>"test",<br>
> > :nic_configurations=>[{:name=><wbr>"eth0", :on_boot=>true,<br>
> > :boot_protocol=>"static", :ip=>{:version=>"v4",<br>
> > :address=>"192.168.2.200", :gateway=>"192.168.2.1",<br>
> > :netmask=>"255.255.255.0"}}],<br>
> > :custom_script=>nil,<br>
> > :dns_servers=>"192.168.2.1",<br>
> > :dns_search=>"test.local"}}<br>
> ><br>
> ><br>
> > But it didn't do anything:<br>
> ><br>
> > [vagrant@test ~]$ cat /etc/resolv.conf<br>
> > # Generated by NetworkManager<br>
> > search localdomain<br>
> ><br>
> > [vagrant@test ~]$ cat /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
> > NM_CONTROLLED=no<br>
> > NETMASK=255.255.255.0<br>
> > BOOTPROTO=static<br>
> > DEVICE=eth0<br>
> > IPADDR=192.168.2.200<br>
> > GATEWAY=192.168.2.1<br>
> > ONBOOT=yes<br>
> ><br>
> ><br>
> > The same is also true using cloud_init:<br>
> ><br>
> > ovirt.cloud_init =<<EOF<br>
> > write_files:<br>
> > - content: |<br>
> > wat<br>
> > path: /tmp/something.txt<br>
> > permissions: '0644'<br>
> > network-interfaces: |<br>
> > auto eth0<br>
> > iface eth0 inet static<br>
> > address 192.168.2.201<br>
> > network 192.168.2.0<br>
> > netmask 255.255.255.0<br>
> > gateway 192.168.2.1<br>
> > dns-nameservers 192.168.2.113 192.168.2.1<br>
> > EOF<br>
> ><br>
><br>
> Is this ^ supposed to work in cloud-init? I didn't find it in the<br>
> documentation. I thought that the only way to provide network interface<br>
> configuration is via the 'openstack/content/whatever' file within the<br>
> generated floppy.<br>
><br>
> ><br>
> > and inspection:<br>
> ><br>
> > 66:<br>
> vm_configuration[:initializati<wbr>on][:dns_servers] =<br>
> > iface_options[:dns_servers] unless<br>
> iface_options[:dns_servers].n<wbr>il?<br>
> > 67: vm_configuration[:initializat<wbr>ion][:dns_search] =<br>
> > iface_options[:dns_search] unless iface_options[:dns_search].nil<wbr>?<br>
> > 68: require 'pry'<br>
> > 69: binding.pry<br>
> > 70:<br>
> > => 71: machine.start(<br>
> > 72: use_cloud_init: true,<br>
> > 73: vm: vm_configuration<br>
> > 74: )<br>
> > 75:<br>
> > 76: @app.call(env)<br>
> > [1] pry(#<VagrantPlugins::OVirtPro<wbr>vider::Action::StartVM>)><br>
> > vm_configuration<br>
> > => {:initialization=><br>
> > {:host_name=>"test",<br>
> > :nic_configurations=>[{:name=><wbr>"eth0", :on_boot=>true,<br>
> > :boot_protocol=>"static", :ip=>{:version=>"v4",<br>
> > :address=>"192.168.2.200", :gateway=>"192.168.2.1",<br>
> > :netmask=>"255.255.255.0"}}],<br>
> > :custom_script=><br>
> > "write_files:\n - content: |\n wat\n path:<br>
> > /tmp/something.txt\n permissions:<br>
> '0644'\nnetwork-interfaces: |\n<br>
> > auto eth0\n iface eth0 inet static\n address 192.168.2.201\n<br>
> > network 192.168.2.0\n netmask 255.255.255.0\n gateway<br>
> > 192.168.2.1\n dns-nameservers 192.168.2.113 192.168.2.1\n",<br>
> > :dns_servers=>"192.168.2.1",<br>
> > :dns_search=>"test.local"}}<br>
> ><br>
> ><br>
> > And here's my debugging after it comes up:<br>
> ><br>
> > [vagrant@test ~]$ cat /etc/resolv.conf<br>
> > # Generated by NetworkManager<br>
> > search localdomain<br>
> > [vagrant@test ~]$ cat /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
> > NM_CONTROLLED=no<br>
> > NETMASK=255.255.255.0<br>
> > BOOTPROTO=static<br>
> > DEVICE=eth0<br>
> > IPADDR=192.168.2.200<br>
> > GATEWAY=192.168.2.1<br>
> > ONBOOT=yes<br>
> > [vagrant@test ~]$ cat /tmp/something.txt<br>
> > wat<br>
> > [vagrant@test ~]$ ping -c 3 <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> > <<a href="http://www.google.com/" rel="noreferrer" target="_blank">http://www.google.com/</a>>ping: <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a><br>
> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> > <<a href="http://www.google.com/" rel="noreferrer" target="_blank">http://www.google.com/</a>>: Name or service not known<br>
> > [vagrant@test ~]$ echo $'nameserver 192.168.2.113\nnameserver<br>
> > 192.168.2.1' | sudo tee -a /etc/resolv.conf >/dev/null<br>
> > [vagrant@test ~]$ ping -c 3 <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> > <<a href="http://www.google.com/" rel="noreferrer" target="_blank">http://www.google.com/</a>>PING <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a><br>
> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> > <<a href="http://www.google.com/" rel="noreferrer" target="_blank">http://www.google.com/</a>> (216.58.217.4) 56(84) bytes of data.<br>
> > 64 bytes from <a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">den03s09-in-f4.1e100.net</a><br>
> <<a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net</a>><br>
</div></div>> > <<a href="http://den03s09-in-f4.1e100.net/" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net/</a><br>
<span>> <<a href="http://den03s09-in-f4.1e100.net/" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net/</a>>> (216.58.217.4): icmp_seq=1<br>
> > ttl=54 time=47.5 ms<br>
> > 64 bytes from <a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">den03s09-in-f4.1e100.net</a> <<a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.n<wbr>et</a>><br>
</span>> > <<a href="http://den03s09-in-f4.1e100.net/" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net/</a><br>
<span>> <<a href="http://den03s09-in-f4.1e100.net/" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net/</a>>> (216.58.217.4): icmp_seq=2<br>
> > ttl=54 time=46.9 ms<br>
> > 64 bytes from <a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">den03s09-in-f4.1e100.net</a> <<a href="http://den03s09-in-f4.1e100.net" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.n<wbr>et</a>><br>
</span>> > <<a href="http://den03s09-in-f4.1e100.net/" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net/</a><br>
<div class="gmail-m_5845533094908090176HOEnZb"><div class="gmail-m_5845533094908090176h5">> <<a href="http://den03s09-in-f4.1e100.net/" rel="noreferrer" target="_blank">http://den03s09-in-f4.1e100.<wbr>net/</a>>> (216.58.217.4): icmp_seq=3<br>
> > ttl=54 time=44.3 ms<br>
> > --- <a href="http://www.google.com" rel="noreferrer" target="_blank">www.google.com</a> <<a href="http://www.google.com" rel="noreferrer" target="_blank">http://www.google.com</a>><br>
> <<a href="http://www.google.com/" rel="noreferrer" target="_blank">http://www.google.com/</a>> ping statistics ---<br>
> > 3 packets transmitted, 3 received, 0% packet loss, time 2002ms<br>
> > rtt min/avg/max/mdev = 44.385/46.307/47.555/1.390 ms<br>
> ><br>
><br>
> Not sure if you did that already, but is very useful to check the<br>
> content of the floppy that the oVirt engine creates and attaches to the<br>
> virtual machine. To do so run the virtual machine, then go to the<br>
> hypervisor where it is running and locate the corresponding 'qemu-kvm'<br>
> process:<br>
><br>
> # ps -ef | grep qemu-kvm | grep myvm<br>
><br>
> That will have a very long command line, and should have a 'payload'<br>
> option that points to the generated floppy, something like this:<br>
><br>
> -drive file=/var/run/vdsm/payload/ae3<wbr>a9cd4-....img<br>
><br>
> Copy that file somewhere, and mount it:<br>
><br>
> # mount -o loop,ro that_file.img /mnt<br>
><br>
> Then explore the content:<br>
><br>
> # find /mnt -type f<br>
> /mnt/openstack/content/0000<br>
> /mnt/openstack/latest/meta_da<wbr>ta.json<br>
> /mnt/openstack/latest/user_da<wbr>ta<br>
><br>
> The 'openstack/content/0000' file should contain your network<br>
> configuration. Is it what you expected?<br>
><br>
> The 'openstack/latest/user_data' file should contain the cloud-init<br>
> ocnfiguration generated by oVirt, which your custom script appended.<br>
> Does it look correct?<br>
><br>
> (Remember to "umount /mnt" when done.)<br>
><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>