diff options
| author | Phlip Knouff <philip.knouff@mailtrust.com> | 2012-03-26 22:16:27 +0000 |
|---|---|---|
| committer | Phlip Knouff <philip.knouff@mailtrust.com> | 2012-03-28 15:52:28 +0000 |
| commit | 497502cbf833d063c964975448dfacd0e1db2ef4 (patch) | |
| tree | fc15dfb9d608d308ff7600b9e26aed53d87955a7 /nova/api | |
| parent | 930be36538e42effc0a3b03c9a3d8a06cb1693ed (diff) | |
| download | nova-497502cbf833d063c964975448dfacd0e1db2ef4.tar.gz nova-497502cbf833d063c964975448dfacd0e1db2ef4.tar.xz nova-497502cbf833d063c964975448dfacd0e1db2ef4.zip | |
Fix marker behavior for flavors
Fixes Bug #956096
Change-Id: Ifa94a70f2aec3b9527c291e27d4710336a1d1834
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/common.py | 6 | ||||
| -rw-r--r-- | nova/api/openstack/compute/flavors.py | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index 040e8be00..0d419f205 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -192,7 +192,11 @@ def limited_by_marker(items, request, max_limit=FLAGS.osapi_max_limit): if marker: start_index = -1 for i, item in enumerate(items): - if item['id'] == marker or item.get('uuid') == marker: + if 'flavorid' in item: + if item['flavorid'] == marker: + start_index = i + 1 + break + elif item['id'] == marker or item.get('uuid') == marker: start_index = i + 1 break if start_index < 0: diff --git a/nova/api/openstack/compute/flavors.py b/nova/api/openstack/compute/flavors.py index 99f6f44d8..8c159c586 100644 --- a/nova/api/openstack/compute/flavors.py +++ b/nova/api/openstack/compute/flavors.py @@ -73,15 +73,13 @@ class Controller(wsgi.Controller): def index(self, req): """Return all flavors in brief.""" flavors = self._get_flavors(req) - limited_flavors = common.limited_by_marker(flavors.values(), req) - return self._view_builder.index(req, limited_flavors) + return self._view_builder.index(req, flavors) @wsgi.serializers(xml=FlavorsTemplate) def detail(self, req): """Return all flavors in detail.""" flavors = self._get_flavors(req) - limited_flavors = common.limited_by_marker(flavors.values(), req) - return self._view_builder.detail(req, limited_flavors) + return self._view_builder.detail(req, flavors) @wsgi.serializers(xml=FlavorTemplate) def show(self, req, id): @@ -108,7 +106,12 @@ class Controller(wsgi.Controller): except ValueError: pass # ignore bogus values per spec - return instance_types.get_all_types(filters=filters) + flavors = instance_types.get_all_types(filters=filters) + flavors_list = flavors.values() + sorted_flavors = sorted(flavors_list, + key=lambda item: item['flavorid']) + limited_flavors = common.limited_by_marker(sorted_flavors, req) + return limited_flavors def create_resource(): |
