[ovirt-users] ovirtsdk4 and cloud-init

Ondra Machacek omachace at redhat.com
Wed Aug 31 10:45:40 UTC 2016


On 08/31/2016 12:36 PM, Renout Gerrits wrote:
> I have some troubles starting a VM with cloud-init via the ovirtsdk4.
>
> <snippet>
> vm = vms_service.list(search=vm_name)[0]
> vm_service = vms_service.vm_service(vm.id <http://vm.id>)
>
> vm_service.start(
>     types.Action(
>         use_cloud_init=True,
>     ),
>     types.Vm(
>         types.Initialization(
>             regenerate_ssh_keys=True,
>             host_name=vm_fqdn,
>             nic_configurations=[
>                 types.NicConfiguration(
>                     boot_protocol=types.BootProtocol.STATIC,
>                     name='eth0',
>                     on_boot=True,
>                     ip=types.Ip(
>                         address=vm_address,
>                         netmask=vm_netmask,
>                         gateway=vm_gateway,
>                     ),
>                 ),
>             ],
>         ),
>     ),
> )

You have to use named parameters:
like:

action=types.Action(..)
vm=types.Vm(..)


> </snippet>
>
> Which will result in:
> Traceback (most recent call last):
>   File "./create_vm.py", line 94, in <module>
>     gateway=vm_gateway,
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py", line
> 18655, in start
>     Writer.write_boolean(writer, 'async', async)
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/writer.py", line
> 52, in write_boolean
>     return writer.write_element(name, Writer.render_boolean(value))
>   File "/usr/lib64/python2.7/site-packages/ovirtsdk4/writer.py", line
> 44, in render_boolean
>     raise TypeError('The \'value\' parameter must be a boolean')
> TypeError: The 'value' parameter must be a boolean
>
> To be honest I don't have clue where it's going wrong or where to look.
> From what I can see there are two values which must be a boolean and
> they are.
>
> Does anybody know what's going wrong or has a working snippet?
>
> Thanks,
> Renout
>
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>



More information about the Users mailing list