Fix custom image deployment via SimpleStreams (3.7) - #576
Open
jlboostrun wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
[maas-code-reviewer review]
LLM-generated review from https://github.com/canonical/maas-code-reviewer.
Intended to assist a human reviewer, not replace one — suggestions may be
incorrect, please verify before acting.
This change correctly identifies and fixes a bug where SYNCED custom images could not be deployed because the lookup logic only matched UPLOADED images with the bare series name.
However, I spotted a couple of issues:
- A test class definition (
TestGetAvailableCommissioningResources) was accidentally removed during the test additions, which messes up the test suite structure and causes unintendedsetUpoverwrites. - In
rpc/boot.py, replacingname=final_serieswithname__in=[...]introduces the possibility ofBootResource.objects.get()throwing aMultipleObjectsReturnedexception if a user happens to have both an uploaded and a synced custom image with the same series name. This exception currently goes unhandled.
Please see the inline comments for more details.
jlboostrun
force-pushed
the
SRE-31-custom-simplestreams-patches
branch
from
August 25, 2026 19:37
57f82dc to
97ae731
Compare
Custom images synced from a SimpleStreams source are stored with a
'custom/' name prefix (e.g. 'custom/br-ubuntu-24.04') and rtype=SYNCED.
However, all name lookups for custom osystem used the bare series name
and only matched UPLOADED resources, making custom-via-SimpleStreams
undeployable.
Three code paths fixed:
- preseed.py get_base_osystem_series: name=release → name__in=[release, f"custom/{release}"]
- bootresource.py get_resource_for: name=series + rtype=(UPLOADED,) → name__in=[series, f"custom/{series}"] + rtype=(SYNCED, UPLOADED)
- rpc/boot.py get_boot_config_for_machine + _get_files_map: same name__in fix
Tests added for SYNCED custom resources with custom/ prefix in both
bootresource and rpc/boot code paths.
jlboostrun
force-pushed
the
SRE-31-custom-simplestreams-patches
branch
from
August 25, 2026 19:41
97ae731 to
f1e6a62
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Custom images synced from a SimpleStreams boot source cannot be deployed. The deploy fails with:
Launchpad bug: https://bugs.launchpad.net/maas/+bug/2164564
Root Cause
When custom images are synced from a SimpleStreams source, the importer stores them with a
custom/name prefix (e.g.custom/br-ubuntu-24.04) andrtype=SYNCED. However, all resource lookups for thecustomosystem query with the bare series name and only matchUPLOADEDresources:preseed.py:get_base_osystem_series—BootResource.objects.get(name=release, ...)never matchescustom/{release}bootresource.py:get_resource_for—name=series+rtype=(UPLOADED,)categorically excludes synced resourcesrpc/boot.py:get_boot_config_for_machine— samename=final_seriesbare lookup in the xinstall pathrpc/boot.py:_get_files_map— same bare lookup for PXE kernel/initrd retrievalThis makes the
customosystem + SimpleStreams combination entirely undeployable. Only manually uploaded custom images (bare name,rtype=UPLOADED) work.Fix
All four lookups now use
name__in=[series, f"custom/{series}"]to match both naming conventions, andget_resource_forincludesSYNCEDin the rtype filter for custom osystem.The change is backward-compatible: uploaded custom resources (bare name, UPLOADED) still match via the bare name in the
name__inlist.Testing
test_get_resource_for_returns_synced_custom_resource— SYNCED resource withcustom/prefix found via bare seriestest_get_boot_config_for_machine_synced_custom_image— full boot config lookup for SYNCED custom resourceVerification
Verified end-to-end on MAAS 3.7.2 (snap rev 41649): custom Ubuntu 24.04 image published to a SimpleStreams stream, synced to a MAAS controller, and deployed to a UEFI VM. Machine reached Deployed state with cloud-init complete.
The bind-mounted hot-fixes on the test controller used exactly these name lookups; this PR makes them persistent in the codebase.