<div dir="ltr"><div><div><div><div><div>Hi Juan,<br><br></div>It seems the it doesn&#39;t contains the &quot;phone_home &quot; section in the  cat /mnt/openstack/latest/user_data
<br><br></div>the following is the output <br><br>#cloud-config
<br>ssh_pwauth: true
<br>disable_root: 0
<br>output:
<br>  all: &#39;&gt;&gt; /var/log/cloud-init-output.log&#39;
<br>user: root
<br>password: admin123
<br>chpasswd:
<br>  expire: false
<br>runcmd:
<br>- &#39;sed -i &#39;&#39;/^datasource_list: /d&#39;&#39; /etc/cloud/cloud.cfg; echo &#39;&#39;datasource_list:
<br>  [&quot;NoCloud&quot;, &quot;ConfigDrive&quot;]&#39;&#39; &gt;&gt; /etc/cloud/cloud.cfg&#39;
<br><br><br></div>but if i try with the <br><br>&lt;files&gt;<br>          &lt;file&gt;<br>            &lt;name&gt;ignored&lt;/name&gt;<br>            &lt;content&gt;&lt;![CDATA[runcmd:<br> - echo &#39;Test script !&#39; &gt; /iwashere_test.txt<br>]]&gt;&lt;/content&gt;<br>            &lt;type&gt;plaintext&lt;/type&gt;<br>          &lt;/file&gt;<br>        &lt;/files&gt;<br><br></div>then it will create the /iwashere_test.txt and write the contents and in that time the cat /mnt/openstack/latest/user_data is<br><br>cat /mnt/openstack/latest/user_data
<br>#cloud-config
<br>ssh_pwauth: true
<br>disable_root: 0
<br>output:
<br>  all: &#39;&gt;&gt; /var/log/cloud-init-output.log&#39;
<br>user: root
<br>password: admin123
<br>chpasswd:
<br>  expire: false
<br>runcmd:
<br>- &#39;sed -i &#39;&#39;/^datasource_list: /d&#39;&#39; /etc/cloud/cloud.cfg; echo &#39;&#39;datasource_list:
<br>  [&quot;NoCloud&quot;, &quot;ConfigDrive&quot;]&#39;&#39; &gt;&gt; /etc/cloud/cloud.cfg&#39;
<br>runcmd:
<br> - echo &#39;Test script !&#39; &gt; /iwashere_test.txt
<br><br></div>so, i think the custom script section is not working, i am attaching the vm log as a screenshot.<br><div><div><br><div><div><br></div></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><span>-- <br></span>Regards
<br>Shanil
</div></div>
<br><div class="gmail_quote">On Wed, Sep 10, 2014 at 2:07 PM, Juan Hernandez <span dir="ltr">&lt;<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 09/10/2014 06:44 AM, Shanil S wrote:<br>
&gt; Hi Juan,<br>
&gt;<br>
</span><span class="">&gt; What i am planning to do is to make work the following script<br>
&gt;<br>
&gt; #cloud-config<br>
&gt;<br>
&gt; # phone_home: if this dictionary is present, then the phone_home<br>
&gt; # cloud-config module will post specified data back to the given<br>
&gt; # url<br>
&gt; # default: none<br>
&gt; # phone_home:<br>
&gt; #  url: <a href="http://my.foo.bar/$INSTANCE/" target="_blank">http://my.foo.bar/$INSTANCE/</a><br>
&gt; #  post: all<br>
&gt; #  tries: 10<br>
&gt; #<br>
&gt; phone_home:<br>
&gt;  url: <a href="http://my.example.com/$INSTANCE_ID/" target="_blank">http://my.example.com/$INSTANCE_ID/</a><br>
&gt;  post: [ pub_key_dsa, pub_key_rsa, pub_key_ecdsa, instance_id ]<br>
&gt;<br>
&gt; (<a href="http://cloudinit.readthedocs.org/en/latest/topics/examples.html#run-commands-on-first-boot" target="_blank">http://cloudinit.readthedocs.org/en/latest/topics/examples.html#run-commands-on-first-boot</a>)<br>
&gt;<br>
&gt; but it wasn&#39;t working when i tried, i hope to post the above values to<br>
&gt; the specific url and get the posted details.<br>
&gt;<br>
<br>
</span>I think it should work, but it depends completely on cloud-init itself.<br>
I&#39;d suggest you check the content of the generated cloud-init<br>
configuration file (as described in a previous mail). If it contains the<br>
&quot;phone_home&quot; section then you can discard a problem with oVirt, and<br>
focus on clud-init.<br>
<span class="im HOEnZb"><br>
&gt;<br>
&gt; On Wed, Sep 10, 2014 at 10:02 AM, Shanil S &lt;<a href="mailto:xielesshanil@gmail.com">xielesshanil@gmail.com</a><br>
</span><span class="im HOEnZb">&gt; &lt;mailto:<a href="mailto:xielesshanil@gmail.com">xielesshanil@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Hi Juan,<br>
&gt;<br>
&gt;     Okay.. Thanks.. its working.<br>
&gt;<br>
&gt;     I would like to execute other page something like test_script.php by<br>
&gt;     posting some values to it using the cloud init, Is it possible to do<br>
&gt;     it ?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     --<br>
&gt;     Regards<br>
&gt;     Shanil<br>
&gt;<br>
&gt;     On Fri, Sep 5, 2014 at 10:08 PM, Juan Hernandez &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
</span><div class="HOEnZb"><div class="h5">&gt;     &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;         On 09/05/2014 12:55 PM, Shanil S wrote:<br>
&gt;         &gt; Hi Juan,<br>
&gt;         &gt;<br>
&gt;         &gt; Thanks for your reply.<br>
&gt;         &gt;<br>
&gt;         &gt; I tried with the above but i was unable to find the &#39;iwashere.txt&#39; after<br>
&gt;         &gt; executing the above xml.<br>
&gt;         &gt;<br>
&gt;<br>
&gt;         I repeated the test, this time with 3.4, and it worked fine for<br>
&gt;         me. As<br>
&gt;         the formatting of the XML is very important I&#39;d suggest that you<br>
&gt;         take<br>
&gt;         the attached script (instead of copy &amp; paste from the mail),<br>
&gt;         change the<br>
&gt;         password and VM id and run it.<br>
&gt;<br>
&gt;         There are two kind of things that can go wrong here. One is that the<br>
&gt;         engine/VDSM combination may not be generating the right file. To<br>
&gt;         verify<br>
&gt;         this start the VM with the attached script, and once it is<br>
&gt;         started go to<br>
&gt;         the hypervisor where it is running and find the corresponding<br>
&gt;         qemu process:<br>
&gt;<br>
&gt;           # ps -ef | grep -- &#39;-name myvm&#39;<br>
&gt;<br>
&gt;         This will give you a very long command line. That command line<br>
&gt;         should<br>
&gt;         include a &quot;-drive&quot; option containing the full path of the disk image<br>
&gt;         generated by the engine/VDSM, something like this:<br>
&gt;<br>
&gt;           -drive<br>
&gt;         file=/var/run/vdsm/payload/b5f087d4-022d-4d5f-8a1e-268c562c7bb1.b6fcddff571bb8c2028c61b623d172a6.img<br>
&gt;<br>
&gt;         To inspect its content make a copy (just in case) and mount it:<br>
&gt;<br>
&gt;           # cp -drive<br>
&gt;         file=/var/run/vdsm/payload/b5f087d4-022d-4d5f-8a1e-268c562c7bb1.b6fcddff571bb8c2028c61b623d172a6.img<br>
&gt;         /root/my.img<br>
&gt;           # mount -o loop,ro /root/my.img /mnt<br>
&gt;<br>
&gt;         Inspect the content:<br>
&gt;<br>
&gt;           # find /mnt<br>
&gt;           /mnt/openstack<br>
&gt;           /mnt/openstack/content<br>
&gt;           /mnt/openstack/content/0000<br>
&gt;           /mnt/openstack/latest<br>
&gt;           /mnt/openstack/latest/meta_data.json<br>
&gt;           /mnt/openstack/latest/user_data<br>
&gt;<br>
&gt;         The content of the custom-script should be at the end of the<br>
&gt;         &quot;user_data&quot;<br>
&gt;         file, so take a look at that:<br>
&gt;<br>
&gt;           # cat /mnt/openstack/latest/user_data<br>
&gt;           #cloud-config<br>
&gt;           ssh_pwauth: true<br>
&gt;           disable_root: 0<br>
&gt;           output:<br>
&gt;             all: &#39;&gt;&gt; /var/log/cloud-init-output.log&#39;<br>
&gt;           user: root<br>
&gt;           password: mypassword<br>
&gt;           chpasswd:<br>
&gt;             expire: false<br>
&gt;           runcmd:<br>
&gt;           - &#39;sed -i &#39;&#39;/^datasource_list: /d&#39;&#39; /etc/cloud/cloud.cfg; echo<br>
&gt;         &#39;&#39;datasource_list:<br>
&gt;             [&quot;NoCloud&quot;, &quot;ConfigDrive&quot;]&#39;&#39; &gt;&gt; /etc/cloud/cloud.cfg&#39;<br>
&gt;           runcmd:<br>
&gt;            - echo &quot;I was here!&quot; &gt; /iwashere.txt<br>
&gt;<br>
&gt;         If your custom script isn&#39;t there then there is some problem in the<br>
&gt;         engine/VDSM side, otherwise the problem is probably in cloud-init<br>
&gt;         itself, and we will need someone with more knowledge of<br>
&gt;         cloud-init to<br>
&gt;         debug it.<br>
&gt;<br>
&gt;         Don&#39;t forget to umount the file when finished:<br>
&gt;<br>
&gt;           # umount /mnt<br>
&gt;<br>
&gt;         &gt;<br>
&gt;         &gt; On Fri, Sep 5, 2014 at 3:00 PM, Juan Hernandez &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;<br>
</div></div><div class="HOEnZb"><div class="h5">&gt;         &gt; &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;         &gt;<br>
&gt;         &gt;     On 09/05/2014 10:46 AM, Sven Kieske wrote:<br>
&gt;         &gt;     &gt;<br>
&gt;         &gt;     &gt;<br>
&gt;         &gt;     &gt; Am 05.09.2014 10:27, schrieb Juan Hernandez:<br>
&gt;         &gt;     &gt;&gt; Trying to make an example for this I discovered that<br>
&gt;         the &quot;custom_script&quot;<br>
&gt;         &gt;     &gt;&gt; element is currently ignored if the &quot;cloud_init&quot;<br>
&gt;         element is present.<br>
&gt;         &gt;     &gt;&gt; Instead we are taking the content of the first &quot;file&quot;<br>
&gt;         element from the<br>
&gt;         &gt;     &gt;&gt; &quot;cloud_init&quot; element and appending it to the cloud-init<br>
&gt;         configuration<br>
&gt;         &gt;     &gt;&gt; file. I believe that this is a bug, as it breaks<br>
&gt;         backwards compatibility:<br>
&gt;         &gt;     &gt;&gt;<br>
&gt;         &gt;     &gt;&gt;   <a href="https://bugzilla.redhat.com/1138564" target="_blank">https://bugzilla.redhat.com/1138564</a><br>
&gt;         &gt;     &gt;<br>
&gt;         &gt;     &gt; Thanks for the report, I just proposed this as a blocker<br>
&gt;         for the 3.4.4<br>
&gt;         &gt;     &gt; release as it is a clear regression.<br>
&gt;         &gt;     &gt; Also I rely on this functionality in my 3.3. setup and I<br>
&gt;         want to upgrade<br>
&gt;         &gt;     &gt; to 3.4 so I can&#39;t upgrade until this is fixed and released.<br>
&gt;         &gt;<br>
&gt;         &gt;     Agree, I set the bug as a blocker for 3.4.4.<br>
&gt;         &gt;<br>
&gt;         &gt;     &gt;&gt;<br>
&gt;         &gt;     &gt;&gt; However, you can exploit this bug to do what you want.<br>
&gt;         This is an example:<br>
&gt;         &gt;     &gt;<br>
&gt;         &gt;     &gt; Well I guess this is a pretty bad idea, because it will<br>
&gt;         just work<br>
&gt;         &gt;     &gt; until the bug is fixed?<br>
&gt;         &gt;     &gt;<br>
&gt;         &gt;<br>
&gt;         &gt;     No, what I proposed in the example is to put the custom<br>
&gt;         script in both<br>
&gt;         &gt;     the first &quot;file&quot; inside &quot;clud_init&quot; and in the<br>
&gt;         &quot;custom_script&quot; element.<br>
&gt;         &gt;     That should work with the current status and also if/when<br>
&gt;         we fix the<br>
&gt;         &gt;     bug.<br>
&gt;         &gt;<br>
&gt;<br>
<br>
--<br>
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
3ºD, 28016 Madrid, Spain<br>
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.<br>
</div></div></blockquote></div><br></div>