On 09/01/2016 05:26 PM, Renout Gerrits wrote: > Thanks for pointing me in the right direction. That works :) > > On Wed, Aug 31, 2016 at 12:45 PM, Ondra Machacek <omach...@redhat.com > <mailto:omach...@redhat.com>> wrote: > > 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> > <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(..) >
In addition the VmService.start method doesn't have an "action" parameter, it has the following parameters: def start( self, async=None, filter=None, pause=None, use_cloud_init=None, use_sysprep=None, vm=None, ): So your code should look like this: vm_service.start( use_cloud_init=True, 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@ovirt.org <mailto:Users@ovirt.org> > http://lists.ovirt.org/mailman/listinfo/users > <http://lists.ovirt.org/mailman/listinfo/users> > > > > > _______________________________________________ > 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