Bug 1249521

Summary: [REST API] Update vm affinity to 'vm_affinity_migratable' failed since host tag is empty
Product: Red Hat Enterprise Virtualization Manager Reporter: Israel Pinto <ipinto>
Component: ovirt-engineAssignee: Dudi Maroshi <dmaroshi>
Status: CLOSED CURRENTRELEASE QA Contact: Israel Pinto <ipinto>
Severity: high Docs Contact:
Priority: urgent    
Version: 3.6.0CC: bgraveno, dfediuck, gklein, istein, lpeer, lsurette, mgoldboi, rbalakri, rgolan, Rhev-m-bugs, srevivo, ykaul
Target Milestone: ovirt-3.6.0-rcKeywords: AutomationBlocker, Regression
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.6.0-11 Doc Type: Bug Fix
Doc Text:
Updated the REST API code to enable a virtual machine's affinity to be updated from 'migratable' to 'pinned' when supplying an empty <hosts/> and a valid <host> tag.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-20 01:10:12 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:

Description Israel Pinto 2015-08-03 09:02:44 UTC
Description of problem:
In automation testing we update vm affinity to migratable via rest.
It failed to update vm with error:
VmPlacementPolicy [host.id|name] required for validateAndUpdateHostsInPlacementPolicy 

Version-Release number of selected component (if applicable):
3.6.0.4
oVirt Engine Version: 3.6.0-0.0.master.20150726172446.git65db93d.el6 

How reproducible:
All the time

Actual results:
Failed to update host

Expected results:
Update succeed
 
Additional info:
Rest request:
<vm id="c8d1f344-069d-4e14-a515-b88b66195d09">
<placement_policy>
<host/>
<affinity>pinned</affinity>
</placement_policy>
</vm>

also with:
<hosts>
<host/>
</hosts>

Comment 2 Israel Pinto 2015-10-27 15:21:54 UTC
Verify with:
RHEVM 3.6: rhevm-3.6.0-0.18.el6.noarch
VDSM: vdsm-4.17.10-5.el7ev
libvirt: libvirt-1.2.17-5.el7

1. Send request via REST to pin VM host in list :
<vm id="d3f958c9-96de-4665-8d50-bbc855eb184d">
<placement_policy>
<affinity>pinned</affinity>
<hosts>
 <host >
  <name>host_1</name>      
</host>
</hosts>
</placement_policy>
</vm>

The VM affinity update to 'pinned' from 'migratable'.
But the host list did not appear in VM, only in GUI.

2. Send request back to migratable --> PASS
3. Send request to pin VM with empty host list:
<vm id="d3f958c9-96de-4665-8d50-bbc855eb184d">
<placement_policy>
<affinity>pinned</affinity>
</hosts>
</placement_policy>
</vm>

The VM affinity update to 'pinned' from 'migratable'.
But the host list did not appear in VM, only in GUI.

If we send request with element 'host' for backwards compatibility
We failed with error:
"Cannot edit VM. VM is pinned to a specific host. The required host doesn't exist"
There is opened BZ about it:
https://bugzilla.redhat.com/show_bug.cgi?id=1260732

Opening new bug:
Host list don't appear under placement_policy after update VM to pinned
https://bugzilla.redhat.com/show_bug.cgi?id=1275733