<div dir="ltr"><div>Thanks Juan for helping me.<br><br></div>~Rohit<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 17, 2017 at 12:51 AM, Juan Hernández <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 03/16/2017 04:09 PM, TranceWorldLogic . wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt;<br>
</span><span class="">&gt; I am trying to create file using same API, as shown below:<br>
&gt; ------------------------------<wbr>--------------------<br>
&gt; scontent=&quot;Hello World !!&quot;<br>
&gt;<br>
&gt; vm_service.start(<br>
&gt;     use_cloud_init=True,<br>
&gt;     vm = types.Vm(<br>
&gt;         initialization=types.<wbr>Initialization(<br>
&gt;             cloud_init=types.CloudInit(<br>
&gt;                 files=[types.File(name=&quot;/root/<wbr>hello.conf&quot;,<br>
&gt; content=scontent, type=&quot;PLAINTEXT&quot;)],<br>
&gt;             ),<br>
&gt;         ),<br>
&gt;     ),<br>
&gt; )<br>
&gt; ------------------------------<wbr>----------------------<br>
&gt;<br>
&gt; Can someone help me to understand ? why it is not working.<br>
&gt; Or Is that variable &quot;cloud_init=&quot; not handled in ovirt ?<br>
&gt;<br>
<br>
</span>That may have been the initial design of the feature, but it doesn&#39;t<br>
currently work. That &#39;files&#39; element isn&#39;t used at all. The recommended<br>
way to create a file is using the custom script, as explained in this<br>
example:<br>
<br>
<br>
<a href="https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py#L48-L57" rel="noreferrer" target="_blank">https://github.com/oVirt/<wbr>ovirt-engine-sdk/blob/master/<wbr>sdk/examples/start_vm_with_<wbr>cloud_init.py#L48-L57</a><br>
<br>
The use of &#39;types.CloudInit&#39; is also disencouraged, use directly the<br>
attributes of &#39;types.Initialization&#39;, as explained here:<br>
<br>
<br>
<a href="https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py#L59-L86" rel="noreferrer" target="_blank">https://github.com/oVirt/<wbr>ovirt-engine-sdk/blob/master/<wbr>sdk/examples/start_vm_with_<wbr>cloud_init.py#L59-L86</a><br>
<span class=""><br>
&gt;<br>
&gt;<br>
&gt; On Thu, Mar 16, 2017 at 7:33 PM, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
</span><span class="">&gt; &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 03/16/2017 02:22 PM, TranceWorldLogic . wrote:<br>
&gt;     &gt; Hi,<br>
&gt;     &gt;<br>
&gt;     &gt; I am trying to use cloud-int to provide some text file in guest OS as<br>
&gt;     &gt; mention in below link. (tried using sdk)<br>
&gt;     &gt; But it is not working.<br>
&gt;     &gt; <a href="http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/" rel="noreferrer" target="_blank">http://www.ovirt.org/develop/<wbr>release-management/features/<wbr>cloud/cloud-init-integration/</a><br>
&gt;     &lt;<a href="http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/" rel="noreferrer" target="_blank">http://www.ovirt.org/develop/<wbr>release-management/features/<wbr>cloud/cloud-init-integration/</a>&gt;<br>
&gt;     &gt;<br>
&gt;<br>
&gt;     What SDK are you using? I guess that the Python SDK. Did you try this<br>
&gt;     example:<br>
&gt;<br>
&gt;<br>
&gt;     <a href="https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py" rel="noreferrer" target="_blank">https://github.com/oVirt/<wbr>ovirt-engine-sdk/blob/master/<wbr>sdk/examples/start_vm_with_<wbr>cloud_init.py</a><br>
&gt;     &lt;<a href="https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py" rel="noreferrer" target="_blank">https://github.com/oVirt/<wbr>ovirt-engine-sdk/blob/master/<wbr>sdk/examples/start_vm_with_<wbr>cloud_init.py</a>&gt;<br>
&gt;<br>
&gt;     &gt; 1&gt; Do I need to do some configure cloud-init in Guest OS ?<br>
&gt;     &gt; -&gt; I hav just install cloud-init package in my 2 guest<br>
&gt;     &gt;       For centos 6.8 =&gt; yum install cloud-init<br>
&gt;     &gt;       For ubuntu 14.05 =&gt; apt-get install cloud-init<br>
&gt;     &gt;<br>
&gt;<br>
&gt;     That should be eough, at least in CentOS. Not sure about Ubuntu.<br>
&gt;<br>
&gt;     Note that you are using a quite old version of CentOS, so you may also<br>
&gt;     be using an old or buggy version of cloud-init. Did you try with latest<br>
&gt;     CentOS 7?<br>
&gt;<br>
&gt;     &gt; 2&gt; Do cloud-init permanently write network configuration in ifconfig<br>
&gt;     &gt; file(Centos) or interface file (ubuntu)?<br>
&gt;     &gt;<br>
&gt;<br>
&gt;     It does, in CentOS. Not sure about Ubuntu.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</span>&gt; ______________________________<wbr>_________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
&gt; <a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/users</a><br>
&gt;<br>
<br>
</blockquote></div><br></div>