[ovirt-users] Cloud-Init with python SDK (oVirt 3.6.2)

Vladimir Astafiev v.astafiev at gmail.com
Tue Feb 9 14:39:34 UTC 2016


I'm sorry. Mistake in version. Correct version is 3.6.2.

On 02/02/16 19:54, Vladimir Astafiev wrote:
> Hi,
>
> Before the last update to 3.6.3 I used this code to init VMs via 
> Cloud-Init
>
> cloud_init = params.CloudInit(regenerate_ssh_keys=True,
> users=params.Users(user=[params.User(user_name="root", 
> password=vm_config.rootpw)]),
>                               files=files, host=host,
> network_configuration=params.NetworkConfiguration(
> nics=params.Nics(nic=[params.NIC(name='eth0',
> boot_protocol='static',
> on_boot=True,
> network=params.Network(
> ip=params.IP(address=vm_config.ipaddress,
> netmask=vm_config.netmask,
> gateway=vm_config.gateway)))]),
> dns=params.DNS(servers=params.Hosts(host=[params.Host(address=vm_config.dns1), 
>
> params.Host(address=vm_config.dns2)]))))
>
> action = params.Action(use_cloud_init=True, 
> vm=params.VM(initialization=params.Initialization(regenerate_ssh_keys=True, 
> cloud_init=cloud_init)))
> vm.start(action=action)
>
>
> After updating to 3.6.3 the code stopped working. After initializing I 
> get this payload:
>
>
> # ll -R /mnt
> /mnt:
> total 2
> drwxr-xr-x. 3 root root 2048 Feb  2 19:25 openstack
>
> /mnt/openstack:
> total 2
> drwxr-xr-x. 2 root root 2048 Feb  2 19:25 latest
>
> /mnt/openstack/latest:
> total 1
> -rw-r-----. 1 root root 200 Feb  2 19:25 meta_data.json
> -rw-r-----. 1 root root 316 Feb  2 19:25 user_data
>
> # cat /mnt/openstack/latest/user_data
> #cloud-config
> ssh_pwauth: true
> disable_root: 0
> ssh_deletekeys: 'True'
> output:
>   all: '>> /var/log/cloud-init-output.log'
> chpasswd:
>   expire: false
> runcmd:
> - 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo 
> ''datasource_list:
>   ["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'
>
> # cat /mnt/openstack/latest/meta_data.json
> {
>   "launch_index" : "0",
>   "availability_zone" : "nova",
>   "uuid" : "d6309b89-c793-4db5-83bc-9c38a18b1bfa",
>   "meta" : {
>     "essential" : "false",
>     "role" : "server",
>     "dsmode" : "local"
>   }
> }
>
> I believe, this commit [1] changed API. Can someone give me an advice 
> on where to change the code so it will work again?
>
>
> [1] https://gerrit.ovirt.org/#/c/50240/
>

-- 
Vladimir Astafiev




More information about the Users mailing list