Skip to content
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

simplestreams: Fix regression when parsing indexes that contain both combined and non-combined variants #12829

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

tomponline
Copy link
Member

@tomponline tomponline commented Feb 7, 2024

When support for Incus images was added in #12260 at the time the LinuxContainers remote contained both LXD and Incus entries and so a fix was added to stop searching for a file when a compatible one had been found during the parsing of the simplestreams index.

However this caused a bug when parsing the remote index for https://cloud-images.ubuntu.com/buildd/daily/streams/v1/com.ubuntu.cloud:daily:download.json because it contains both combined and non-combined image files for LXD.

In principle stopping after the first compatible image was found makes sense and is more efficient.
However LXD parses the simplestreams index (albeit cached) multiple times during a single image resolution process (once to convert alias to fingerprint and again to find the files for the fingerprint) and this causes LXD to call (s *Products) ToLXD() multiple times.

Compounding this issue is that Go iterates maps in random order and so the issue only presented itself intermittently, depending on how Go iterate the simplestreams version map on each call to (s *Products) ToLXD() .

Since then the LinuxContainers remote has started blocking LXD users anyway, so support for Incus images was removed in #12748 and so we have no need for the original fix.

This PR reverts the fix and improves the logging.

Don't stop when finding first matching version file because the index is parsed
in random order and LXD calls it multiple times when figuring out which image
file to download and so stopping early can cause mismatches when trying to match
a converted alias to a specific file fingerprint.

Introduced with 3e9acc4

Signed-off-by: Thomas Parrott <[email protected]>
@tomponline tomponline merged commit 7afe7bc into canonical:main Feb 7, 2024
25 checks passed
@tomponline tomponline deleted the tp-simplestreams branch February 7, 2024 11:03
mr-cal added a commit to canonical/craft-providers that referenced this pull request Feb 7, 2024
Testing for canonical/lxd#12829

Signed-off-by: Callahan Kovacs <[email protected]>
mr-cal added a commit to canonical/craft-providers that referenced this pull request Feb 7, 2024
Testing for canonical/lxd#12829

Signed-off-by: Callahan Kovacs <[email protected]>
tomponline added a commit to tomponline/lxd-pkg-snap that referenced this pull request Feb 7, 2024
Includes fixes from canonical/lxd#12829

Signed-off-by: Thomas Parrott <[email protected]>
tomponline added a commit to tomponline/lxd-pkg-snap that referenced this pull request Feb 7, 2024
Includes fixes from canonical/lxd#12829

Signed-off-by: Thomas Parrott <[email protected]>
mr-cal added a commit to canonical/craft-providers that referenced this pull request Feb 8, 2024
Testing for canonical/lxd#12829

Signed-off-by: Callahan Kovacs <[email protected]>
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.

3 participants