Bug 1245066 - Impossible to add affinity group via REST
Summary: Impossible to add affinity group via REST
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.6.0
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Tomer Saban
QA Contact: Artyom
URL:
Whiteboard:
Depends On:
Blocks: 1206229 1206230
TreeView+ depends on / blocked
 
Reported: 2015-07-21 07:15 UTC by Artyom
Modified: 2016-04-20 01:32 UTC (History)
13 users (show)

Fixed In Version: 3.6.0-5
Doc Type: Bug Fix
Doc Text:
Previously, adding an affinity group using the REST API would fail because the affinity group be created empty before running the 'Affinity Rules Enforcement Manager'. Now, the 'Affinity Rules Enforcement Manager' also handles the creation of the affinity group using the REST API, and the group is created as expected.
Clone Of:
Environment:
Last Closed: 2016-04-20 01:32:15 UTC
oVirt Team: SLA
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine log (60.15 KB, text/plain)
2015-07-21 07:15 UTC, Artyom
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 44001 0 master MERGED core: Added null check to AREM Never

Description Artyom 2015-07-21 07:15:14 UTC
Created attachment 1054211 [details]
engine log

Description of problem:
Impossible to add affinity group via REST

Version-Release number of selected component (if applicable):
ovirt-engine-3.6.0-0.0.master.20150627185750.git6f063c1.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. Try to create affinity group via REST:
<affinity_group>
<name>test_1</name>
<positive>true</positive>
<enforcing>true</enforcing>
</affinity_group>
2.
3.

Actual results:


    Status Code: 500 Internal Server Error
    Connection: close
    Content-Encoding: gzip
    Content-Length: 151
    Content-Type: application/xml
    Date: Tue, 21 Jul 2015 07:00:55 GMT



Expected results:
Action success

Additional info:

Comment 1 Roy Golan 2015-07-26 14:01:53 UTC
that version is lacking further fixups we added. this should be fixed in the current version. Tomer pls verify

Comment 2 Tomer Saban 2015-07-26 15:11:41 UTC
The cause of the is that when adding affinity group using the rest api, The affinity group is first added empty and then, the VMs are added to the affinity group.

Each time there was a foreach loop on the affinity group entity ids an NPE was thrown.

I fixed the bug by avoiding getting to the foreach loop each time the affinity group was empty from VMs and I also added a test to our AddAffinityGroupCommandTest to make sure it checks this scenario of affinity group with no VMs.

Comment 3 Artyom 2015-08-09 08:30:06 UTC
Verified on ovirt-engine-3.6.0-0.0.master.20150804111407.git122a3a0.el6.noarch

REST code works fine:
<affinity_group>
<name>test_2</name>
<positive>true</positive>
<enforcing>true</enforcing>
</affinity_group>

Status
201 Created


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