Skip to content

Commit a05f826

Browse files
authored
Merge pull request #339 from zhucan/bugfix-338
ControllerGetVolume should report abnormal volume condition if volume…
2 parents bbb7084 + f8cca14 commit a05f826

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/hostpath/controllerserver.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,18 @@ func (hp *hostPath) ControllerGetVolume(ctx context.Context, req *csi.Controller
463463

464464
volume, err := hp.state.GetVolumeByID(req.GetVolumeId())
465465
if err != nil {
466-
return nil, err
466+
// ControllerGetVolume should report abnormal volume condition if volume is not found
467+
return &csi.ControllerGetVolumeResponse{
468+
Volume: &csi.Volume{
469+
VolumeId: req.GetVolumeId(),
470+
},
471+
Status: &csi.ControllerGetVolumeResponse_VolumeStatus{
472+
VolumeCondition: &csi.VolumeCondition{
473+
Abnormal: true,
474+
Message: err.Error(),
475+
},
476+
},
477+
}, nil
467478
}
468479

469480
healthy, msg := hp.doHealthCheckInControllerSide(req.GetVolumeId())

0 commit comments

Comments
 (0)