mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
rbd: return abnormal in NodeGetVolumeStats
When we do stat on the targetpath, if there is any error we can check is it due to corruption. If yes, cephcsi can return abnormal in the NodeGetVolumeStats so that consumer (CO/admin) and detect and take further action. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
44d4546480
commit
848e3ee557
@ -1268,6 +1268,17 @@ func (ns *NodeServer) NodeGetVolumeStats(
|
|||||||
|
|
||||||
stat, err := os.Stat(targetPath)
|
stat, err := os.Stat(targetPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if util.IsCorruptedMountError(err) {
|
||||||
|
log.WarningLog(ctx, "corrupted mount detected in %q: %v", targetPath, err)
|
||||||
|
|
||||||
|
return &csi.NodeGetVolumeStatsResponse{
|
||||||
|
VolumeCondition: &csi.VolumeCondition{
|
||||||
|
Abnormal: true,
|
||||||
|
Message: err.Error(),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "failed to get stat for targetpath %q: %v", targetPath, err)
|
return nil, status.Errorf(codes.InvalidArgument, "failed to get stat for targetpath %q: %v", targetPath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user