diff --git a/glanceclient/tests/unit/v2/test_images.py b/glanceclient/tests/unit/v2/test_images.py index 26ee792f..7260f47e 100644 --- a/glanceclient/tests/unit/v2/test_images.py +++ b/glanceclient/tests/unit/v2/test_images.py @@ -555,6 +555,12 @@ class TestController(testtools.TestCase): self.assertEqual('image-3', images[2].name) self.assertEqual(3, len(images)) + def test_list_images_with_marker(self): + images = list(self.controller.list(limit=1, + marker='3a4560a1-e585-443e-9b39-553b46ec92d1')) + self.assertEqual('6f99bf80-2ee6-47cf-acfe-1f1fabb7e810', images[0].id) + self.assertEqual('image-2', images[0].name) + def test_list_images_visibility_public(self): filters = {'filters': {'visibility': 'public'}} images = list(self.controller.list(**filters)) diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index 01ce40b9..0cbd0d52 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -168,6 +168,9 @@ class Controller(object): for dir in sort_dir: url = '%s&sort_dir=%s' % (url, dir) + if isinstance(kwargs.get('marker'), six.string_types): + url = '%s&marker=%s' % (url, kwargs['marker']) + for image in paginate(url, page_size, limit): yield image