Server create error messages/fault codes

Bug #803615 reported by Brian Lamar
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Brian Lamar

Bug Description

When using a bad imageRef in POST /v1.1/servers the desired response is:

{
    "computeFault": {
        "message": "Invalid imageRef provided.",
        "code": 400,
    },
}

but I'm getting:

{
    "cloudServersFault": {
        "message": "Invalid image href -1.",
        "code": 500,
    },
}

Also,

When using a bad flavorRef in POST /v1.1/servers the desired response is:

{
    "computeFault": {
        "message": "Invalid flavorRef provided.",
        "code": 400,
    },
}

These error messages should be rectified.

Related branches

Revision history for this message
Alex Meade (alex-meade) wrote :

Hey, I couldn't get this behavior repeated. Only for a bad flavor.

In api/openstack/create_instance_helper:

143 except exception.ImageNotFound as error:
144 msg = _("Can not find requested image")
145 raise faults.Fault(exc.HTTPBadRequest(explanation=msg))
+146 except exception.FlavorNotFound as error:
+147 msg = _("Invalid flavorRef provided.")
+148 raise faults.Fault(exc.HTTPBadRequest(explanation=msg))

Seems to fix the problem

Revision history for this message
Brian Lamar (blamar) wrote :

Yeah, I'm not certain what's going on, marking this as incomplete until I figure it out.

Changed in nova:
status: New → Incomplete
Revision history for this message
William Wolf (throughnothing) wrote :

I currently get this when making the following post body:

        'server' : {
            'name' : 'test',
            'imageRef' : '-1',
            'flavorRef' : '1'
        }

I get the following error:

{"badRequest": {"message": "Cannot find requested image -1: Image -1 could not be found.", "code": 400}}

The response code matches the spec, though the message is a little different.

Revision history for this message
William Wolf (throughnothing) wrote :

I attached a branch that has the fix Alex recommended, it seems to flix the issue with an invalid FlavorRef returning a 500.

Brian Lamar (blamar)
Changed in nova:
status: Incomplete → In Progress
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → diablo-3
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-3 → 2011.3
status: Fix Committed → Fix Released
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.