Skip to content

Commit

Permalink
fix(controller): regard volume as unpublished from the node, if node …
Browse files Browse the repository at this point in the history
…is not found (#99)
  • Loading branch information
peknur committed Dec 7, 2023
1 parent 4c0e4fc commit 5d774d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 5d774d9

Please sign in to comment.