diff --git a/changelogs/unreleased/7521-qiuming-best b/changelogs/unreleased/7521-qiuming-best new file mode 100644 index 000000000..4e2510649 --- /dev/null +++ b/changelogs/unreleased/7521-qiuming-best @@ -0,0 +1,2 @@ +Fix DataDownload fails during restore for empty PVC workload + diff --git a/pkg/uploader/kopia/snapshot.go b/pkg/uploader/kopia/snapshot.go index 1a0956256..4a2b41c1a 100644 --- a/pkg/uploader/kopia/snapshot.go +++ b/pkg/uploader/kopia/snapshot.go @@ -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{ diff --git a/pkg/uploader/kopia/snapshot_test.go b/pkg/uploader/kopia/snapshot_test.go index c6b634e6b..3021389fb 100644 --- a/pkg/uploader/kopia/snapshot_test.go +++ b/pkg/uploader/kopia/snapshot_test.go @@ -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",