error message of "nova" after trying to create a keypair with the name of an existing keypair should be something useful

Bug #917841 reported by Christian Berendt
This bug report is a duplicate of:  Bug #902162: 500 error with duplicate key pairs. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Low
Unassigned

Bug Description

i think the error message should be "there is already an existing key with the name 'foobar'" or somethink like that.

example:

stack@stack1:~$ nova --username admin --password testing keypair-list
+--------+-------------------------------------------------+
| Name | Fingerprint |
+--------+-------------------------------------------------+
| foobar | f8:3e:13:94:f7:e0:f0:7b:6e:2d:45:18:ce:56:be:fa |
+--------+-------------------------------------------------+

stack@stack1:~$ nova keypair-add foobar
The server has either erred or is incapable of performing the requested operation. (HTTP 500)

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Christian Berendt (berendt) wrote :

exception on nova-api is correct:

(nova.api.openstack): TRACE: raise exception.KeyPairExists(key_name=name)
(nova.api.openstack): TRACE: KeyPairExists: Key pair foobar already exists.

nova receives a unspecific error:

RESP:{'date': 'Thu, 26 Jan 2012 22:25:46 GMT', 'status': '500', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8'} {"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

"computeFault" is defined in nova/api/openstack/wsgi.py in class Fault, a wrapper for webob.exc.HTTPException.

The wrapper receives as exception a WebOb.webob.exc.HTTPServerError object and not the KeyPairExists exception.

This is because the class FaultWrapper in nova/api/openstack/__init__.py simply catchs all exceptions and afterward it returns a webob.exc.HTTPInternalServerError() exception for every case.

I would prefer setting the explanation for the HTTPException more specific --> exc.explanation = unicode(ex)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/3487

Changed in nova:
assignee: nobody → Christian Berendt (berendt)
status: Confirmed → In Progress
Revision history for this message
Christian Berendt (berendt) wrote :

proposed change in the fault wrapper of wsgi was rejected. someone else has to take a look.

Changed in nova:
status: In Progress → Invalid
status: Invalid → New
status: New → Confirmed
assignee: Christian Berendt (berendt) → nobody
Brian Waldon (bcwaldon)
Changed in nova:
assignee: nobody → Brian Waldon (bcwaldon)
Brian Waldon (bcwaldon)
Changed in nova:
status: Confirmed → In Progress
Brian Waldon (bcwaldon)
Changed in nova:
status: In Progress → Confirmed
assignee: Brian Waldon (bcwaldon) → nobody
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.