diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2012-06-27 17:20:49 +0000 |
|---|---|---|
| committer | Chris Behrens <cbehrens@codestud.com> | 2012-06-27 19:25:32 +0000 |
| commit | fada5d801c699da16e8e600d474a1da94fb7f4d2 (patch) | |
| tree | d88e9e55fe29a71fc86aed208a5c047b56822c26 /nova/api | |
| parent | b77bfdea3294c765dfda44f461aa42ee7c79a703 (diff) | |
| download | nova-fada5d801c699da16e8e600d474a1da94fb7f4d2.tar.gz nova-fada5d801c699da16e8e600d474a1da94fb7f4d2.tar.xz nova-fada5d801c699da16e8e600d474a1da94fb7f4d2.zip | |
Make nova list/show behave nicely on instance_type deletion
One shouldn't remove an instance_type from the DB outright... but we should
make the code behave nicely in the rare case.
Fixes bug 1018500
Change-Id: If742070d7982889a56709ae058cd106e3a63114b
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/views/servers.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/views/servers.py b/nova/api/openstack/compute/views/servers.py index f14773e98..b0c2fb2b2 100644 --- a/nova/api/openstack/compute/views/servers.py +++ b/nova/api/openstack/compute/views/servers.py @@ -179,7 +179,12 @@ class ViewBuilder(common.ViewBuilder): } def _get_flavor(self, request, instance): - flavor_id = instance["instance_type"]["flavorid"] + instance_type = instance["instance_type"] + if not instance_type: + LOG.warn(_("Instance has had its instance_type removed " + "from the DB"), instance=instance) + return {} + flavor_id = instance_type["flavorid"] flavor_bookmark = self._flavor_builder._get_bookmark_link(request, flavor_id, "flavors") |
