From cb7f7bca5ebfdd6d750aa69f8413801b0ecc0906 Mon Sep 17 00:00:00 2001 From: Nikhil Komawar Date: Thu, 1 Sep 2016 18:48:05 -0400 Subject: [PATCH] Always return a sorted list of drivers for configs glance.store entry point used in Glance for the store library is resulting in generating random order in each run of the ``tox -e genconfig`` command. This is because of the unsorted iterator returned by the stevedore extension manager [1, 2]. This commit fixes that and returs a deterministic, sorted list of drivers to generate the configs in Glance. Example scenario is at change Iea2c538b37182191445cc5c1f8b2d9dceed06343 Closes-Bug: 1619487 [1] https://github.com/openstack/glance_store/blob/22fa2b08e76a8ebc39ade92504aeafb0bf8d2f8c/glance_store/backend.py#L135 [2] http://docs.openstack.org/developer/stevedore/managers.html#stevedore.extension.ExtensionManager.__iter__ Co-Authored-By: Joshua Harlow (cherry picked from commits b5833a87236183444589f3f93fba8641eb6c520a and 04ef385759e535881e01d439c93d5bfae4841940) Change-Id: I3146b8597a5d89da49b84d6653edacc3067c2c71 --- glance_store/backend.py | 7 ++++++- ...ted-drivers-for-configs-a905f07d3bf9c973.yaml | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/sorted-drivers-for-configs-a905f07d3bf9c973.yaml diff --git a/glance_store/backend.py b/glance_store/backend.py index ba9ac644..8a2505e0 100644 --- a/glance_store/backend.py +++ b/glance_store/backend.py @@ -132,7 +132,12 @@ def _list_opts(): driver_opts = [] mgr = extension.ExtensionManager('glance_store.drivers') # NOTE(zhiyan): Handle available drivers entry_points provided - drivers = [ext.name for ext in mgr] + # NOTE(nikhil): Return a sorted list of drivers so that the oslo config + # generator can use that order to keep generating configuration file in a + # consistent manner. If this order is not preserved, in some cases the + # downstream packagers may see a long diff of the changes though not + # relevant as only order has changed. See some more details at bug 1619487. + drivers = sorted([ext.name for ext in mgr]) handled_drivers = [] # Used to handle backwards-compatible entries for store_entry in drivers: driver_cls = _load_store(None, store_entry, False) diff --git a/releasenotes/notes/sorted-drivers-for-configs-a905f07d3bf9c973.yaml b/releasenotes/notes/sorted-drivers-for-configs-a905f07d3bf9c973.yaml new file mode 100644 index 00000000..a50630f1 --- /dev/null +++ b/releasenotes/notes/sorted-drivers-for-configs-a905f07d3bf9c973.yaml @@ -0,0 +1,16 @@ +--- +prelude: > + Return list of store drivers in sorted order for + generating configs. More info in ``Upgrade Notes`` + and ``Bug Fixes`` section. +upgrade: + - This version of glance_store will result in Glance + generating the configs in a sorted (deterministic) + order. So, preferably store releases on or after this + should be used for generating any new configs if the + mismatched ordering of the configs results in an issue + in your environment. +fixes: + - Bug 1619487 is fixed which was causing random order of + the generation of configs in Glance. See ``upgrade`` + section for more details.