store: Fix upgrade with existing V2 composefs repo#2329
Conversation
| @@ -0,0 +1,85 @@ | |||
| # number: 47 | |||
| # tmt: | |||
| # summary: Test ostree upgrade with unified storage (composefs repo reopen) | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
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>
|
|
||
| // 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)?; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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)