Remove hash check during image upload

There were situations, when image was upload twice automatically,
because it was updated and it's hash changed.
But since these images have the same name and some of our applications
currently rely on image name, when constructing heat template it caused
problems in heat, as it could not resolve this situation,
while deploying template, generated by Murano.

Change-Id: Ib8f86f4934b2420d3c1c7e952dcbb47bcc9ab81c
Closes-Bug: #1443936
This commit is contained in:
Ekaterina Chernova 2015-05-08 14:43:44 +03:00 committed by Kirill Zaitsev
parent 55000b1ccf
commit af0a55cb81
2 changed files with 6 additions and 9 deletions

View File

@ -370,7 +370,7 @@ def ensure_images(glance_client, image_specs, base_url, local_path=None):
return False
return True
keys = ['Name', 'Hash', 'DiskFormat', 'ContainerFormat', ]
keys = ['Name', 'DiskFormat', 'ContainerFormat', ]
installed_images = []
for image_spec in image_specs:
if not _image_valid(image_spec, keys):
@ -380,13 +380,11 @@ def ensure_images(glance_client, image_specs, base_url, local_path=None):
'disk_format': image_spec["DiskFormat"],
'container_format': image_spec["ContainerFormat"],
}
# NOTE(kzaitsev): glance v1 client does not allow checksum in
# a filter, so we have to filter ourselves
for img_obj in glance_client.images.list(filters=filters):
img = img_obj.to_dict()
if img['checksum'] == image_spec['Hash']:
break
else:
images = glance_client.images.list(filters=filters)
try:
img = images.next().to_dict()
except StopIteration:
img = None
update_metadata = False

View File

@ -83,7 +83,6 @@ def make_pkg(manifest_override, image_dicts=None):
default_image_spec = {
'ContainerFormat': 'bare',
'DiskFormat': 'qcow2',
'Hash': 'd41d8cd98f00b204e9800998ecf8427e',
'Name': '',
}
for image_dict in image_dicts: