Skip to content

fix: improve OpenStack image lookup and architecture tokenization - #302

Open
simonepelosi wants to merge 2 commits into
canonical:masterfrom
simonepelosi:openstack-image-lookup
Open

simonepelosi wants to merge 2 commits into
canonical:masterfrom
simonepelosi:openstack-image-lookup

Conversation

@simonepelosi

Copy link
Copy Markdown

Split out the OpenStack image lookup changes from #300:

  • Tokenize known architectures (amd64v3, ppc64el, riscv64, amd64, arm64, armhf, armel, s390x, i386) as whole terms in toTerms so amd64 does not match amd64v3.
  • Select the newest image among duplicate exact-name or term matches in the OpenStack backend, and prefer images with kernel_id set when riscv64 is requested.
  • Update README.md to document the OpenStack image selection behavior.

Update termExp in toTerms to recognize known architectures
(amd64v3, ppc64el, riscv64, amd64, arm64, armhf, armel, s390x, i386)
as atomic terms before splitting letters and numbers.

Previously, amd64 was tokenized into "amd" and "64", which matched
"amd64v3" ("amd", "64", "v", "3") as a subsequence. When both amd64
and newer amd64v3 images were present, amd64v3 was selected by mistake.

By matching architecture names atomically, searching for amd64 will
not match amd64v3.
Image names are not unique in OpenStack. The lookup returned the first
exact-name match in list order, so it did not reliably pick the newest
image, and it never looked at kernel_id.

Select the newest among all exact-name matches, and among all term
matches if there is no exact one. If the requested image contains the
riscv64 token, an image with kernel_id set ranks above a newer one
without it. Exact-name matches still win over term matches. Fix the
README description of the lookup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant