Bug 1326810

Summary: Cannot edit HE VM via REST API
Product: [oVirt] ovirt-engine Reporter: Artyom <alukiano>
Component: BLL.HostedEngineAssignee: Roman Mohr <rmohr>
Status: CLOSED CURRENTRELEASE QA Contact: Artyom <alukiano>
Severity: high Docs Contact:
Priority: urgent    
Version: 3.6.5CC: alukiano, bugs, dfediuck, jtokar, mgoldboi, rgolan, rmohr, roman, ykaul, ylavi
Target Milestone: ovirt-3.6.7Keywords: AutomationBlocker, Triaged, ZStream
Target Release: ---Flags: rule-engine: ovirt-3.6.z+
ylavi: blocker+
mgoldboi: planning_ack+
msivak: devel_ack+
mavital: testing_ack+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Some VM devices were not imported. See bug https://bugzilla.redhat.com/show_bug.cgi?id=1328921 for details. Consequence: Hosted Engine VM was only editable through the GUI but not through the REST API. Fix: Import video and graphics devices. Result: Editing allowed values is now possible through the GUI and through the REST API.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-04 12:33:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1328921    
Bug Blocks:    

Description Artyom 2016-04-13 13:02:04 UTC
Description of problem:
Impossible to edit HE VM via REST API

Version-Release number of selected component (if applicable):
rhevm-3.6.5.3-0.1.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. Deploy hosted engine and add storage domain to engine to auto-import it
2. Try to edit HE VM via REST
<vm>
<name>HostedEngine1</name>
</vm>
3.

Actual results:
<fault>
<reason>Operation Failed</reason>
<detail>[There was an attempt to change Hosted Engine VM values that are locked.]</detail>
</fault>

Expected results:
Possible to edit HE VM values that we permit to edit via UI

Additional info:

Comment 1 Martin Sivák 2016-04-13 15:37:05 UTC
Please show the exact request you used.

Comment 2 Artyom 2016-04-13 16:04:22 UTC
I did PUT request, you can see it under step 2, but I also tried the same thing for memory and cpu:
<vm>
<memory>some_value</memory>
</vm>

<vm>
<cpu>
<topologysockets="4"cores="1"threads="1"/>
</cpu>
</vm>

Comment 3 Martin Sivák 2016-04-13 16:51:26 UTC
Ok, the VM name should not be editable so that is correct. But the two others should be.

I found out that the REST api change for memory tries to update the diskList attribute and that prevents the rest of the change from being applied.

Comment 4 Martin Sivák 2016-04-13 17:07:20 UTC
Another check that fails in CanDoAction is isNumOfMonitorsLegal. And that happens although both db and params value of numOfMonitors is 1.

Comment 5 Martin Sivák 2016-04-13 17:09:48 UTC
Both issues happen only when the edit is done over REST.

Comment 6 Jenny Tokar 2016-04-18 15:05:47 UTC
*** Bug 1327891 has been marked as a duplicate of this bug. ***

