Hi Juan, Okay.. Thanks for your update. Also i found some sample cloud init scripts from here https://github.com/number5/cloud-init/tree/master/doc/examples and i tried the following scripts
- type: foo/wark filename: bar content: | This is my payload hello - this is also payload - | multi line payload here - type: text/upstart-job filename: my-upstart.conf content: | Test file contents And run the start vm using the above script using cloud init and api, Could you please tell me where i can find the result of the above script ? I think the above script will create a file like my-upstart.conf -- Regards Shanil On Thu, Sep 4, 2014 at 1:56 PM, Juan Hernandez <jhern...@redhat.com> wrote: > On 09/04/2014 06:29 AM, Shanil S wrote: > > Hi Juan, > > > > Is there anyways to specify the custom script from a file in the xml ? > > ie, i have a script in a file called script.sh and i would like to > > include this script in the xml with the api call. Is there any methods > > for this ? > > > > You can deploy files using cloud-init, and the run them using the custom > script. Something like this: > > <action> > ... > <initialization> > <cloud-init> > <files> > <file name="/root/myscript.sh"/> > <content><![CDATA[#!/bin/sh the content of your > script]]></content> > </file> > </files> > </cloud-init> > <custom_script><![CDATA[runcmd: > - sh /root/myscript.sh > ]]></custom_script> > </initialization> > </action> > > But I'm not a cloud-init expert, and I didn't test this, so I don't > really know if the custom_script will run before or after the files are > deployed. It makes more sense to run the scripts after deploying the > files, but you will have to test it yourself. > > The content of the files and the scripts has to be embedded in the XML > document that you send to the RESTAPI server, there is no way to send an > XML document and a separate file. Building this kind of XML document > shouldn't be complicated if you use the CDATA syntax like in the example > above. > > Another thing that you may consider, if you have to run a complicated > script or set of scripts, is to have them pre-installed in the template > that you use to create the VM, then you just need to run them. > > > -- > > Regards > > Shanil > > > > > > On Tue, Sep 2, 2014 at 3:02 PM, Shanil S <xielessha...@gmail.com > > <mailto:xielessha...@gmail.com>> wrote: > > > > Hi Juan, > > > > Thanks for the solution. > > > > -- > > Regards > > Shanil > > > > > > On Tue, Sep 2, 2014 at 2:59 PM, Juan Hernandez <jhern...@redhat.com > > <mailto:jhern...@redhat.com>> wrote: > > > > On 09/02/2014 05:46 AM, Shanil S wrote: > > > Hi All, > > > > > > From the ovirt admin panel, there is an option to give the > > custom script > > > in the cloud init ( Run Once-> cloud init- > Custom script ). > > Is there > > > any ways to pass the custom script to cloud init using the > > rest api ? > > > > > > > The custom script should go inside the "custom_script" element > > inside > > the "initialization" element: > > > > <action> > > ... > > <initialization> > > <cloud_init>...</cloud_init> > > <custom_script>your custom script</custom_script> > > </initialization> > > </action> > > > > -- > > Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, > > planta > > 3ºD, 28016 Madrid, Spain > > Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red > > Hat S.L. > > > > > > > > > > > > _______________________________________________ > > Users mailing list > > Users@ovirt.org > > http://lists.ovirt.org/mailman/listinfo/users > > > > > -- > Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta > 3ºD, 28016 Madrid, Spain > Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L. >
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users