Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1245066

Summary: Impossible to add affinity group via REST
Product: Red Hat Enterprise Virtualization Manager Reporter: Artyom <alukiano>
Component: ovirt-engineAssignee: Tomer Saban <tsaban>
Status: CLOSED CURRENTRELEASE QA Contact: Artyom <alukiano>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.6.0CC: aburden, dfediuck, gklein, lpeer, lsurette, mavital, mgoldboi, rbalakri, rgolan, Rhev-m-bugs, srevivo, tsaban, ykaul
Target Milestone: ovirt-3.6.0-rcKeywords: AutomationBlocker, Triaged
Target Release: 3.6.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-20 01:32:15 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:
Bug Depends On:    
Bug Blocks: 1206229, 1206230    
Attachments:
Description Flags
engine log none

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