Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DataDownload fails during restore for empty PVC workload #7521

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/unreleased/7521-qiuming-best
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix DataDownload fails during restore for empty PVC workload

10 changes: 0 additions & 10 deletions pkg/uploader/kopia/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,6 @@ func Backup(ctx context.Context, fsUploader SnapshotUploader, repoWriter repo.Re
return nil, false, errors.Wrapf(err, "Invalid source path '%s'", sourcePath)
}

if volMode == uploader.PersistentVolumeFilesystem {
// to be consistent with restic when backup empty dir returns one error for upper logic handle
dirs, err := os.ReadDir(source)
if err != nil {
return nil, false, errors.Wrapf(err, "Unable to read dir in path %s", source)
} else if len(dirs) == 0 {
return nil, true, nil
}
}

source = filepath.Clean(source)

sourceInfo := snapshot.SourceInfo{
Expand Down
2 changes: 1 addition & 1 deletion pkg/uploader/kopia/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ func TestBackup(t *testing.T) {
name: "Unable to read directory",
sourcePath: "/invalid/path",
tags: nil,
expectedError: errors.New("Unable to read dir"),
expectedError: errors.New("no such file or directory"),
},
{
name: "Source path is not a block device",
Expand Down
Loading