[ovirt-users] the difference to set the cloud-init via api/sdk between 3.5 and 3.6

pc pc at pcswo.com
Sun Nov 8 23:08:51 EST 2015


Hi there,
I upgraded ovirt from 3.5.4 to 3.6.0 last weekend.  Here is  what I found: cloud-init relatied api/sdk failed to work which was effective on 3.5
[conclusion]the difference is whether to use this:  <use_cloud_init>true</use_cloud_init>
[more in depth]ovirt-3.5: vm t3ovirt-3.6: vm t2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root at test01 bin]# diff t3.cloud-init.xml t2.cloud-init.xml 
3c3,4
<   <vm>
---
> <use_cloud_init>true</use_cloud_init>
> <vm>
5,35c6,36
<       <cloud_init>
<         <host>
<           <address>t3</address>
<           </host>
<         <users>
<           <user>
<             <user_name>root</user_name>
<             <password>ttt111</password>
<           </user>
<         </users>
<         <regenerate_ssh_keys>true</regenerate_ssh_keys>
<         <network_configuration>
<           <nics>
<             <nic>
<               <name>eth0</name>
<               <boot_protocol>static</boot_protocol>
<               <network>
<                 <ip address="10.1.3.1" netmask="255.255.255.0" gateway="10.1.3.254"/>
<               </network>
<               <on_boot>true</on_boot>
<             </nic>
<           </nics>
<           <dns>
<             <servers>
<               <host>
<                 <address>255.255.255.0</address>
<               </host>
<             </servers>
<           </dns>
<         </network_configuration>
<       </cloud_init>
---
>         <cloud_init>
>             <host>
>                 <address>t2</address>
>             </host>
>             <regenerate_ssh_keys>true</regenerate_ssh_keys>
>             <users>
>                 <user>
>                     <user_name>root</user_name>
>                     <password>ttt222</password>
>                 </user>
>             </users>
>             <network_configuration>
>                 <nics>
>                     <nic>
>                         <name>eth0</name>
>                         <boot_protocol>static</boot_protocol>
>                         <network>
>                             <ip address="10.122.1.201" netmask="255.255.255.0" gateway="10.122.1.1" />
>                         </network>
>                         <on_boot>true</on_boot>
>                     </nic>
>                 </nics>
>                 <dns>
>                     <servers>
>                         <host>
>                             <address>8.8.8.8</address>
>                         </host>
>                     </servers>
>                 </dns>
>             </network_configuration>
>         </cloud_init>
37c38
<   </vm>
---
> </vm>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[howto-api]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~curl -s --cacert ca.crt -H "Content-Type: application/xml" -u "admin at internal:TestVM" \
-d '
<action>
<use_cloud_init>true</use_cloud_init>
<vm>
    <initialization>
        <cloud_init>
            <host>
                <address>t2</address>
            </host>
            <regenerate_ssh_keys>true</regenerate_ssh_keys>
            <users>
                <user>
                    <user_name>root</user_name>
                    <password>ttt222</password>
                </user>
            </users>
            <network_configuration>
                <nics>
                    <nic>
                        <name>eth0</name>
                        <boot_protocol>static</boot_protocol>
                        <network>
                            <ip address="10.122.1.201" netmask="255.255.255.0" gateway="10.122.1.1" />
                        </network>
                        <on_boot>true</on_boot>
                    </nic>
                </nics>
                <dns>
                    <servers>
                        <host>
                            <address>8.8.8.8</address>
                        </host>
                    </servers>
                </dns>
            </network_configuration>
        </cloud_init>
    </initialization>
</vm>
</action>
' https://e01.test/api/vms/cd81138d-c893-444f-96e7-a558d726320a/start -o result.xml~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[howto-validate]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[root at host01~]# mount -o loop `ps -ef |grep --color payload |grep -v grep |cut -d',' -f36 |cut -d'=' -f3` /mnt \
> && cat /mnt/openstack/latest/* 
{
  "launch_index" : "0",
  "availability_zone" : "nova",
  "network-interfaces" : "auto eth0\niface eth0 inet static\n  address 10.122.1.201\n  netmask 255.255.255.0\n  gateway 10.122.1.1\n  dns-nameservers 8.8.8.8\n",
  "name" : "t2",
  "network_config" : {
    "content_path" : "/content/0000",
    "path" : "/etc/network/interfaces"
  },
  "hostname" : "t2",
  "uuid" : "55585bbc-00ca-4a3a-afec-7886c87dc523",
  "meta" : {
    "essential" : "false",
    "role" : "server",
    "dsmode" : "local"
  }
}#cloud-config
ssh_pwauth: true
disable_root: 0
ssh_deletekeys: 'True'
output:
  all: '>> /var/log/cloud-init-output.log'
user: root
password: ttt222
chpasswd:
  expire: false
runcmd:
- 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list:
  ["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'
[root at host01~]# tree /mnt/ && umount /mnt/mnt/
└── openstack
    └── latest
        ├── meta_data.json
        └── user_data~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[more]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~if I change this:
                <user>                    <user_name>root</user_name>                    <password>ttt222</password>                </user>
to:
                <user>                    <name>root</name>                    <password>ttt222</password>                </user>
or:
                <user>                    <name>root</user_name>                    <passwo>ttt222</password>                </user>
Request without a response to an error, and one line lost in xxx.img/openstack/latest/user_data:"password: ttt222"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[what I want] 1) How to find more docs for api/sdk?2) Is there anything (such as change log, tutorials ) for ovirt api/sdk upgrade?3) How to use cloud-init in ovirt-engine-sdk-python-3.6.0.3 ?
[source file]https://github.com/opera443399/ops/blob/master/bin/linux/ovirt_api.shhttps://github.com/opera443399/ops/blob/master/bin/linux/ovirt_api_usage_action.xmlhttps://github.com/opera443399/ops/blob/master/bin/linux/ovirt_sdk.py
The end.

----------Sincerely,
Peng Chao (pc at pcswo.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20151109/43c9e4bc/attachment-0001.html>


More information about the Users mailing list