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

Bug 2067104

Summary: NullPointerException while attempt to add a host using wrong affinity group ID
Product: [oVirt] ovirt-engine Reporter: Polina <pagranat>
Component: BLL.VirtAssignee: Shmuel Melamud <smelamud>
Status: CLOSED CURRENTRELEASE QA Contact: Polina <pagranat>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.5.0CC: ahadas, bugs, mzamazal
Target Milestone: ovirt-4.5.2Keywords: ZStream
Target Release: 4.5.2Flags: sbonazzo: ovirt-4.5+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-engine-4.5.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-30 08:47:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine log none

Description Polina 2022-03-23 10:23:41 UTC
Created attachment 1867750 [details]
engine log

Description of problem:
Adding host by REST API to the affinity group with wrong ID fails with NullPointerException trace instead of normal error (400 or 404) saying about wrong affinity group id

Version-Release number of selected component (if applicable):
ovirt-engine-4.5.0.1-601.f26e9ea8cac5.3.el8ev.noarch

How reproducible:100%


Steps to Reproduce:
POST https://{{host}}/ovirt-engine/api/clusters/{clusterId}/affinitygroups/{affinitygroupID_WRONG}/hosts
body:
<host><name>host_mixed_2</name></host>

Actual results: 500 Internal error with NullPointerException trace in log
Error during ValidateFailure.: java.lang.NullPointerException
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.scheduling.commands.AffinityGroupCRUDCommand.getClusterId(AffinityGroupCRUDCommand.java:205)
......


Expected results: either 404 (entity not found) or 400 (bad request )


Additional info:

Comment 1 Polina 2022-08-02 11:06:52 UTC
verified on ovirt-engine-4.5.2-0.3.el8ev.noarch
now we get 404 response on such request and no NullPointerException.

Comment 2 Sandro Bonazzola 2022-08-30 08:47:42 UTC
This bugzilla is included in oVirt 4.5.2 release, published on August 10th 2022.
Since the problem described in this bug report should be resolved in oVirt 4.5.2 release, it has been closed with a resolution of CURRENT RELEASE.
If the solution does not work for you, please open a new bug report.