From 1bc5df5bd599519d339c3f4dd21c4f7ead967270 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 17 Jul 2023 20:32:20 +0800 Subject: [PATCH] fix(backup): set backup error if backup target invalid When starting a backup monitor, it will start to take a snapshot backup procedure and it will be failed if the s3 backup target is invalid (nfs backup target will be not be failed because of timeout and test the backup when it is in progress.) Set the backup state as `Error` if starting the backup procedure returns an error. Ref: 1249 Signed-off-by: James Lu (cherry picked from commit e278ba0c2d2591dfae8f79b069574bf2ede7e330) --- controller/backup_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controller/backup_controller.go b/controller/backup_controller.go index db311d98e1..9ebbe9f9de 100644 --- a/controller/backup_controller.go +++ b/controller/backup_controller.go @@ -375,6 +375,10 @@ func (bc *BackupController) reconcile(backupName string) (err error) { monitor, err := bc.checkMonitor(backup, volume, backupTarget) if err != nil { + if backup.Status.State == longhorn.BackupStateError { + log.WithError(err).Warnf("Failed to enable the backup monitor for backup %v", backup.Name) + return nil + } return err }