Bug 1093755
Summary: | [BUG] can't boot vm with cloud-init data submitted as json via REST api | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] oVirt | Reporter: | Sven Kieske <s.kieske> | ||||||
Component: | ovirt-engine-api | Assignee: | Juan Hernández <juan.hernandez> | ||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Pavel Stehlik <pstehlik> | ||||||
Severity: | urgent | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 3.4 | CC: | acathrow, bazulay, emesika, gklein, iheim, juan.hernandez, oourfali, sbonazzo, yeylon | ||||||
Target Milestone: | --- | Keywords: | Regression | ||||||
Target Release: | 3.4.1 | ||||||||
Hardware: | x86_64 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | infra | ||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2014-05-08 13:37:33 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 1080483 | ||||||||
Attachments: |
|
Description
Sven Kieske
2014-05-02 14:48:14 UTC
Created attachment 891906 [details]
jboss exception log
this looks like a regression. it did work in 3.3.3. I therefore add this as a blocker for 3.4.1 release. Here is the json used to start the vm: {"vm":{"initialization":{"cloud_init":{"host":{"address":"test"},"network_configuration":{"nics":{"nics":[{"name":"eth0","boot_protocol":"STATIC","network":{"ip":{"address":"10.211.0.236","netmask":"255.255.255.248","gateway":"10.211.0.233"}},"on_boot":true}]},"dns":{"servers":{"hosts":[{"address":"46.30.62.99"},{"address":"46.30.62.98"},{"address":"46.30.62.97"}]}}},"users":{"users":[{"name":"root","password":"#9Dh2--3xz-h95Zy"}]},"files":{"files":[{"name":"\/foo\/test","content":"test","type":"PLAINTEXT"}]}}}}} Removing from 3.4.1 blockers since this has been re-targeted to 3.4.2. Re-targeted to 3.4.1 and re-added to blockers for 3.4.1 since it fails Release Criteria test: MUST: No regressions from 3.3 Release Please check if this is a real regression or an error in the JSON. If it's not a regression, please remove Regression keyword, remove this from blockers for 3.4.1 and re-tartget. Otherwise please fix this ASAP since without this bug fixed we can't release 3.4.1. There are some issues with the JSON document that you are sending, and there is also a bug in the engine that prevents returning a proper error response. The issues with the document are the following: 1. You shouldn't send a "vm" element. Instead of this: { "vm": { ... } } Send this: { ... } 2. You need to specify a name, a cluster and a template (by id or name) in order to create a VM: { "name": "myvm", "cluster": { "id": "..." }, "template": { "id": "..." }, ... } 3. Arrays are named in singular, not in plural. In your case this applies to "nics", "hosts", "users" and "files". You are currently sending this: "network_configuration": { "nics": { "nics": [ ... ] }, } But you should send this: "network_configuration": { "nics": { "nic": [ ... ] }, } Note that the name of the dictionary is "nics", in plural, but the name of the array is "nic", in singular. Same for the other arrays. If you fix this in your client then the VM should be created correctly. However, if you make any mistake, the bug will trigger and the error message will be useless. I will attach a complete example of how to create the VM using JSON. Created attachment 892489 [details]
Example script to create a VM using JSON
The proposed patch fixes the issue with the error messages. That is a regression. I can confirm that the following json works to run-once a vm via rest, notice there are some differences to the json submitted by juan. I don't use this to create and start the vm in one step, the vm is already created: {"vm":{"initialization":{"cloud_init":{"host":{"address":"test"},"network_configuration":{"nics":{"nic":[{"name":"eth0","boot_protocol":"STATIC","network":{"ip":{"address":"10.211.0.244","netmask":"255.255.255.248","gateway":"10.211.0.241"}},"on_boot":true}]},"dns":{"servers":{"host":[{"address":"46.30.62.99"},{"address":"46.30.62.98"},{"address":"46.30.62.97"}]}}},"users":{"user":[{"name":"root","password":"#9Dh2--3xz-h95Zy"}]},"files":{"file":[{"name":"\/foo\/test","content":"test","type":"PLAINTEXT"}]}}}}} specifically, in order to "run-once" a vm you need the { "vm": { ... } } element opposing to what juan said. I hope this is by design, and not a bug? Yes, it is by design. The operation to create a VM receives a VM entity as parameter. In XML this is represented as follows: <vm> <name>blah</name> ... </vm> In JSON the outer "vm" element isn't needed: { "name": "blah", ... } But the the operation to start a VM doesn't receive a VM entity as parameter, it receives an Action entity, which contains a VM, and maybe other things. In XML this is represented as follows: <action> <vm> <name>blah</name> ... </vm> ... </action> As always the outer element isn't used in JSON, so the representation of the action is the following: { "vm": { "name": "blah", ... } ... } This is an automated message oVirt 3.4.1 has been released: * should fix your issue * should be available at your local mirror within two days. If problems still persist, please make note of it in this bug report. |