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