Merge lp://qastaging/~danilo/simplestreams/insert-item-factoring into lp://qastaging/simplestreams
Status: | Merged |
---|---|
Merged at revision: | 435 |
Proposed branch: | lp://qastaging/~danilo/simplestreams/insert-item-factoring |
Merge into: | lp://qastaging/simplestreams |
Diff against target: |
828 lines (+681/-79) 2 files modified
simplestreams/mirrors/glance.py (+202/-79) tests/unittests/test_glancemirror.py (+479/-0) |
To merge this branch: | bzr merge lp://qastaging/~danilo/simplestreams/insert-item-factoring |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
simplestreams-dev | Pending | ||
Review via email:
|
Description of the change
This change refactors GlanceMirror.
1. Download image to a local file from a ContentSource
2. Construct extra properties to store in Glance along with image
3. Prepare arguments for GlanceClient.
4. Adapt source simplestreams entry for an image for use in the target simplestreams index
It should be fully backwards compatible, and test coverage for all the individual steps should be much better (I admit to it not being perfect, but it's a step in the right direction, imho at least).
This branch is the base for follow-up branch (coming tomorrow) to introduce changes where we ensure a problem after the first image is fully uploaded to Glance won't result in all the metadata being lost due to it not being saved anywhere (bug 1584938).
The test for the insert_item() itself is far from perfect: it could be made simpler, but this one is based on the input and output data from the previous version of the code and actual live image data from cloud-images.
Also, I've refrained from changing some of the awkward variable names in it, to simplify review ('flat' has remained 'flat', instead of perhaps 'flat_source_
Danilo, thank you for cleanups. Looks mostly good.
The one thing i'm concerned about is changing the signature on GlanceMirror.
I'm not opposed to variable name improvements. but maybe something a bit shorrter. img_data sstream_ item
flattened_
target_
clearly we're in bike shed territory here.
do you think its better or worse to have hypervisor_mapping at the class level ?
rather than getting it in insert_item and passing it around.