Bug 1470309

Summary: API request for VM information failing
Product: Red Hat CloudForms Management Engine Reporter: Chris Hale <chhale>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED NOTABUG QA Contact: Dave Johnson <dajohnso>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.8.0CC: chhale, jhardy, jtullo, obarenbo
Target Milestone: GA   
Target Release: cfme-future   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-14 18:39:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chris Hale 2017-07-12 17:28:53 UTC
Description of problem:
When attempting to make a request details on a VM we are receiving the following error. 
Looked at the log, and seeing an API error:

{
    "error": {
        "kind": "internal_server_error",
        "message": "undefined method `keys' for nil:NilClass",
        "klass": "NoMethodError"
    }
}

From this URL:

/api/services/12?expand=vms%2Corchestration_stacks&attributes=name%2Cguid%2Ccreated_at%2Ctype%2Cdescription%2Cpicture%2Cpicture.image_href%2Cevm_owner.name%2Cevm_owner.userid%2Cmiq_group.description%2Call_service_children%2Caggregate_all_vm_cpus%2Caggregate_all_vm_memory%2Caggregate_all_vm_disk_count%2Caggregate_all_vm_disk_space_allocated%2Caggregate_all_vm_disk_space_used%2Caggregate_all_vm_memory_on_disk%2Cretired%2Cretirement_state%2Cretirement_warn%2Cretires_on%2Cactions%2Ccustom_actions%2Cprovision_dialog%2Cservice_resources%2Cchargeback_report%2Cservice_template%2Cparent_service%2Cpower_state%2Cpower_status%2Coptions%2Cvms.ipaddresses%2Cvms.snapshots%2Cvms.v_total_snapshots%2Cvms.v_snapshot_newest_name%2Cvms.v_snapshot_newest_timestamp%2Cvms.v_snapshot_newest_total_size%2Cvms.supports_console%3F%2Cvms.supports_launch_cockpit%3F


Additional info:
We make this request in the SUI on the VM details page.

Comment 2 Chris Hale 2017-07-12 17:31:00 UTC
Actually , we make this request from the Service details page not the VM details page.

Comment 3 Dave Johnson 2017-07-14 03:01:03 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 it to Low/Low.

Comment 4 Jillian Tullo 2017-07-14 18:39:04 UTC
Marking this as notabug.

After discussing with Chris and recreating locally, it is an issue with the same sample database that we are using (this is an issue that has only been seen locally). Some of the orchestration stack resources were removed (most likely for sanitation purposes) but their references remain, which results in orchestration_stacks returning [nil].

In real life this would not happen because the references would be removed (have ensured the relationship is configured properly).