Comment 7 Roman Mohr 2016-04-20 15:29:27 UTC
(In reply to Martin Sivák from comment #4)
> Another check that fails in CanDoAction is isNumOfMonitorsLegal. And that
> happens although both db and params value of numOfMonitors is 1.

That's a different bug: https://bugzilla.redhat.com/show_bug.cgi?id=1328921

Comment 8 Artyom 2016-05-04 14:45:44 UTC
Checked on rhevm-3.6.6-0.1.el6.noarch
PUT request:
<vm>
  <memory>8589934592</memory>
</vm>

response:
<fault>
<reason>Operation Failed</reason>
<detail>[Cannot edit VM. Illegal number of monitors is provided, max allowed number of monitors is 1 for VNC and the max number in the ValidNumOfMonitors configuration variable for SPICE., Cannot edit VM. Illegal number of monitors is provided, max allowed number of monitors is 1 for VNC and the max number in the ValidNumOfMonitors configuration variable for SPICE.]</detail>
</fault>

Comment 9 Yaniv Kaul 2016-05-04 18:17:07 UTC
Missed 3.6.6, moving to 3.6.7.

Comment 10 Roman Mohr 2016-05-04 20:48:13 UTC
(In reply to Artyom from comment #8)
> Checked on rhevm-3.6.6-0.1.el6.noarch
> PUT request:
> <vm>
>   <memory>8589934592</memory>
> </vm>
> 
> response:
> <fault>
> <reason>Operation Failed</reason>
> <detail>[Cannot edit VM. Illegal number of monitors is provided, max allowed
> number of monitors is 1 for VNC and the max number in the ValidNumOfMonitors
> configuration variable for SPICE., Cannot edit VM. Illegal number of
> monitors is provided, max allowed number of monitors is 1 for VNC and the
> max number in the ValidNumOfMonitors configuration variable for
> SPICE.]</detail>
> </fault>

@artyom What you witnessed is https://bugzilla.redhat.com/show_bug.cgi?id=1328921. Also try editing the HE VM from the GWT frontend and you will see that it does not work either.

It leaves probably most of the hosted engine imports in an inconsistent state (important for the edit VM feature, HE itself will work as expeced). Make sure that you select SPICE as display device when doing the 'hosted-engine --deploy' procedure to work around that issue.

Comment 11 Roman Mohr 2016-05-04 20:51:17 UTC
(In reply to Yaniv Kaul from comment #9)
> Missed 3.6.6, moving to 3.6.7.

I could not come up fast enough with a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1328921 but this one should be fixed in 3.6.6. Another QA run with the additional info provided above should make the tests pass.

Comment 12 Yaniv Kaul 2016-05-05 06:46:26 UTC
Artyom - please follow comment 10 so we'll be able to asses this bug inclusion to 3.6.6

Comment 13 Artyom 2016-05-05 11:43:26 UTC
I rechecked update of HE VM via REST on deploy over spice console, and still have the same error:
[Cannot edit VM. Illegal number of monitors is provided, max allowed number of monitors is 1 for VNC and the max number in the ValidNumOfMonitors configuration variable for SPICE., Cannot edit VM. Illegal number of monitors is provided, max allowed number of monitors is 1 for VNC and the max number in the ValidNumOfMonitors configuration variable for SPICE.]

Update via webadmin works fine.

Comment 14 Yaniv Kaul 2016-05-05 11:45:59 UTC
(In reply to Artyom from comment #13)
> I rechecked update of HE VM via REST on deploy over spice console, and still
> have the same error:
> [Cannot edit VM. Illegal number of monitors is provided, max allowed number
> of monitors is 1 for VNC and the max number in the ValidNumOfMonitors
> configuration variable for SPICE., Cannot edit VM. Illegal number of
> monitors is provided, max allowed number of monitors is 1 for VNC and the
> max number in the ValidNumOfMonitors configuration variable for SPICE.]
> 

Why would we ever want to change the number of monitors for hosted-engine?
I suggest we concentrate on the important stuff. Do they work? (I saw some comment from you on timezone, for example).

> Update via webadmin works fine.

Comment 15 Roy Golan 2016-05-05 11:58:11 UTC
(In reply to Artyom from comment #13)
> I rechecked update of HE VM via REST on deploy over spice console, and still
> have the same error:
> [Cannot edit VM. Illegal number of monitors is provided, max allowed number
> of monitors is 1 for VNC and the max number in the ValidNumOfMonitors
> configuration variable for SPICE., Cannot edit VM. Illegal number of
> monitors is provided, max allowed number of monitors is 1 for VNC and the
> max number in the ValidNumOfMonitors configuration variable for SPICE.]
> 
> Update via webadmin works fine.

Artyom what exactly is the change you're sending, num of monitors ?

Comment 16 Artyom 2016-05-05 12:51:05 UTC
I send update only for memory parameter
<vm>
  <memory>8589934592</memory>
</vm>
I remember we had the same problem via UI, it also tried to update some additional stuff and not only parameters that I changed.

Comment 17 Roy Golan 2016-05-08 07:23:49 UTC
console is VNC? is changing to SPICE and editing works?

Comment 18 Artyom 2016-05-08 08:00:50 UTC
No, console is SPICE from HE deployment.

Comment 19 Roman Mohr 2016-05-10 13:13:13 UTC
I could confirm it now too that it works neither with SPICE nor VNC. I am currently verifying a possible fix.

Comment 20 Yaniv Lavi 2016-05-16 09:01:05 UTC
Should this be modified?

Comment 21 Roy Golan 2016-05-16 12:19:04 UTC
(In reply to Yaniv Dary from comment #20)
> Should this be modified?

57298 is still on review

Comment 22 Yaniv Lavi 2016-05-23 12:57:17 UTC
Required for HE upgrade to 4.0.

Comment 23 Yaniv Kaul 2016-06-01 10:28:54 UTC
Not sure it can be in MODIFIED sate without a build (of 3.6.8).

Comment 24 Roman Mohr 2016-06-01 10:36:35 UTC
(In reply to Yaniv Kaul from comment #23)
> Not sure it can be in MODIFIED sate without a build (of 3.6.8).

I thought it is modified when all patches are merged (they are in 3.6 branch now) but of course QE can just test it after the first build.

Comment 25 Roman Mohr 2016-06-01 14:55:05 UTC
Moving back to post since there will be another 3.6.7 build I can catch.

Comment 26 Artyom 2016-06-16 13:57:53 UTC
Verified on rhevm-3.6.7.4-0.1.el6.noarch

1) Update VM memory - PASS
2) Update VM number of cores - PASS
3) Add VNIC to HE VM - PASS