From 6e6d4f420fdbd490b8f41d24ad86742de50c04ed Mon Sep 17 00:00:00 2001 From: Derek Su Date: Mon, 26 Feb 2024 14:08:10 +0000 Subject: [PATCH] Make go vet happy Longhorn 7985 Signed-off-by: Derek Su --- pkg/spdk/replica.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/spdk/replica.go b/pkg/spdk/replica.go index b0dd815d3..30e3be865 100644 --- a/pkg/spdk/replica.go +++ b/pkg/spdk/replica.go @@ -524,7 +524,7 @@ func constructActiveChainFromSnapshotLvolMap(replicaName string, snapshotLvolMap if IsReplicaSnapshotLvol(replicaName, headParentSnapshotName) { headParentSnapSvcLvol := snapshotLvolMap[headParentSnapshotName] if headParentSnapSvcLvol == nil { - fmt.Errorf("cannot find the parent snapshot %s of the head for replica %s", headParentSnapshotName, replicaName) + return nil, fmt.Errorf("cannot find the parent snapshot %s of the head for replica %s", headParentSnapshotName, replicaName) } headSvcLvol = headParentSnapSvcLvol.Children[replicaName] } else { // The parent of the head is nil or a backing image @@ -1627,6 +1627,7 @@ func (r *Replica) BackupRestore(spdkClient *spdkclient.Client, backupUrl, snapsh defer func() { if err != nil { // TODO: Support snapshot revert for incremental restore + logrus.Infof("Failed to start restore for backup %v, will cancel the restore", backupUrl) } }() @@ -1640,7 +1641,12 @@ func (r *Replica) BackupRestore(spdkClient *spdkclient.Client, backupUrl, snapsh return fmt.Errorf("incremental restore is not supported yet") } - go r.completeBackupRestore(spdkClient) + go func() { + err := r.completeBackupRestore(spdkClient) + if err != nil { + r.log.WithError(err).Error("Failed to complete backup restore") + } + }() return nil