From 5d774d95f2a7c82fae922446cb35eaca39f7145d Mon Sep 17 00:00:00 2001 From: Pekka Nurmi Date: Thu, 7 Dec 2023 14:38:08 +0200 Subject: [PATCH] fix(controller): regard volume as unpublished from the node, if node is not found (#99) --- CHANGELOG.md | 3 +++ internal/controller/controller.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc4c82..72d8d91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] +### Fixed +- controller: regard volume as unpublished from the node, if node is not found + ## [1.0.0] First stable release diff --git a/internal/controller/controller.go b/internal/controller/controller.go index cd765a5..90d6fc8 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -305,6 +305,7 @@ func (c *Controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con _, err := c.svc.GetStorageByUUID(ctx, req.GetVolumeId()) if err != nil { if errors.Is(err, service.ErrStorageNotFound) { + log.Info("storage not found") return &csi.ControllerUnpublishVolumeResponse{}, nil } return nil, err @@ -314,6 +315,10 @@ func (c *Controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con log.Info("getting server by hostname") server, err := c.svc.GetServerByHostname(ctx, req.GetNodeId()) if err != nil { + if errors.Is(err, service.ErrServerNotFound) { + log.Info("server not found") + return &csi.ControllerUnpublishVolumeResponse{}, nil + } return nil, err }