Merge lp://qastaging/~danilo/simplestreams/ignore-inactive-images into lp://qastaging/simplestreams
Status: | Merged |
---|---|
Merged at revision: | 433 |
Proposed branch: | lp://qastaging/~danilo/simplestreams/ignore-inactive-images |
Merge into: | lp://qastaging/simplestreams |
Diff against target: |
15 lines (+5/-0) 1 file modified
simplestreams/mirrors/glance.py (+5/-0) |
To merge this branch: | bzr merge lp://qastaging/~danilo/simplestreams/ignore-inactive-images |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
simplestreams-dev | Pending | ||
Review via email:
|
Description of the change
If connection to glance is broken during GlanceMirror.
Glance itself tries to protect against that, however when it is restarted (eg. "service glance-api restart"), it does not clean the image up. (I still think glance should be fixed to at least clean up "saving" images when it's gracefully restarted, so I'll file a bug about that if I can find exactly where to do that :).
This change makes load_product() ignore any images that do not have "status": "active". I wasn't sure if I should maybe only check for status != "saving" instead, but it seems images can only have deleted, active or saving status, so this should be good.
Note that this isn't perfect. The image in "saving" state is never cleaned up, but at least the resulting cloud works. If we want to clean up broken images, it'd be hard to do on the simplestreams side (glance is better placed to do that: it knows if anything is going on with any of them, eg. is it being currently updated or not).
I didn't provide any tests though: load_products is currently untested and would need some serious refactoring or mocking and faking to get any decent test for this.
is status going to be guaranteed to be there in all image response?
I suspect it is, but should be reasonable sure of that so we dont get a KeyError on image['status']