-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add glance-simplestreams-sync --set-latest-property functest #853
Add glance-simplestreams-sync --set-latest-property functest #853
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch; it looks like it is starting to get there. A couple of minor nitpicks, but also a significant issue with the async nature of the models and the code driving them. e.g. config changed -> "config-changed" hook, but that runs asynchronously to the code that starts it. Please take a look at the comments. Thanks.
d571d81
to
e9708be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I've taken a step back, and instead of just concentrating on the code in this review, I looked at the associated bug. I'm pretty sure that the code that this might be testing doesn't do what the bug reporter wants: a named alias for the 'latest' version of a particular synced image type.
This code appears to be testing 'adding a property to every image and calling that latest' which doesn't seem that useful to be honest.
I think this solution should be revisited - perhaps email the opendev mailing list, or contact the team via a channel, and see if we can move this forward. Thanks.
I've discussed with @wolsen and @freyes about this topic. it was suggested that instead of changing the name of the image I should add the I'm probably not doing in the best way, but if you look at my proposal for simplestreams I'm removing the diff --git a/simplestreams/mirrors/glance.py b/simplestreams/mirrors/glance.py
index 9181e9c..b96f8eb 100644
--- a/simplestreams/mirrors/glance.py
+++ b/simplestreams/mirrors/glance.py
@@ -517,6 +523,20 @@ class GlanceMirror(mirrors.BasicMirrorWriter):
print("created %s: %s" % (glance_image.id, full_image_name))
+ # TODO(guimalufb) use self.loaded_content or
+ # self.load_products() instead
+ if self.set_latest_property:
+ # Search all images with the same target attributtes
+ _filter_properties = {'filters': {
+ 'latest': 'true',
+ 'os_version': glance_props['os_version'],
+ 'architecture': glance_props['architecture']}}
+ images = self.gclient.images.list(**_filter_properties)
+ for image in images:
+ if image.id != glance_image.id:
+ self.gclient.images.update(image.id,
+ remove_props=['latest'])
+ I'd like to test having an image with the thanks for you careful review! |
e9708be
to
03b2176
Compare
Okay, at the very least, please go back to the bug and outline the solution so that the bug submitter can take a look at agree/disagree that it solves their problem. Otherwise, whilst it may be a solution, it simply may not work for the bug submitter and their tools.
That's why I couldn't find the change. This change needs to be on gerrit (review.opendev.org), NOT on launchpad. If you take a look at the code page (https://code.launchpad.net/charm-glance-simplestreams-sync) you'll see that it syncs the code from https://opendev.org/openstack/charm-glance-simplestreams-sync.git - any changes you attempt to make on LP will a) not be merged, and b) if they were, overwritten by a sync. Please re-do your PR on opendev.
Yes, that's tricky from a functional/integration test scenario. Best approach would be to verify that functionality using unit tests and mocking out simplestreams (or even in the g-sss (glance-simplestreams-sync) charm itself).
No problem. :) |
done!
my bad. I ran
That has been done on simplestreams repository |
7009710
to
1d19b6a
Compare
When creating Openstack VMs the user has to specify the image it wants to use. sstream-mirror-glance adds a date to the image name, so they always have to recheck which is the current latest image. This commit tests the usage of the `set_latest_property` configuration. When --set-latest-property is given sstream-mirror-glance will set the recently synced image with the `latest=true` property and then remove the `latest` property from all the os_version/architecture matching images. Closes-bug: LP #1933130 Use simplestreams edge channel to test set-latest-property
1d19b6a
to
60557c2
Compare
When creating Openstack VMs the user has to specify the image it wants to use. sstream-mirror-glance adds a date to the image name, so they always have to recheck which is the current latest image. This commit adds the `set_latest_property` configuration to include --set-latest-property to sstream-mirror-glance command line argument. When --set-latest-property is given sstream-mirror-glance will set the recently synced image with the `latest=true` property and then remove the `latest` property from all the os_version/architecture matching images. Configure bundles to fetch simplestreams snap from edge channel Closes-bug: #1933130 Change-Id: Idf78294db7abb8c81d637086e8142782bf1dd36f Func-Test-PR: openstack-charmers/zaza-openstack-tests#853
* Update charm-glance-simplestreams-sync from branch 'master' to 4754aca4209d1d18854b05360953bd5ba33cd668 - Add set_latest_property config to new image When creating Openstack VMs the user has to specify the image it wants to use. sstream-mirror-glance adds a date to the image name, so they always have to recheck which is the current latest image. This commit adds the `set_latest_property` configuration to include --set-latest-property to sstream-mirror-glance command line argument. When --set-latest-property is given sstream-mirror-glance will set the recently synced image with the `latest=true` property and then remove the `latest` property from all the os_version/architecture matching images. Configure bundles to fetch simplestreams snap from edge channel Closes-bug: #1933130 Change-Id: Idf78294db7abb8c81d637086e8142782bf1dd36f Func-Test-PR: openstack-charmers/zaza-openstack-tests#853
Landing this change but only after raising #947 to resolve the strangely placed config setting |
When creating Openstack VMs the user has to specify the image it wants
to use. sstream-mirror-glance adds a date to the image name, so they
always have to recheck which is the current latest image.
This commit tests the usage of the
set-latest-property
configuration.When set-latest-property is given sstream-mirror-glance will set the
recently synced image with the
latest=true
property and then removethe
latest
property from all the os_version/architecture matchingimages.
Closes-bug: LP #1933130