[ovirt-users] cloud_init not apply when v create from API

Arpit Makhiyaviya arpit.icreate at gmail.com
Tue Mar 29 13:07:46 UTC 2016


Thanks for quick response.
we already knew this and we are passing following xml when calling Start
action.

<action>
<vm>
  <initialization>
     <cloud_init>
       <host>
         <address>vm-cloud-init-restapi</address>
       </host>
       <authorized_keys>
         <authorized_key>
           <user>
             <user_name>root</user_name>
           </user>
           <key>ssh-rsa restapi-cloud-init-ssh-key root at localdomain</key>
         </authorized_key>
       </authorized_keys>
       <regenerate_ssh_keys>true</regenerate_ssh_keys>
       <timezone>Atlantic/Reykjavik</timezone>
       <users>
         <user>
           <user_name>root</user_name>
           <password>SuperSecretPassword!</password>
         </user>
       </users>
       <network_configuration>
         <nics>
           <nic>
             <name>eth0</name>
             <boot_protocol>STATIC</boot_protocol>
             <network>
               <ip address="192.168.2.11" netmask="255.255.255.0"
gateway="192.168.2.254" />
             </network>
             <on_boot>true</on_boot>
           </nic>
           <nic>
             <name>eth1</name>
             <boot_protocol>DHCP</boot_protocol>
             <on_boot>true</on_boot>
           </nic>
         </nics>
         <dns>
           <servers>
             <host>
               <address>10.20.30.100</address>
             </host>
           </servers>
           <search_domains>
             <host>
               <address>domain.your.rhevm.com</address>
             </host>
           </search_domains>
         </dns>
       </network_configuration>
       <files>
         <file>
           <name>/tmp/file1.txt</name>
           <content>line 1
line 2
and now something special
!@#$%^&amp;*()_+</content>
           <type>PLAINTEXT</type>
         </file>
       </files>
     </cloud_init>
  </initialization>
</vm>
</action>

we also found following link . is this related to my issue?

https://gerrit.ovirt.org/#/c/50240/2

Regards,
*Arpit Makhiyaviya*
Software Engineer
+91-79-40038284
+91-971-437-6669
<http://www.sculptsoft.com>

On Tue, Mar 29, 2016 at 6:24 PM, Renout Gerrits <mail at renout.nl> wrote:

> In the more recent versions you have to use 'use_cloud_init=True' in the
> api, which isn't described in most documentation yet. Maybe thats the
> reason it isn't working?
>
> Here's a working snippet:
>
> vm = api.vms.get(name=vm_name)
>
> action = params.Action(
>     use_cloud_init=True,
>     vm=params.VM(
>       initialization=params.Initialization(
>         regenerate_ssh_keys=True,
>         host_name=vm_fqdn,
>         nic_configurations=params.GuestNicsConfiguration(
>           nic_configuration=[
>             params.GuestNicConfiguration(
>               name="eth0",
>               boot_protocol="static",
>               on_boot=True,
>               ip=params.IP(
>                 address=vm_address,
>                 netmask=vm_netmask,
>                 gateway=vm_gateway,
>                 ),
>               ),
>             ],
>           ),
>         ),
>       ),
>     )
>
> vm.start(action)
>
>
> On Tue, Mar 29, 2016 at 2:03 PM, Arpit Makhiyaviya <
> arpit.icreate at gmail.com> wrote:
>
>> Hello,
>> we are using ovirt api with json data format.
>> we have create vm from template and i want to set ip,macaddress,user and
>> password for that we are using cloud_init for that we it can't set any
>> options.
>>
>>
>> Regards,
>> *Arpit Makhiyaviya*
>> Software Engineer
>> +91-79-40038284
>> +91-971-437-6669
>> <http://www.sculptsoft.com>
>>
>> _______________________________________________
>> Users mailing list
>> Users at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160329/e7ecf028/attachment-0001.html>


More information about the Users mailing list