Skip to content

Rewrite only ubuntu: image references on Incus - #105

Merged
bgrewell merged 1 commit into
mainfrom
fix/incus-image-translation
Aug 9, 2026
Merged

Rewrite only ubuntu: image references on Incus#105
bgrewell merged 1 commit into
mainfrom
fix/incus-image-translation

Conversation

@bgrewell

@bgrewell bgrewell commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Closes #91.

The problem

TranslateImage rewrote every reference carrying a remote into images:<remote>/<alias>/cloud:

return fmt.Sprintf("images:%s/%s/cloud", remote, alias)

That is correct for ubuntu: — Canonical's simplestreams endpoint does not serve Incus clients, so the reference has to be redirected to the linuxcontainers server. It is wrong for everything else:

Written Became Result
lxc:alpine/3.18 images:lxc/alpine/3.18/cloud no such path on that server
local:my-golden-image images:local/my-golden-image/cloud points at a public remote instead of the local store
myremote:custom/thing images:myremote/custom/thing/cloud private remote silently replaced

The /cloud suffix is a variant preference, not a fact about the alias namespace, and most image families do not publish it. Rewriting the remote is a separate error from choosing a variant, and this did both at once.

The fix

Only ubuntu: is rewritten. Everything else passes through as written — images:, lxc:, private and self-hosted remotes, and references with no remote at all. LXD is unaffected, as before.

An explicit ubuntu:24.04/cloud is no longer doubled into .../cloud/cloud.

The bug was tested in

TestTranslateImage asserted the old behaviour:

name:     "Incus lxc remote translated",
image:    "lxc:alpine/3.18",
expected: "images:lxc/alpine/3.18/cloud",

So the defect had a passing test describing it. That case now asserts the reference is left alone, with a comment explaining why. New table-driven tests cover the full matrix: LXD passthrough, the ubuntu rewrite, every other remote untouched, and the no-double-variant case.

Note on the second symptom in the issue

The issue also recorded that an already-translated images:ubuntu/24.04/cloud failed against a live daemon with The requested image couldn't be found for fingerprint "ubuntu/24.04/cloud", even though the equivalent incus launch worked. That is not fixed here and I could not reproduce it as a DART bug: the reference passes through TranslateImage untouched in both the old and new code, and the failure comes from the image server's alias lookup. The only local daemon on this machine is snap LXD, so the reference resolves against images.linuxcontainers.org rather than an Incus remote — a different path than the one the issue describes. Worth keeping #91 open on that point, or splitting it out, since the translation half is now settled.

Build, vet, gofmt, and the full test suite are green; the docs site builds. The docs section describing the old rewrite is replaced by what it does now.

TranslateImage rewrote every reference carrying a remote into
images:<remote>/<alias>/cloud. That is right for ubuntu:, whose simplestreams
endpoint does not serve Incus clients, and wrong for everything else: lxc:
was redirected to images:lxc/... on a server with no such path, a private or
self-hosted remote was silently replaced by the public one, and a /cloud
variant was appended to image families that do not publish it.

Only ubuntu: is rewritten now. An explicit ubuntu:24.04/cloud is not doubled.

The existing test asserted the old behaviour for lxc:, so it encoded the bug
rather than catching it; it now asserts the reference is left alone.
@bgrewell
bgrewell merged commit 6dea373 into main Aug 9, 2026
2 checks passed
@bgrewell
bgrewell deleted the fix/incus-image-translation branch August 9, 2026 03:31
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.

Incus image translation appends /cloud to every remote and misfires on non-ubuntu images

1 participant