[ovirt-users] How to configure Cloud-init in Guest OS ?

Juan Hernández jhernand at redhat.com
Thu Mar 16 19:21:06 UTC 2017


On 03/16/2017 04:09 PM, TranceWorldLogic . wrote:
> Hi,
> 
> 
> I am trying to create file using same API, as shown below:
> --------------------------------------------------
> scontent="Hello World !!"
> 
> vm_service.start(
>     use_cloud_init=True,
>     vm = types.Vm(
>         initialization=types.Initialization(
>             cloud_init=types.CloudInit(
>                 files=[types.File(name="/root/hello.conf",
> content=scontent, type="PLAINTEXT")],
>             ),
>         ),
>     ),
> )
> ----------------------------------------------------
> 
> Can someone help me to understand ? why it is not working.
> Or Is that variable "cloud_init=" not handled in ovirt ?
> 

That may have been the initial design of the feature, but it doesn't
currently work. That 'files' element isn't used at all. The recommended
way to create a file is using the custom script, as explained in this
example:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py#L48-L57

The use of 'types.CloudInit' is also disencouraged, use directly the
attributes of 'types.Initialization', as explained here:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py#L59-L86

> 
> 
> On Thu, Mar 16, 2017 at 7:33 PM, Juan Hernández <jhernand at redhat.com
> <mailto:jhernand at redhat.com>> wrote:
> 
>     On 03/16/2017 02:22 PM, TranceWorldLogic . wrote:
>     > Hi,
>     >
>     > I am trying to use cloud-int to provide some text file in guest OS as
>     > mention in below link. (tried using sdk)
>     > But it is not working.
>     > http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/
>     <http://www.ovirt.org/develop/release-management/features/cloud/cloud-init-integration/>
>     >
> 
>     What SDK are you using? I guess that the Python SDK. Did you try this
>     example:
> 
> 
>     https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py
>     <https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py>
> 
>     > 1> Do I need to do some configure cloud-init in Guest OS ?
>     > -> I hav just install cloud-init package in my 2 guest
>     >       For centos 6.8 => yum install cloud-init
>     >       For ubuntu 14.05 => apt-get install cloud-init
>     >
> 
>     That should be eough, at least in CentOS. Not sure about Ubuntu.
> 
>     Note that you are using a quite old version of CentOS, so you may also
>     be using an old or buggy version of cloud-init. Did you try with latest
>     CentOS 7?
> 
>     > 2> Do cloud-init permanently write network configuration in ifconfig
>     > file(Centos) or interface file (ubuntu)?
>     >
> 
>     It does, in CentOS. Not sure about Ubuntu.
> 
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 



More information about the Users mailing list