Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Fixes for application_to_provider Glance client v1 native (non-iRODS) upload method #618

Merged
merged 2 commits into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
17 changes: 12 additions & 5 deletions scripts/application_to_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down