Skip to content

WIP: Fix BoostRepoConnect fallback to use PrepareRepo instead of ConnectToRepo (#8279)#490

Draft
kaovilai wants to merge 1 commit intoopenshift:oadp-1.4from
kaovilai:8279-boost-repo-connect-oadp-1.4
Draft

WIP: Fix BoostRepoConnect fallback to use PrepareRepo instead of ConnectToRepo (#8279)#490
kaovilai wants to merge 1 commit intoopenshift:oadp-1.4from
kaovilai:8279-boost-repo-connect-oadp-1.4

Conversation

@kaovilai
Copy link
Copy Markdown
Member

Note

Accepted fix in upstream vmware-tanzu/velero will be prioritized/preferred over this cherry-pick.

Problem

When BoostRepoConnect's Open() fast path fails (e.g., stale local kopia config after BSL prefix change), it falls back to ConnectToRepo which only connects (Init with createNew=false). If no kopia repository exists at the new storage location, this fails with:

error to initialize data path: error to boost backup repository connection
  ts-dpa-1-test-prefix-bug-kopia: error to connect backup repo: error to connect
  repo with storage: error to connect to repository: repository not initialized
  in the provided storage

This is the error seen in vmware-tanzu/velero#8279.

Root Cause

BoostRepoConnect (pkg/repository/provider/unified_repo.go) falls back to ConnectToRepo (connect-only) instead of PrepareRepo (connect-then-init). The existing invalidation logic (vmware-tanzu#7380) and BackupRepository reconciliation (PrepareRepo) are correct — the bug is only in the backup data path's fallback.

Fix

One-line change: swap ConnectToRepo for PrepareRepo in BoostRepoConnect's fallback path. This ensures that when the local kopia config is stale, BoostRepoConnect will initialize a new repository at the new location if one doesn't exist — matching the BackupRepository controller's reconciliation behavior.

Complementary to

This fix addresses the data path fallback so BoostRepoConnect can handle uninitialized repos regardless of controller state.

Tests Added

  • TestInvalidateBackupReposForBSL — verifies invalidateBackupReposForBSL() patches matching repos to NotReady
  • TestCheckNotReadyRepoUpdatesIdentifierOnPrefixChange — restic repo identifier update on prefix change
  • TestCheckNotReadyRepoKopiaUpdatesIdentifierOnPrefixChange — kopia repo identifier update on prefix change
  • TestBSLDeleteRecreateWithNewPrefix — full BSL delete/recreate cycle end-to-end
  • TestBoostRepoConnectInitializesWhenRepoNotFound — verifies BoostRepoConnect initializes repo when not found at new location

…ectToRepo (vmware-tanzu#8279)

When BoostRepoConnect's Open() fast path fails (e.g., stale local config after
BSL prefix change), it falls back to ConnectToRepo which only connects
(Init with createNew=false). If no kopia repository exists at the new storage
location, this fails with 'repository not initialized in the provided storage'.

Fix: Change the fallback from ConnectToRepo to PrepareRepo, which tries to
connect first and initializes a new repository if ErrRepositoryNotInitialized
is returned — matching the BackupRepository controller's reconciliation behavior.

This is complementary to vmware-tanzu#9236 which fixes the controller-side invalidation.
This fix addresses the data path fallback so BoostRepoConnect can handle
uninitialized repos regardless of controller state.

Accepted fix in upstream will be prioritized/preferred over this cherry-pick.

Also adds unit tests for:
- invalidateBackupReposForBSL() function
- BackupRepository identifier update on BSL prefix change (restic and kopia)
- Full BSL delete/recreate cycle (PR vmware-tanzu#7380 scenario)
- BoostRepoConnect initialization when repo not found at new location

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef565365-2f7a-4c28-becb-195d0137d31e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 23, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 23, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaovilai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant