mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
util: return correct status code for VolumeGroupSnapshot
Fix status codes that are returned for Get/Delete RPC calls
for VolumeGroup/VolumeGroupSnapshot.
Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
(cherry picked from commit 18a62ec9de
)
This commit is contained in:
committed by
mergify[bot]
parent
09e298197e
commit
e7f5b8a28f
@ -195,7 +195,7 @@ func (vs *VolumeGroupServer) DeleteVolumeGroup(
|
||||
vg, err := mgr.GetVolumeGroupByID(ctx, req.GetVolumeGroupId())
|
||||
if err != nil {
|
||||
if errors.Is(err, group.ErrRBDGroupNotFound) {
|
||||
log.DebugLog(ctx, "VolumeGroup %q doesn't exists", req.GetVolumeGroupId())
|
||||
log.ErrorLog(ctx, "VolumeGroup %q doesn't exists", req.GetVolumeGroupId())
|
||||
|
||||
return &volumegroup.DeleteVolumeGroupResponse{}, nil
|
||||
}
|
||||
@ -433,9 +433,19 @@ func (vs *VolumeGroupServer) ControllerGetVolumeGroup(
|
||||
// resolve the volume group
|
||||
vg, err := mgr.GetVolumeGroupByID(ctx, req.GetVolumeGroupId())
|
||||
if err != nil {
|
||||
if errors.Is(err, group.ErrRBDGroupNotFound) {
|
||||
log.ErrorLog(ctx, "VolumeGroup %q doesn't exists", req.GetVolumeGroupId())
|
||||
|
||||
return nil, status.Errorf(
|
||||
codes.NotFound,
|
||||
"could not find volume group %q: %s",
|
||||
req.GetVolumeGroupId(),
|
||||
err.Error())
|
||||
}
|
||||
|
||||
return nil, status.Errorf(
|
||||
codes.NotFound,
|
||||
"could not find volume group %q: %s",
|
||||
codes.Internal,
|
||||
"could not fetch volume group %q: %s",
|
||||
req.GetVolumeGroupId(),
|
||||
err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user