Errors to be propagated as ReST http response

Bug #1576820 reported by Soumik Samanta
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Invalid
Undecided
Unassigned

Bug Description

In case of any heat error due to either bad template or error from the nova/neutron, the heat client returns a description indicating the cause of the error.
However, if ReST API is used, only 500 Internal Server Error response is returned and the consumer has no clue of the cause of the error.

Though the error is logged in the heat-api.log, it would be extremely helpful to the API consumers if a proper error message is returned in the HTTP response.

Revision history for this message
Jason Dunsmore (jasondunsmore) wrote :

Hi Soumik,

I went to try to reproduce this by submitting an invalid template, but the API gave a 400 HTTP response:

RESP BODY: {"explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400, "error": {"message": "Property error: : resources.random_key_name.properties.length: : \"str_replace\" params must be strings or numbers", "traceback": null, "type": "StackValidationFailed"}, "title": "Bad Request"}

Can you please provide some steps on how to reproduce?

Jason

Changed in heat:
status: New → Invalid
Changed in heat:
status: Invalid → Won't Fix
status: Won't Fix → Incomplete
Revision history for this message
Soumik Samanta (soumik-samanta) wrote :

Sorry Jason for the late reply.

I have a scenario where I am trying a stack update to create a new OS::Nova::Server resource, but it fails as the nova is not able to allocate resources to create this.

In this case, the heat-api.log shows "“No valid Host was found" But the api-response is HTTP Error code 400 with msg "Bad Request"

Looks like the error coming from other component is not returned in the response.

Revision history for this message
Jason Dunsmore (jasondunsmore) wrote :

Hi Soumik,

I tried reproducing this by creating a stack with a server that has more RAM than is available on my devstack instance. The stack went into CREATE_IN_PROGRESS for a bit and then CREATE_FAILED. The stack_status_reason in the stack-show output contained a fairly useful error message:

Resource CREATE failed: ResourceInError: resources.hello_world: Went to status ERROR due to "Message: No valid host was found. There are not enough hosts available., Code: 500"

Nova would need to be more specific about the problem for that error message to be more helpful.

The same exact thing happened when I tried to create more servers than I had cores available for.
 stack_status_reason was:

Resource CREATE failed: Forbidden: resources.hello_world: Quota exceeded for cores: Requested 8, but already used 17 of 20 cores (HTTP 403)

When I stopped nova-api and tried to create the same stack, I saw a 400 response with:

RESP BODY: {"explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400, "error": {"message": "Unable to establish connection to http://23.253.245.226:8774/v2.1/flavors/m1.xlarge", "traceback": null, "type": "StackValidationFailed"}, "title": "Bad Request"}

All of this looks okay to me. Are you using the latest heat code from the master branch?

Please provide some more details about what you're seeing. What did the response body look like?

Jason

Revision history for this message
Soumik Samanta (soumik-samanta) wrote :

Hi Jason

Thats the exact issue.
The response message "Unable to establish connection to http://23.253.245.226:8774/v2.1/flavors/m1.xlarge" does not provide the info of the exact error. This error "No valid host was found. There are not enough hosts available." if provided in the stack update response will be of more help.

I am using a Kilo stable release.

Thanks
Soumik

Revision history for this message
Jason Dunsmore (jasondunsmore) wrote :

Hi Soumik,

It's not possible for Heat to return that error message, since only Nova has that information (about available hosts). All Heat knows is that it couldn't connect to the Nova flavors endpoint while trying to validate that the value passed to the Nova server flavor property is a valid flavor.

Jason

Revision history for this message
Soumik Samanta (soumik-samanta) wrote :

Hi Jason

Can the error from the heat-api.log be propagated to the ReST call response?
Currently we get HTTP Code: 400 and HTTP Message: Bad Request for url: http://135.121.100.70:8004/v1/4977eb740adf447b9cd7eb82b3eaedc7/stacks
Ideally this should return 202 which means the request is accepted by heat. There may be a possibility that nova might return an error and in that, you can update the status of the stack to "No Valid Host was found".

Thanks
Soumik

Revision history for this message
Jason Dunsmore (jasondunsmore) wrote :

Soumik,

The request wasn't accepted because the stack validation failed, hence the 400 response. In some cases, stack validation will succeed and you'll get a 202 response, but then an error is encountered during the creation. Heat will fail the stack creation and you'll see the error message in the stack status reason.

In this case, I don't think Heat can get a more specific error message from Nova if it can't connect to the Nova endpoint. The behavior seems correct.

Jason

Changed in heat:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.