<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"><<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/16/2017 04:09 PM, TranceWorldLogic . wrote:<br>
> Hi,<br>
><br>
><br>
</span><span class="">> I am trying to create file using same API, as shown below:<br>
> ------------------------------<wbr>--------------------<br>
> scontent="Hello World !!"<br>
><br>
> vm_service.start(<br>
> use_cloud_init=True,<br>
> vm = types.Vm(<br>
> initialization=types.<wbr>Initialization(<br>
> cloud_init=types.CloudInit(<br>
> files=[types.File(name="/root/<wbr>hello.conf",<br>
> content=scontent, type="PLAINTEXT")],<br>
> ),<br>
> ),<br>
> ),<br>
> )<br>
> ------------------------------<wbr>----------------------<br>
><br>
> Can someone help me to understand ? why it is not working.<br>
> Or Is that variable "cloud_init=" not handled in ovirt ?<br>
><br>
<br>
</span>That may have been the initial design of the feature, but it doesn't<br>
currently work. That 'files' element isn'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 'types.CloudInit' is also disencouraged, use directly the<br>
attributes of 'types.Initialization', 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>
><br>
><br>
> On Thu, Mar 16, 2017 at 7:33 PM, Juan Hernández <<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
</span><span class="">> <mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>>> wrote:<br>
><br>
> On 03/16/2017 02:22 PM, TranceWorldLogic . wrote:<br>
> > Hi,<br>
> ><br>
> > I am trying to use cloud-int to provide some text file in guest OS as<br>
> > mention in below link. (tried using sdk)<br>
> > But it is not working.<br>
> > <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>
> <<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>
> ><br>
><br>
> What SDK are you using? I guess that the Python SDK. Did you try 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" 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>
> <<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>
><br>
> > 1> Do I need to do some configure cloud-init in Guest OS ?<br>
> > -> I hav just install cloud-init package in my 2 guest<br>
> > For centos 6.8 => yum install cloud-init<br>
> > For ubuntu 14.05 => apt-get install cloud-init<br>
> ><br>
><br>
> That should be eough, at least in CentOS. Not sure about Ubuntu.<br>
><br>
> Note that you are using a quite old version of CentOS, so you may also<br>
> be using an old or buggy version of cloud-init. Did you try with latest<br>
> CentOS 7?<br>
><br>
> > 2> Do cloud-init permanently write network configuration in ifconfig<br>
> > file(Centos) or interface file (ubuntu)?<br>
> ><br>
><br>
> It does, in CentOS. Not sure about Ubuntu.<br>
><br>
><br>
><br>
><br>
</span>> ______________________________<wbr>_________________<br>
> Users mailing list<br>
> <a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
> <a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/users</a><br>
><br>
<br>
</blockquote></div><br></div>