Hide Forgot
Description of problem: The example here: https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/paged/python-sdk-guide/220-example-starting-a-virtual-machine-with-cloud-init-using-python To attach the cloud-init payload to the VM during startup we need to specify use_cloud_init=True in the action of starting the VM. Otherwise cloud-init is just configured by the user but the VM does not see it, so it won't run and won't init the VM. That code does not work for me. I need to add the use_cloud_init flag, we need to: ... action = params.Action(use_cloud_init=True, .... vm.start(action=action) ....
Do we have an examples for this?
Yes, there is a complete example here: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py
Note that the example above is for version 4 of the API.
Please see the example from the SDK comment #2.
(In reply to Yaniv Dary from comment #4) > Please see the example from the SDK comment #2. Hi Yaniv, Yes, the example is correct. But our RHV Documentation is not. I remember testing it quite a few times at that time and it did not work. Our docs are configuring all the parameters but forgetting to "click the enable button". Following our docs the payload is not attached to the VM because it's booted without "use-cloudinit". Maybe just copy the example to RHV Documentation? The example worked fine at the time I tested it. Please consider reopening.
Assigning to Avital for review.
Germano, please review the document previews. Updated Python SDK 4.0: http://file.tlv.redhat.com/~apinnick/BZ1391791_4.0/#Example_Starting_a_Virtual_Machine_with_Cloud-Init_using_Python Updated Python SDK 4.1: http://file.tlv.redhat.com/~apinnick/BZ1391791_4.1/#Example_Starting_a_Virtual_Machine_with_Cloud-Init_using_Python
(In reply to Avital Pinnick from comment #7) > Germano, please review the document previews. > > Updated Python SDK 4.0: > http://file.tlv.redhat.com/~apinnick/BZ1391791_4.0/ > #Example_Starting_a_Virtual_Machine_with_Cloud-Init_using_Python > > Updated Python SDK 4.1: > http://file.tlv.redhat.com/~apinnick/BZ1391791_4.1/ > #Example_Starting_a_Virtual_Machine_with_Cloud-Init_using_Python Looks better now, the "use_cloud_init=True" is there. Thanks
Updated document: https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.1/html-single/python_sdk_guide/