Skip to content

Commit

Permalink
fix(backup): backing image of backup backing image does not exist
Browse files Browse the repository at this point in the history
if backup backing image is synchronized from remote backup target
because backing image might not exist.

ref longhorn/longhorn 10026, 6341

Signed-off-by: James Lu <[email protected]>
  • Loading branch information
mantissahz authored and derekbit committed Dec 23, 2024
1 parent 5187ffd commit 6adf428
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webhook/resources/backupbackingimage/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func (bbi *backupBackingImageValidator) Create(request *admission.Request, newOb
backingImageName := backupBackingImage.Spec.BackingImage

backingImage, err := bbi.ds.GetBackingImageRO(backingImageName)
if err != nil {
if err != nil && !datastore.ErrorIsNotFound(err) {
return werror.NewInvalidError(fmt.Sprintf("failed to get the backing image %v for backup: %v", backingImageName, err), "")
}
// TODO: support backup for v2 data engine in the future
if types.IsDataEngineV2(backingImage.Spec.DataEngine) {
if backingImage != nil && types.IsDataEngineV2(backingImage.Spec.DataEngine) {
return werror.NewInvalidError(fmt.Sprintf("backing image %v uses v2 data engine which doesn't support backup operations", backingImageName), "")
}

Expand Down

0 comments on commit 6adf428

Please sign in to comment.