diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-08-31 17:05:01 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-08-31 17:05:01 -0400 |
| commit | a87a0bba9c7b046b36ee80bc033df5499cca35e1 (patch) | |
| tree | 3686307b3c0ffbea4d7ea1ebffd33add312c3bf3 /nova/image | |
| parent | 6d206c85968ade7413191b2deeb4be0e2ae1a9b7 (diff) | |
adding support for limiting in image service; updating tests with fixture ids and marker support
Diffstat (limited to 'nova/image')
| -rw-r--r-- | nova/image/glance.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/image/glance.py b/nova/image/glance.py index b5f52351f..7233eb18d 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -154,6 +154,15 @@ class GlanceImageService(service.BaseImageService): except KeyError: raise exception.ImagePaginationFailed() + try: + kwargs['limit'] = kwargs['limit'] - len(images) + # break if we have reached a provided limit + if kwargs['limit'] <= 0: + return + except KeyError: + # ignore missing limit, just proceed without it + pass + for image in self._fetch_images(fetch_func, **kwargs): yield image |
