From 4eeb5a3b05685b863c879b687ca15a56f80d29e8 Mon Sep 17 00:00:00 2001 From: Shahaf Bahar Date: Mon, 13 Nov 2023 12:09:46 +0200 Subject: [PATCH] Fix panic when csi timeout duration is short Signed-off-by: Shahaf Bahar --- internal/util/util.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/util/util.go b/internal/util/util.go index 94c68cf7..d8058516 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -266,8 +266,9 @@ func GetVolumeSnapshotContentForVolumeSnapshot(volSnap *snapshotv1api.VolumeSnap if err != nil { if err == wait.ErrWaitTimeout { - if snapshotContent.Status != nil && snapshotContent.Status.Error != nil { - log.Errorf("Timed out awaiting reconciliation of volumesnapshot, Volumesnapshotcontent %s has error: %v", snapshotContent.Name, snapshotContent.Status.Error.Message) + if snapshotContent != nil && snapshotContent.Status != nil && snapshotContent.Status.Error != nil { + log.Errorf("Timed out awaiting reconciliation of volumesnapshot, Volumesnapshotcontent %s has error: %v", snapshotContent.Name, *snapshotContent.Status.Error.Message) + err = fmt.Errorf("CSI got timed out with error: %v", *snapshotContent.Status.Error.Message) } else { log.Errorf("Timed out awaiting reconciliation of volumesnapshot %s/%s", volSnap.Namespace, volSnap.Name) }