Bug 1275733 - [REST API] Host list don't appear under placement_policy after update VM to pinned
[REST API] Host list don't appear under placement_policy after update VM to p...
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
3.6.0
Unspecified Unspecified
unspecified Severity medium (vote)
: ovirt-3.6.1
: 3.6.1
Assigned To: Andrej Krejcir
Petr Matyáš
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-27 11:20 EDT by Israel Pinto
Modified: 2016-02-18 06:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-18 06:11:45 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: SLA
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
dfediuck: ovirt‑3.6.z?
rule-engine: planning_ack?
rule-engine: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)
engine_log (222.74 KB, application/zip)
2015-10-27 11:21 EDT, Israel Pinto
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 47792 master MERGED restapi: Populate "placement_policy.hosts" even with only one host Never
oVirt gerrit 47793 ovirt-engine-3.6 MERGED restapi: Populate "placement_policy.hosts" even with only one host Never

  None (edit)
Description Israel Pinto 2015-10-27 11:20:33 EDT
Description of problem:
Host list don't appear under placement_policy after update VM to pinned

Version-Release number of selected component (if applicable):
rhevm-3.6.0-0.18.el6.noarch
VDSM: vdsm-4.17.10-5.el7ev
libvirt: libvirt-1.2.17-5.el7

How reproducible:
All the time

Steps to Reproduce:
Send request to pin VM with host in hosts 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.
Comment 1 Israel Pinto 2015-10-27 11:21 EDT
Created attachment 1086880 [details]
engine_log
Comment 2 Juan Hernández 2015-10-27 12:39:57 EDT
Currently if a VM is pinned to just one host then the RESTAPI will use the single "host" element:

  GET /vms/{vm:id}
  <vm>
    <placement_policy>
      <host id="..." href="..."/>
      <affinity>pinned</affinity>
    </plaement_policy>
  </vm>

Only if it is pinned to more than hone host the multiple "hosts" element will be used:

  GET /vms/{vm:id}
  <vm>
    <placement_policy>
      <hosts>
        <host id="..." href="..."/>
        <host id="..." href="..."/>
      </hosts>
      <affinity>pinned</affinity>
    </plaement_policy>
  </vm>

Is that what you are getting?

I think that it it is better to always populate the multiple "hosts" element, even if it only has one element.
Comment 3 Israel Pinto 2015-10-27 14:35:57 EDT
(In reply to Juan Hernández from comment #2)
> Currently if a VM is pinned to just one host then the RESTAPI will use the
> single "host" element:
> 
>   GET /vms/{vm:id}
>   <vm>
>     <placement_policy>
>       <host id="..." href="..."/>
>       <affinity>pinned</affinity>
>     </plaement_policy>
>   </vm>
> 
> Only if it is pinned to more than hone host the multiple "hosts" element
> will be used:
> 
>   GET /vms/{vm:id}
>   <vm>
>     <placement_policy>
>       <hosts>
>         <host id="..." href="..."/>
>         <host id="..." href="..."/>
>       </hosts>
>       <affinity>pinned</affinity>
>     </plaement_policy>
>   </vm>
> 
> Is that what you are getting?
> 
> I think that it it is better to always populate the multiple "hosts"
> element, even if it only has one element.

I did see host/hosts elemtemt at all.
Comment 4 Red Hat Bugzilla Rules Engine 2015-10-28 05:25:47 EDT
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.
Comment 5 Juan Hernández 2015-10-28 12:51:45 EDT
I can't reproduce that. Please check with the following script and report the results:

---8<---
#!/bin/sh -ex

url="https://engine.example.com/ovirt-engine/api"
user="admin@internal"
password="******"

curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--request PUT \
--user "${user}:${password}" \
--header "Accept: application/xml" \
--header "Content-Type: application/xml" \
--data '
<vm>
  <placement_policy>
    <affinity>pinned</affinity>
    <hosts>
      <host>
       <name>host_1</name>      
      </host>
    </hosts>
  </placement_policy>
</vm>
' \
"${url}/vms/{vm:id}"
--->8---
Comment 6 Roy Golan 2015-10-29 03:10:55 EDT
(In reply to Juan Hernández from comment #5)
> I can't reproduce that. Please check with the following script and report
> the results:

> <vm>
>   <placement_policy>
>     <affinity>pinned</affinity>
>     <hosts>
>       <host>
>        <name>host_1</name>      
>       </host>
>     </hosts>
>   </placement_policy>
> </vm>
> ' \
> "${url}/vms/{vm:id}"
> --->8---



what version your using?
Comment 7 Juan Hernández 2015-10-29 04:44:34 EDT
I tested this with the latest 3.6 build:

  # rpm -q rhevm
  rhevm-3.6.0.2-0.1.el6.noarch
Comment 8 Petr Matyáš 2016-01-21 06:07:59 EST
Verified on 3.6.2-10

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