diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-09-12 23:20:38 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-09-12 23:20:38 +0000 |
| commit | e13b19ab3e7857fdd4c5a185df81879f97b7dd4d (patch) | |
| tree | 700ff84381f24e49e3f83ebdd9bf385f3866b443 | |
| parent | 3390c70d2f4481527aaf2fbc3847664b3f45de0e (diff) | |
| parent | d741328543ad6059bef56adb59f4c94781eaedcd (diff) | |
Merge "Fix flavor deletion when there is a deleted flavor"
| -rw-r--r-- | nova/api/openstack/compute/contrib/flavormanage.py | 3 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_flavor_manage.py | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/nova/api/openstack/compute/contrib/flavormanage.py b/nova/api/openstack/compute/contrib/flavormanage.py index a7e313c9c..69d5d6ed9 100644 --- a/nova/api/openstack/compute/contrib/flavormanage.py +++ b/nova/api/openstack/compute/contrib/flavormanage.py @@ -42,7 +42,8 @@ class FlavorManageController(wsgi.Controller): authorize(context) try: - flavor = instance_types.get_instance_type_by_flavor_id(id) + flavor = instance_types.get_instance_type_by_flavor_id( + id, read_deleted="no") except exception.NotFound, e: raise webob.exc.HTTPNotFound(explanation=str(e)) diff --git a/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py b/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py index feae4c47f..70fd5e4a7 100644 --- a/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py +++ b/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py @@ -25,11 +25,13 @@ from nova import test from nova.tests.api.openstack import fakes -def fake_get_instance_type_by_flavor_id(flavorid): +def fake_get_instance_type_by_flavor_id(flavorid, read_deleted='yes'): if flavorid == 'failtest': raise exception.NotFound("Not found sucka!") elif not str(flavorid) == '1234': raise Exception("This test expects flavorid 1234, not %s" % flavorid) + if read_deleted != 'no': + raise test.TestingException("Should not be reading deleted") return { 'root_gb': 1, @@ -60,7 +62,8 @@ def fake_create(name, memory_mb, vcpus, root_gb, ephemeral_gb, flavorid, swap, rxtx_factor, is_public): if flavorid is None: flavorid = 1234 - newflavor = fake_get_instance_type_by_flavor_id(flavorid) + newflavor = fake_get_instance_type_by_flavor_id(flavorid, + read_deleted="no") newflavor["name"] = name newflavor["memory_mb"] = int(memory_mb) |
