[ovirt-users] Add multiple files to a VM via cloud-init
Branimir Pejakovic
branimirp at gmail.com
Thu Oct 30 10:06:29 UTC 2014
On Thu, Oct 30, 2014 at 7:22 AM, Shahar Havivi <shaharh at redhat.com> wrote:
> On 29.10.14 17:35, Branimir Pejakovic wrote:
> > Hi list,
> >
> > I was wondering is there a way to add multiple files to a vm via
> cloud-init
> > using python SDK. I was able to add /etc/resolv.conf and additionally I
> > would like to add config files for NICs (ifcfg-ethX) with appropriate
> > values (ip,gw,netmask). I used an example given here:
> > http://www.ovirt.org/Features/Cloud-Init_Integration . But
> unfortunately I
> > cannot do the same thing If I want to write multiple files to a vm in
> > params.Action class.
> >
> > Thank you in advance!
> you can use the custom script text box in oVirts cloud-init section,
> there you can add any cloud-init section - adding files examples can be
> found
> here:
>
> http://cloudinit.readthedocs.org/en/latest/topics/examples.html#writing-out-arbitrary-files
>
> Shahar Havivi.
>
>
Hi Shahar,
Thank you for the reply.
To be honest I knew for those scripts but I want to do it in automate
fashion just like in that example that I put in my original message. I have
tried to specify in params.Files class multiple files:
vm_file1 = params.Files(file=[params.File(name = 'file1', content =
file1_content, type_= 'PLAINTEXT')])
vm_file2 = params.Files(file=[params.File(name = 'file2', content =
file2_content, type_= 'PLAINTEXT')])
and then give them as arguments to params.CloudInit _init_ constructor
(files=...) just like in that example above but it seems that I am doing
something wrong because it does not write multiple files - it writes only
when you specify one file all right. The exception is "Error: 'list' object
has no attribute 'export'" (I tried to specify those files as a list -
files=[vm_file1,vm_file2]).
Thanks for any help.
Best regards,
Branimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20141030/e90e2160/attachment-0001.html>
More information about the Users
mailing list