Skip to content

store: Fix upgrade with existing V2 composefs repo#2329

Merged
cgwalters merged 1 commit into
bootc-dev:mainfrom
jmarrero:unified-ero
Jul 23, 2026
Merged

store: Fix upgrade with existing V2 composefs repo#2329
cgwalters merged 1 commit into
bootc-dev:mainfrom
jmarrero:unified-ero

Conversation

@jmarrero

Copy link
Copy Markdown
Contributor

After composefs-rs switched the default EROFS format from V2 to V1 (composefs/composefs-rs#330), get_ensure_composefs() fails because init_path() refuses to re-initialize an existing V2 repo with V1.

Fix by trying open_path() first, which respects whatever format is on disk. Fall back to init_path() only for fresh directories, and open_upgrade() for pre-meta.json repos. Add a regression test.

Assisted-by: opencode (Claude claude-opus-4-6)

@bootc-bot
bootc-bot Bot requested a review from gursewak1997 July 20, 2026 17:54
Comment thread crates/lib/src/store/mod.rs Outdated
Comment thread crates/lib/src/store/mod.rs
@@ -0,0 +1,85 @@
# number: 47
# tmt:
# summary: Test ostree upgrade with unified storage (composefs repo reopen)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have something like this - this looks like a generic unified storage test.

The problem is we need an old bootc with unified storage set. We already have upgrade tests, I think this would be another variant of those.

IOW: Does this test fail without the fix? I don't think it would

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for now I'd say we should merge without an added test case; the code looks right.

I did composefs/composefs-rs#363 which I think we can switch to instead in the future, and it has sufficient unit/integration tests.

cgwalters
cgwalters previously approved these changes Jul 21, 2026
@cgwalters

Copy link
Copy Markdown
Collaborator

Needs cargo fmt

After composefs-rs switched the default EROFS format from V2 to V1
(composefs/composefs-rs#330), get_ensure_composefs() fails because
init_path() refuses to re-initialize an existing V2 repo with V1.

Fix by trying open_path() first, which respects whatever format is
on disk. Fall back to init_path() only for fresh directories, and
open_upgrade() for pre-meta.json repos.

Assisted-by: opencode (Claude claude-opus-4-6)
Signed-off-by: Joseph Marrero Corchado <jmarrero@redhat.com>
@cgwalters
cgwalters added this pull request to the merge queue Jul 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 22, 2026
Comment on lines +628 to +634

// First, try to open an existing repository. This respects whatever
// EROFS format version (V1 or V2) was persisted in meta.json, avoiding
// the "already initialized with different configuration" error that
// occurs when the composefs-rs default format version changes between
// bootc builds (e.g. V2 → V1 after composefs-rs PR #330).
let composefs_dir = self.physical_root.open_dir(COMPOSEFS)?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have function initialize_composefs_repository which does something similar, like initializing the repo. It is supposed to be called during install time, so it shouldn't really run into this particular error, but there are code duplication and I think it's better to consolidate these two functions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think when installing to an existing root, it could. We definitely want to align install with upgrade as much as possible.

That said, this can be a followup.

@cgwalters
cgwalters added this pull request to the merge queue Jul 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 22, 2026
@cgwalters
cgwalters added this pull request to the merge queue Jul 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 22, 2026
@cgwalters
cgwalters added this pull request to the merge queue Jul 22, 2026
Merged via the queue into bootc-dev:main with commit cd35048 Jul 23, 2026
18 checks passed
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