Bug 1391791

Summary: [Docs][Python SDK] Python SDK cloud-init example is missing use_cloud_init=True
Product: Red Hat Enterprise Virtualization Manager Reporter: Germano Veit Michel <gveitmic>
Component: DocumentationAssignee: Avital Pinnick <apinnick>
Status: CLOSED CURRENTRELEASE QA Contact: Byron Gravenorst <bgraveno>
Severity: low Docs Contact:
Priority: medium    
Version: 4.0.3CC: gveitmic, juan.hernandez, lbopf, lsurette, pstehlik, rbalakri, srevivo, ykaul, ylavi
Target Milestone: ovirt-4.1.3Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-21 04:38:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Docs RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Germano Veit Michel 2016-11-04 04:26:58 UTC
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)
....

Comment 1 Yaniv Lavi 2017-01-31 08:55:39 UTC
Do we have an examples for this?

Comment 2 Juan Hernández 2017-01-31 09:03:46 UTC
Yes, there is a complete example here:

  https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm_with_cloud_init.py

Comment 3 Juan Hernández 2017-01-31 09:04:28 UTC
Note that the example above is for version 4 of the API.

Comment 4 Yaniv Lavi 2017-02-07 07:37:37 UTC
Please see the example from the SDK comment #2.

Comment 5 Germano Veit Michel 2017-02-08 05:57:37 UTC
(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.

Comment 6 Lucy Bopf 2017-07-28 08:40:28 UTC
Assigning to Avital for review.

Comment 8 Germano Veit Michel 2017-07-31 01:55:36 UTC
(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