Make sure glance image list actually runs in Tasks
images.list() does not actually talk to an API. So putting it in TaskManager actually takes an execution slot that it does not need. On the other hand, the follow up list expansion DOES talk to the API. So put it in the Task, since it's the evil thing. Change-Id: I7f30ba908552fbecaedd364ecf20b19e096b03d9
This commit is contained in:
@@ -953,11 +953,14 @@ class OpenStackCloud(object):
|
||||
# First, try to actually get images from glance, it's more efficient
|
||||
images = []
|
||||
try:
|
||||
# If the cloud does not expose the glance API publically
|
||||
image_gen = self.manager.submitTask(_tasks.GlanceImageList())
|
||||
|
||||
# Creates a generator - does not actually talk to the cloud API
|
||||
# hardcoding page size for now. We'll have to get MUCH smarter
|
||||
# if we want to deal with page size per unit of rate limiting
|
||||
image_gen = self.glance_client.images.list(page_size=1000)
|
||||
# Deal with the generator to make a list
|
||||
image_list = [image for image in image_gen]
|
||||
image_list = self.manager.submitTask(
|
||||
_tasks.GlanceImageList(image_gen=image_gen))
|
||||
|
||||
if image_list:
|
||||
if getattr(image_list[0], 'validate', None):
|
||||
|
||||
@@ -124,7 +124,7 @@ class RouterDelete(task_manager.Task):
|
||||
|
||||
class GlanceImageList(task_manager.Task):
|
||||
def main(self, client):
|
||||
return client.glance_client.images.list()
|
||||
return [image for image in self.args['image_gen']]
|
||||
|
||||
|
||||
class NovaImageList(task_manager.Task):
|
||||
|
||||
Reference in New Issue
Block a user