Bug 1464819 - [API] Setting Custom Compatibility Version for a VM via REST api to a none/empty value is not working
Summary: [API] Setting Custom Compatibility Version for a VM via REST api to a none/em...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 4.1.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ovirt-4.1.5
: ---
Assignee: Sharon Gratch
QA Contact: Israel Pinto
URL:
Whiteboard:
: 1412725 (view as bug list)
Depends On: 1412725
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-26 00:55 UTC by Germano Veit Michel
Modified: 2020-09-10 10:46 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, setting the Custom Compatibility Version of a virtual machine to null with a REST API produced the following error: 2017-06-26 11:02:05,100+10 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-21) [] Operation Failed: [Cannot edit VM. Custom Compatibility Version is not supported: .] This update allows you to set the Custom Compatibility Version of a virtual machine to null with the following REST API request: POST /ovirt-engine/api/vms/<vm-id> ... <vm> <custom_compatibility_version/> </vm>
Clone Of: 1412725
Environment:
Last Closed: 2017-08-22 17:42:35 UTC
oVirt Team: Virt
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1506449 0 medium CLOSED [API] Cannot clear vm initialization via api 2021-03-11 21:00:26 UTC
Red Hat Product Errata RHEA-2017:2509 0 normal SHIPPED_LIVE Red Hat Virtualization Manager (ovirt-engine) 4.1.5 2017-08-22 21:38:47 UTC
oVirt gerrit 79223 0 master MERGED restapi: support setting empty CCV value for a VM via REST api 2020-12-15 01:54:01 UTC
oVirt gerrit 79603 0 ovirt-engine-4.1 MERGED restapi: support setting empty CCV value for a VM via REST api 2020-12-15 01:54:01 UTC

Internal Links: 1506449

Description Germano Veit Michel 2017-06-26 00:55:36 UTC
+++ This bug was initially created as a clone of Bug #1412725 +++

Description of problem:
Trying to set the Custom Compatibility Version of a VM to an empty value via REST api (in order to take the Custom Compatibility Version value of the Cluster) is not supported, 

This should be done by running the following:
POST /ovirt-engine/api/vms/<vmid>
<vm>
    <custom_compatibility_version/>
</vm>

but it fails with an error: 
<detail>
For correct usage, see: http://butterfly.usersys.redhat.com:8080/ovirt-engine/api/v4/model#services/vm-graphics-consoles/methods/add
</detail>
<reason>Request syntactically incorrect.</reason>

Version-Release number of selected component (if applicable):
4.1 master

How reproducible:
100%

Steps to Reproduce:
1.Try to create a vm or edit a vm and set custom_compatibility_version attribute to an empty value:
<vm>
    <custom_comaptibility_version/>
</vm>

Actual results:
It failed with error:
<detail>
For correct usage, see: http://butterfly.usersys.redhat.com:8080/ovirt-engine/api/v4/model#services/vm-graphics-consoles/methods/add
</detail>
<reason>Request syntactically incorrect.</reason>

Expected results:
It should succeeded.

Comment 1 Germano Veit Michel 2017-06-26 01:16:27 UTC
In rhevm-4.1.2.2-0.1.el7.noarch:

vm_service.update(
    vm=types.Vm(
        custom_compatibility_version=types.Version()
    )
)

Results in:

DEBUG:root:PUT /ovirt-engine/api/vms/f03206ec-475b-4a66-9309-d85e454aa8d5 HTTP/1.1
DEBUG:root:Content-Length: 45
DEBUG:root:<vm>
DEBUG:root:  <custom_compatibility_version/>
DEBUG:root:</vm>
DEBUG:root:upload completely sent off: 45 out of 45 bytes
DEBUG:root:HTTP/1.1 400 Bad Request

2017-06-26 11:02:05,100+10 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-21) [] Operation Failed: [Cannot edit VM. Custom Compatibility Version is not supported: .]

And "custom_compatibility_version=None" results in:

DEBUG:root:<vm/>
DEBUG:root:upload completely sent off: 6 out of 6 bytes
DEBUG:root:HTTP/1.1 200 OK

Which obviously is accepted but doesn't work.

Also see:
BZ #1367411
https://gerrit.ovirt.org/#/c/69984/

Comment 3 Sharon Gratch 2017-07-31 09:48:36 UTC
*** Bug 1412725 has been marked as a duplicate of this bug. ***

Comment 5 Israel Pinto 2017-08-08 07:53:53 UTC
Verify with:
engine: 4.1.5.1-0.1.el7 

Steps:
1. Create VM
2. Set custom_compatibility_version from UI to 4.1
3. Update custom_compatibility_version to empty value from REST 
With:
<vm>
    <custom_compatibility_version/>
</vm>

Results: PASS
custom_compatibility_version updated to empty value.

Comment 7 errata-xmlrpc 2017-08-22 17:42:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHEA-2017:2509


Note You need to log in before you can comment on or make changes to this bug.