[PR #45] [MERGED] fix(pve): ImageReady recognizes tarball images (fixes duplicate image records) #47

Closed
opened 2026-10-15 12:51:36 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/LXC2Docker/pull/45
Author: @JBailes
Created: 5/31/2026
Status: ✅ Merged
Merged: 5/31/2026
Merged by: @JBailes

Base: main ← Head: fix/imageready-tarball


📝 Commits (1)

  • 85b7c22 fix(pve): recognize tarball-backed images in ImageReady; fixes duplicate records

📊 Changes

2 files changed (+38 additions, -0 deletions)

View changed files

📝 internal/lxc/manager.go (+9 -0)
📝 internal/lxc/pve_tarball_test.go (+29 -0)

📄 Description

Problem

docker run busybox after docker pull busybox created a second image record busybox (with its own tarball) alongside the canonical docker.io/library/busybox:latest. This is why the Proxmox host accumulated duplicate pve-templates/*.tar.gz and why docker rmi <shortname> behaved confusingly.

Root cause

ImageReady only recognized the legacy schemes: a TemplateVMID conf, or an lxcPath/<TemplateName>/config dir. A current tarball-backed image has neither, so ImageReady returned false for an image that was actually fully pulled. The container-create path (containers.go:94) treats "present but not ready" as a miss and re-pulls via PullImageWith(req.Image, …) — under the raw request ref — registering a duplicate record.

Fix

Teach ImageReady to treat a tarball-backed image as ready iff its TemplateTarball exists (checked before the legacy probes). The create path then finds the already-pulled image via the store's fuzzy ref match and skips the spurious re-pull, so no duplicate is created.

Tests

  • TestImageReadyTarball: tarball present → ready (even with no legacy template dir); tarball missing → not ready; nil → not ready.
  • Verified live on the lvmthin test daemon: pull busybox, then run repeatedly by short + canonical name → single record, single tarball.

Follow-up to #43 (leaked-CT reaper) and #44 (orphan-tarball reaper).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/LXC2Docker/pull/45 **Author:** [@JBailes](https://github.com/JBailes) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@JBailes](https://github.com/JBailes) **Base:** `main` ← **Head:** `fix/imageready-tarball` --- ### 📝 Commits (1) - [`85b7c22`](https://github.com/games-on-whales/LXC2Docker/commit/85b7c2274244a0602bd5f097b12912a5f81e2214) fix(pve): recognize tarball-backed images in ImageReady; fixes duplicate records ### 📊 Changes **2 files changed** (+38 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `internal/lxc/manager.go` (+9 -0) 📝 `internal/lxc/pve_tarball_test.go` (+29 -0) </details> ### 📄 Description ## Problem `docker run busybox` after `docker pull busybox` created a **second** image record `busybox` (with its own tarball) alongside the canonical `docker.io/library/busybox:latest`. This is why the Proxmox host accumulated duplicate `pve-templates/*.tar.gz` and why `docker rmi <shortname>` behaved confusingly. ## Root cause `ImageReady` only recognized the legacy schemes: a `TemplateVMID` conf, or an `lxcPath/<TemplateName>/config` dir. A current **tarball-backed** image has neither, so `ImageReady` returned `false` for an image that was actually fully pulled. The container-create path (`containers.go:94`) treats "present but not ready" as a miss and re-pulls via `PullImageWith(req.Image, …)` — under the **raw** request ref — registering a duplicate record. ## Fix Teach `ImageReady` to treat a tarball-backed image as ready iff its `TemplateTarball` exists (checked before the legacy probes). The create path then finds the already-pulled image via the store's fuzzy ref match and skips the spurious re-pull, so no duplicate is created. ## Tests - `TestImageReadyTarball`: tarball present → ready (even with no legacy template dir); tarball missing → not ready; nil → not ready. - Verified live on the lvmthin test daemon: pull busybox, then run repeatedly by short + canonical name → single record, single tarball. Follow-up to #43 (leaked-CT reaper) and #44 (orphan-tarball reaper). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 12:51:36 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/LXC2Docker#47
No description provided.