Bug 1596069

Summary: Internal Server Error during filtering by flavor name in API
Product: Red Hat CloudForms Management Engine Reporter: Imaan <ikaur>
Component: APIAssignee: Julian Cheal <jcheal>
Status: CLOSED CURRENTRELEASE QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact:
Priority: high    
Version: 5.8.0CC: bsorota, cpelland, dmetzger, ikaur, mkourim, obarenbo, simaishi, smallamp
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1607441 1607442 (view as bug list) Environment:
Last Closed: 2019-02-11 14:05:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1572700, 1607441, 1607442    

Description Imaan 2018-06-28 08:10:06 UTC
Description of problem:

Internal Server Error during filtering by flavor name in API.

Version-Release number of selected component (if applicable):

Red Hat CloudForms 4.6

How reproducible:100%

API Query: 

https://Cloudforms.example.com/api/vms?filter[]=flavor.name="m1.tiny"

API Response: 

{
    "error": {
        "kind": "internal_server_error",
        "message": "undefined method `klass' for nil:NilClass\nDid you mean?  class",
        "klass": "NoMethodError"
    }
}

Expected results: It should return 200 status code with flavor information.

Comment 4 Dave Johnson 2018-06-28 08:43:12 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set the severity to Low.

Comment 5 Julian Cheal 2018-07-11 12:18:12 UTC
WIP PR https://github.com/ManageIQ/manageiq/pull/17692

Not sure if this is correct, but it stops throwing the error.

Comment 6 Julian Cheal 2018-07-18 19:36:24 UTC
Fixed in PR https://github.com/ManageIQ/manageiq/pull/17692 Vm needed to belong to Flavor in the models.

Comment 9 Parthvi Vala 2018-11-12 14:28:33 UTC
FIXED. Verified on 5.10.0.23.20181106165157_92dd189.

Request: GET /api/vms?filter[]=flavor.name="<flavor_name>"
Response: {
    "name": "vms",
    "count": 14,
    "subcount": 1,
    "subquery_count": 1,
    "pages": 1,
    "resources": [
        {
            "href": "https://<ip_address>/api/vms/99"
        }
    ],
    "actions": [
        ...
    ],
    "links": {
        "self": "https://<ip_address>/api/vms?filter%5B%5D=flavor.name%3D%22Standard_A2%22&offset=0",
        "first": "https://<ip_address>/api/vms?filter%5B%5D=flavor.name%3D%22Standard_A2%22&offset=0",
        "last": "https://<ip_address>/api/vms?filter%5B%5D=flavor.name%3D%22Standard_A2%22&offset=0"
    }
}