diff options
| author | Brian Lamar <brian.lamar@rackspace.com> | 2011-07-29 19:24:00 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-07-29 19:24:00 +0000 |
| commit | c4d7127367ff4b34f11355e04e1f26fd414f459c (patch) | |
| tree | 5cf588d6213ed02c1e638b6b58c8b3a08f54da61 /nova/compute | |
| parent | ab0c38efa5440347c3c75171e703e010023affe2 (diff) | |
| parent | 50abd79432ff82a23da1934cc4d297c0c5051668 (diff) | |
Fixes issue with OSAPI passing compute API a flavorid instead of an instance identifier. Added tests.
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/instance_types.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index c13a629a9..824416514 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -132,11 +132,8 @@ def get_instance_type_by_name(name): # flavors. def get_instance_type_by_flavor_id(flavor_id): """Retrieve instance type by flavor_id.""" - if flavor_id is None: - return get_default_instance_type() + ctxt = context.get_admin_context() try: - ctxt = context.get_admin_context() return db.instance_type_get_by_flavor_id(ctxt, flavor_id) - except exception.DBError, e: - LOG.exception(_('DB error: %s') % e) - raise exception.ApiError(_("Unknown flavor: %s") % flavor_id) + except ValueError: + raise exception.FlavorNotFound(flavor_id=flavor_id) |
