Skip to content

Commit a5d8c70

Browse files
committed
fix: unpublish when the node no longer exists
When a VM is removed along with its block devices, we need to complete the unpublish process. Signed-off-by: Serge Logvinov <[email protected]>
1 parent 85a0e89 commit a5d8c70

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/csi/controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ func (d *ControllerService) ControllerUnpublishVolume(ctx context.Context, reque
585585

586586
vmr, err := d.getVMRefbyNodeID(ctx, cl, nodeID)
587587
if err != nil {
588+
if strings.Contains(err.Error(), "not found") {
589+
klog.V(3).InfoS("ControllerUnpublishVolume: node does not exist", "volumeID", vol.VolumeID(), "nodeID", nodeID)
590+
591+
return &csi.ControllerUnpublishVolumeResponse{}, nil
592+
}
593+
588594
return nil, err
589595
}
590596

pkg/csi/controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,6 @@ func (ts *configuredTestSuite) TestControllerUnpublishVolumeError() {
11041104
NodeId: "cluster-1-node-3",
11051105
VolumeId: "cluster-1/pve-1/local-lvm/vm-9999-pvc-123",
11061106
},
1107-
expectedError: status.Error(codes.InvalidArgument, "nodes \"cluster-1-node-3\" not found"),
11081107
},
11091108
{
11101109
msg: "WrongPVZone",

0 commit comments

Comments
 (0)