diff options
| author | Devananda van der Veen <devananda.vdv@gmail.com> | 2013-02-21 13:56:25 -0800 |
|---|---|---|
| committer | Devananda van der Veen <devananda.vdv@gmail.com> | 2013-02-22 07:20:38 -0800 |
| commit | 3aace2a610d8b5e7027ef141970e23cddba0294d (patch) | |
| tree | 461f32463e3a5836938bcc331debc1c700ddcdf0 /nova/api | |
| parent | fc4ede9bb69896992e5fafc2623f1083cc8d19cd (diff) | |
Fix exception handling in baremetal API.
In patch ab9f8667c63d901f37d1662c5204fb2938be44fe, several
baremetal/db/api methods' exceptions were changed from InstanceNotFound
to NodeNotFound. The API extension for baremetal was not updated to
catch these, and this was not caught by unit testing. This resulted in
unhandled exceptions within nova-api if any baremetal node lacked an
associated interface.
While fixing that bug, a few other unit tests for the baremetal API
were added, and a missing exception was added to db/api bm_node_destroy.
Fixes bug 1131430.
Change-Id: I15f7624723754f9d7b217b609663a2d709acb056
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/baremetal_nodes.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/contrib/baremetal_nodes.py b/nova/api/openstack/compute/contrib/baremetal_nodes.py index 38d66d2ae..70bb6e8a0 100644 --- a/nova/api/openstack/compute/contrib/baremetal_nodes.py +++ b/nova/api/openstack/compute/contrib/baremetal_nodes.py @@ -104,7 +104,7 @@ class BareMetalNodeController(wsgi.Controller): try: ifs = db.bm_interface_get_all_by_bm_node_id( context, node_from_db['id']) - except exception.InstanceNotFound: + except exception.NodeNotFound: ifs = [] node = _node_dict(node_from_db) node['interfaces'] = [_interface_dict(i) for i in ifs] @@ -117,11 +117,11 @@ class BareMetalNodeController(wsgi.Controller): authorize(context) try: node = db.bm_node_get(context, id) - except exception.InstanceNotFound: + except exception.NodeNotFound: raise webob.exc.HTTPNotFound try: ifs = db.bm_interface_get_all_by_bm_node_id(context, id) - except exception.InstanceNotFound: + except exception.NodeNotFound: ifs = [] node = _node_dict(node) node['interfaces'] = [_interface_dict(i) for i in ifs] @@ -141,14 +141,14 @@ class BareMetalNodeController(wsgi.Controller): authorize(context) try: db.bm_node_destroy(context, id) - except exception.InstanceNotFound: + except exception.NodeNotFound: raise webob.exc.HTTPNotFound return webob.Response(status_int=202) def _check_node_exists(self, context, node_id): try: db.bm_node_get(context, node_id) - except exception.InstanceNotFound: + except exception.NodeNotFound: raise webob.exc.HTTPNotFound @wsgi.serializers(xml=InterfaceTemplate) |
