Skip to content

Commit 2eaabf0

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "_extract_amp_image_id_by_tag should return last created image"
2 parents 6218fdc + c4017ae commit 2eaabf0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

octavia/compute/drivers/nova_driver.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@
3535
def _extract_amp_image_id_by_tag(client, image_tag):
3636
images = list(client.images.list(
3737
filters={'tag': [image_tag]},
38-
sort='created_at'))
38+
sort='created_at:desc',
39+
limit=2))
3940
if not images:
4041
raise exceptions.GlanceNoTaggedImages(tag=image_tag)
41-
image_id = images[-1]['id']
42+
image_id = images[0]['id']
4243
num_images = len(images)
4344
if num_images > 1:
4445
LOG.warning(
4546
_LW("A single Glance image should be tagged with %(tag)s tag, "
46-
"but %(num)d found. Using %(image_id)s."),
47-
{'tag': image_tag, 'num': num_images, 'image_id': image_id}
47+
"but at least two were found. Using %(image_id)s."),
48+
{'tag': image_tag, 'image_id': image_id}
4849
)
4950
return image_id
5051

0 commit comments

Comments
 (0)