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:
that version is lacking further fixups we added. this should be fixed in the current version. Tomer pls verify
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.
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