-
Notifications
You must be signed in to change notification settings - Fork 96
Blueprint for Atmosphere(2) script, "application_to_provider.py"
Parse arguments:
- Ensure that arguments make sense
- Fetch Application and Provider objects from user-provided application ID and provider ID
- Fetch source Provider object from optional user-provided source provider ID
Get an account driver and image manager for destination provider (We don't get these for source provider yet because each ApplicationVersion may have different available source providers)
Get Application-specific metadata that we'll need from Atmosphere(2), and resolve metadata identifiers on destination provider:
- Application owner user/group(?) UUID on destination provider
- If Application owner is missing from destination cloud, either raise exception or set owner to atmosphere administrator if
--ignore-missing-ownerset
- If Application owner is missing from destination cloud, either raise exception or set owner to atmosphere administrator if
- Application member users/groups(?), if image is private
- Deduplicate Application members and ApplicationVersion members
- Resolve application member UUIDs on destination provider
- If Application members are missing from destination cloud, either raise exception or ignore them if
--ignore-missing-membersset
- Application tags
For each ApplicationVersion of the specified Application:
-
Check if the ApplicationVersion already has a ProviderMachine/InstanceSource(?) for destination provider
- If so, we don't need to create one
- If not, we will create one later
-
Resolve a source provider
- If specified by user calling script, ensure this ApplicationVersion has a ProviderMachine for source provider
- If not specified, choose one that is not the destination provider
-
Get an account driver and image manager for source provider
-
Look up image UUID in source provider (ProviderMachine.identifier)
-
Get source image metadata (JSON?) from Glance, which contains these things we need (maybe more?):
- container_format
- disk_format
- size
- checksum
-
Migrate Glance image as needed
-
If this ApplicationVersion already has a ProviderMachine/InstanceSource for destination provider, look for image UUID in Atmosphere(2) database
-
If we don't have an image in Glance on destination provider which matches UUID in Atmosphere(2) database:
- Create image and keep UUID for later putting into database
-
Populate image metadata
- Do this every time, it's easier than figuring out what needs to change and changing only that
- Fields:
- container_format (from metadata of image in source provider)
- disk_format (from metadata of image in source provider)
- visibility (from Application.private)
- owner UUID (determined earlier in script)
- members UUIDs (determined earlier in script)
- tags (determined earlier in script)
- application_name (application.name)
- application_version (app_version.name?)
- application_description (application.description)
- application_owner (application.created_by.user?)
- application_tags?
- application_uuid (
str(application.uuid)) - min_disk?
- min_ram?
-
Populate image data, if needed
- If we have an existing image UUID in destination provider, get its checksum, compare with checksum in source provider
- If image does not exist on destination provider, or it exists but the checksum doesn't match, we must transfer image data
- Loop until checksum matches between providers, or we try a few times and give up
- If using Glance client to transfer:
- Download image data from source provider
- Don't download image data if we already have a local copy and the checksum matches (Chromogenic fix?)
- Upload image data to destination provider
- Download image data from source provider
- If using iRODS to transfer:
- Derive iRODS path from glance location
-
icpfile to iRODS collection for new provider - Set
irods://URI location for image in glance
- If using Glance client to transfer:
- Loop until checksum matches between providers, or we try a few times and give up
-
-
Create/update ProviderMachine and InstanceSource for destination provider, if it doesn't exist already
- Populate InstanceSource.identifier with the Glance image ID