diff options
| author | Brian Waldon <bcwaldon@gmail.com> | 2012-03-01 14:51:03 -0800 |
|---|---|---|
| committer | Brian Waldon <bcwaldon@gmail.com> | 2012-03-01 15:17:17 -0800 |
| commit | ff716dee035dd51257b240fad842ecfd70d9d90d (patch) | |
| tree | a1594f6274e7d8b0c32cf133ed1268d5c42f0145 /nova | |
| parent | d65a4e4023e9994c8a14a1da4aa4eeb4f6452640 (diff) | |
Ensure image status filter matches glance format
* Fixes bug 943259
Change-Id: Id5172aa40be2f5a337b3e192b4bee8139c16c4d3
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/openstack/compute/images.py | 5 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/test_images.py | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py index 1a957bc56..8cf6ea4ad 100644 --- a/nova/api/openstack/compute/images.py +++ b/nova/api/openstack/compute/images.py @@ -124,6 +124,11 @@ class Controller(wsgi.Controller): except (AttributeError, IndexError, KeyError): pass + filter_name = 'status' + if filter_name in filters: + # The Image API expects us to use lowercase strings for status + filters[filter_name] = filters[filter_name].lower() + return filters @wsgi.serializers(xml=ImageTemplate) diff --git a/nova/tests/api/openstack/compute/test_images.py b/nova/tests/api/openstack/compute/test_images.py index 660345031..88eeaefc5 100644 --- a/nova/tests/api/openstack/compute/test_images.py +++ b/nova/tests/api/openstack/compute/test_images.py @@ -857,7 +857,7 @@ class ImagesControllerTest(test.TestCase): def test_image_filter_with_status(self): image_service = self.mox.CreateMockAnything() - filters = {'status': 'ACTIVE'} + filters = {'status': 'active'} request = fakes.HTTPRequest.blank('/v2/images?status=ACTIVE') context = request.environ['nova.context'] image_service.index(context, filters=filters).AndReturn([]) @@ -915,7 +915,7 @@ class ImagesControllerTest(test.TestCase): def test_image_filter_not_supported(self): image_service = self.mox.CreateMockAnything() - filters = {'status': 'ACTIVE'} + filters = {'status': 'active'} request = fakes.HTTPRequest.blank('/v2/images?status=ACTIVE&' 'UNSUPPORTEDFILTER=testname') context = request.environ['nova.context'] @@ -950,7 +950,7 @@ class ImagesControllerTest(test.TestCase): def test_image_detail_filter_with_status(self): image_service = self.mox.CreateMockAnything() - filters = {'status': 'ACTIVE'} + filters = {'status': 'active'} request = fakes.HTTPRequest.blank('/v2/fake/images/detail' '?status=ACTIVE') context = request.environ['nova.context'] @@ -1024,7 +1024,7 @@ class ImagesControllerTest(test.TestCase): def test_image_detail_filter_not_supported(self): image_service = self.mox.CreateMockAnything() - filters = {'status': 'ACTIVE'} + filters = {'status': 'active'} request = fakes.HTTPRequest.blank('/v2/fake/images/detail?status=' 'ACTIVE&UNSUPPORTEDFILTER=testname') context = request.environ['nova.context'] |
