Skip to content

Commit

Permalink
mark volume detach as success when Node vm is deleted from vcenter
Browse files Browse the repository at this point in the history
  • Loading branch information
divyenpatel committed Jul 20, 2022
1 parent 8b542d4 commit 5d48733
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/csi/service/vanilla/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1247,8 +1247,14 @@ func (c *controller) ControllerUnpublishVolume(ctx context.Context, req *csi.Con
node, err = c.nodeMgr.GetNodeByName(ctx, req.NodeId)
}
if err != nil {
return nil, csifault.CSIInternalFault, logger.LogNewErrorCodef(log, codes.Internal,
"failed to find VirtualMachine for node:%q. Error: %v", req.NodeId, err)
if err == cnsvsphere.ErrVMNotFound {
log.Infof("Virtual Machine for Node ID: %v is not present in the VC Inventory. "+
"Marking ControllerUnpublishVolume for Volume: %q as sucessful.", req.NodeId, req.VolumeId)
return &csi.ControllerUnpublishVolumeResponse{}, "", nil
} else {
return nil, csifault.CSIInternalFault, logger.LogNewErrorCodef(log, codes.Internal,
"failed to find VirtualMachine for node:%q. Error: %v", req.NodeId, err)
}
}
faultType, err = common.DetachVolumeUtil(ctx, c.manager, node, req.VolumeId)
if err != nil {
Expand Down

0 comments on commit 5d48733

Please sign in to comment.