Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1593239

Summary: Starting VM through RestAPI doesn't add cdrom with cloud-init
Product: [oVirt] ovirt-engine Reporter: biakymet
Component: RestAPIAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Vitalii Yerys <vyerys>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.3.0CC: andre.liebe, biakymet, bugs, dfediuck, gshereme, mavital, michal.skrivanek, mperina
Target Milestone: ovirt-4.2.7Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-02 14:35:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Engine log after starting with VmPortal
none
Engine log after starting with AdminPortal none

Description biakymet 2018-06-20 10:52:53 UTC
Created attachment 1453177 [details]
Engine log after starting with VmPortal

Description of problem:
When I try to start for the first time new VM with enabled cloud-init through RestAPI it doesn't add cdrom with cloud-init, but through AdminPortal everything works fine.

Version-Release number of selected component (if applicable):
Version 4.3.0-0.0.master.20180612172344.git9643156.el7

How reproducible:
Everytime

Steps to Reproduce:
1. Create new VM
2. Start it through VmPortal or RestAPI (used request:
http://[ENGINE_FQDN]/api/vms/[VM_ID]/start

Body:
{}
)

Actual results:
Starting without cloud-init cdrom.

Expected results:
Starting with cloud-init cdrom.

Additional info:

Comment 1 biakymet 2018-06-20 10:53:27 UTC
Created attachment 1453178 [details]
Engine log after starting with AdminPortal

Comment 2 Ori Liel 2018-06-25 08:55:00 UTC
My attempts to reproduce have led to the following findings:

1) Create a new VM with cloud-init
2) Start the VM, either via the API or via WebAdmin

Result: VM runs with cloud-init. 

Alternatively: 

1) Create a new VM with cloud-init
2) Run it
3) Shut it down
4) Run it a second time (either using WebAdmin or the API)

Result: VM runs without cloud-init.

So it works fine for a VM being run for the first time, but If this VM has been run once before the engine considers it 'initialized' and ignores cloud-init on purpose (unless it's runs as Run-Once, which in the API would mean that the VM is provided in the request body)

In summary it appears to me that this is not a bug. Could you please check, and if you agree, close this issue?

Comment 3 Ori Liel 2018-06-25 08:55:14 UTC
My attempts to reproduce have led to the following findings:

1) Create a new VM with cloud-init
2) Start the VM, either via the API or via WebAdmin

Result: VM runs with cloud-init. 

Alternatively: 

1) Create a new VM with cloud-init
2) Run it
3) Shut it down
4) Run it a second time (either using WebAdmin or the API)

Result: VM runs without cloud-init.

So it works fine for a VM being run for the first time, but If this VM has been run once before the engine considers it 'initialized' and ignores cloud-init on purpose (unless it's runs as Run-Once, which in the API would mean that the VM is provided in the request body)

In summary it appears to me that this is not a bug. Could you please check, and if you agree, close this issue?

Comment 4 André Liebe 2018-06-26 05:25:40 UTC
The problem arises when I prepare vm (with customization and prepopulated cloud-init data), make a template from it and let users create a vm from that template with cloud-init enabled (passing in used defined hostname and andmin defined custom script settings) in vm portal.

see https://github.com/oVirt/ovirt-web-ui/issues/642 for my use case

Comment 5 Greg Sheremeta 2018-07-31 15:19:21 UTC
@Ori or Michal, can we backport to 4.2.6 for web-ui 1.4.2? (this bz is currently untargeted)

Comment 6 Martin Perina 2018-08-08 11:46:05 UTC
(In reply to Greg Sheremeta from comment #5)
> @Ori or Michal, can we backport to 4.2.6 for web-ui 1.4.2? (this bz is
> currently untargeted)

Ori agreed, no problem with backport to 4.2

Comment 7 Vitalii Yerys 2018-08-30 11:04:59 UTC
Verified upstream:

ovirt-engine-4.2.6.5-0.0.master.20180827083432.git51e39c2.el7.noarch
ovirt-web-ui-1.3.9-1.el7ev.noarch
vdsm-http-4.20.38-8.git9f3cc73.el7.noarch

Comment 8 Raz Tamir 2018-09-05 08:55:49 UTC
QE verification bot: the bug was verified upstream

Comment 9 Sandro Bonazzola 2018-11-02 14:35:32 UTC
This bugzilla is included in oVirt 4.2.7 release, published on November 2nd 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.7 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.