From 3513c4581fe0c27ef634d55e235de3be51753930 Mon Sep 17 00:00:00 2001 From: cmart Date: Wed, 16 May 2018 09:58:18 -0400 Subject: [PATCH 1/2] Fixes for Glance client v1 native (non-iRODS) upload method --- scripts/application_to_provider.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/application_to_provider.py b/scripts/application_to_provider.py index 3e4d7bcf8..8c6aa4fbe 100755 --- a/scripts/application_to_provider.py +++ b/scripts/application_to_provider.py @@ -512,10 +512,13 @@ def migrate_or_verify_image_data(img_uuid, src_glance_client, dst_glance_client, logging.warn("Warning: image data already present on destination provider but size does not match; " "this may be OK if image was previously migrated with --clean") else: - if src_img.checksum != dst_img.checksum: - logging.warn("Warning: image data already present on destination provider but checksum does not " - "match; this may be OK if image was previously migrated with --clean, or if iRODS " - "transfer was previously used to migrate image") + try: + if src_img.checksum != dst_img.checksum: + logging.warn("Warning: image data already present on destination provider but checksum does not " + "match; this may be OK if image was previously migrated with --clean, or if iRODS " + "transfer was previously used to migrate image") + except AttributeError: + logging.warn("Warning: either source or destination image missing a checksum") else: raise Exception("Glance image on destination provider is not in an uploadable or usable status") return True @@ -577,7 +580,11 @@ def migrate_image_data_glance(src_glance_client, dst_glance_client, img_uuid, lo logging.debug("Attempting to upload image data to destination provider") with open(local_path, 'rb') as img_file: try: - dst_glance_client.images.upload(img_uuid, img_file) + # "Upload" method is different for Glance client v1, than for v2 + if type(dst_glance_client) is glanceclient.v1.client.Client: + dst_glance_client.images.update(img_uuid, data=img_file) + else: + dst_glance_client.images.upload(img_uuid, img_file) if local_img_checksum == dst_glance_client.images.get(img_uuid).checksum: logging.info("Successfully uploaded image data to destination provider") break From e7e7370a505b36b474b1a9e2eef6acfb961f4ec6 Mon Sep 17 00:00:00 2001 From: cmart Date: Wed, 16 May 2018 10:04:25 -0400 Subject: [PATCH 2/2] changelog update --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 228ba2e5c..1f5f7e3d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) --> ## [Unreleased](https://github.com/cyverse/atmosphere/compare/v32-2...HEAD) - YYYY-MM-DD +### Fixed +- `application_to_provider` was using an invalid method in Glance Client v1 to upload image data ([#618](https://github.com/cyverse/atmosphere/pull/618)) + ## [v32-2](https://github.com/cyverse/atmosphere/compare/v32-1...v32-2) - 2018-04-26 ### Fixed - Quota updates concerning volumes would silently fail ([#611](https://github.com/cyverse/atmosphere/pull/611))