Bug 1328737

Summary: Editing a sub attribute of vm/template initialization attr via API overrides all other sub_attributes
Product: [oVirt] ovirt-engine Reporter: sefi litmanovich <slitmano>
Component: RestAPIAssignee: Tomas Jelinek <tjelinek>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: medium Docs Contact:
Priority: high    
Version: 4.0.0CC: bugs, mgoldboi, sbonazzo, tjelinek
Target Milestone: ovirt-4.0.0-betaFlags: rule-engine: ovirt-4.0.0+
rule-engine: planning_ack+
tjelinek: devel_ack+
rule-engine: testing_ack+
Target Release: 4.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: When editing any attribute of <initialization> using REST API, all attributes have been overridden. Consequence: User of the REST API always had to fill all the attributes of the <initialization> even only not all needed actual update. Fix: Made sure only the actually specified attributes are going to be applied. Result: Now only the attributes which need to be updated have to be specified.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-05 07:57:05 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:

Description sefi litmanovich 2016-04-20 08:08:10 UTC
Description of problem:

Editing some sub attribute of vm's or template's initialization attribute via API will override all other sub_attributes e.g.

say you have a template with:

<initialization>
<host_name>foo.bar.com</host_name>
<dns_servers>1.2.3.4</dns_servers
</initialization>

and now you want to change the dns_servers value:

PUT https://{engine_url}/ovirt-engine/api/templates/{template_id}

<template>
<initialization>
<dns_servers>5.6.7.8</dns_servers
</initialization>
</template>

Actual result:
Result is that host_name is overridden and is now blank, only dns_servers will be updated.
This happens with both vm/template entities.

Expected result:
Only the sub attribute given in the PUT call is changed while all other initialization sub attributes' values persist.

Version-Release number of selected component (if applicable):
ovirt-engine-4.0.0-0.0.master.20160405102116.git3819ab7.el7.centos.noarch

How reproducible:
always

No log is helpful in this case and bug is easy to re produce.

Comment 1 sefi litmanovich 2016-07-04 11:55:14 UTC
Verified with rhevm-4.0.2-0.2.rc1.el7ev.noarch according to description, check both vm and template editing - worked as expected.

Comment 2 Sandro Bonazzola 2016-07-05 07:57:05 UTC
oVirt 4.0.0 has been released, closing current release.