mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
Merge pull request #7521 from qiuming-best/data-mover-empty-dir
Fix DataDownload fails during restore for empty PVC workload
This commit is contained in:
2
changelogs/unreleased/7521-qiuming-best
Normal file
2
changelogs/unreleased/7521-qiuming-best
Normal file
@@ -0,0 +1,2 @@
|
||||
Fix DataDownload fails during restore for empty PVC workload
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user