mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rbd: return group not found error for Get,Delete RPC calls
We should return NotFound status if the group doesn't exists for ControllerGetVolumeGroup RPC call. And, an empty/OK response for DeleteVolumeGroup if the group doesn't exists Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
53d5eda020
commit
c7d54ab776
@ -18,10 +18,12 @@ package rbd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
"github.com/ceph/ceph-csi/internal/rbd"
|
||||
"github.com/ceph/ceph-csi/internal/rbd/group"
|
||||
"github.com/ceph/ceph-csi/internal/rbd/types"
|
||||
"github.com/ceph/ceph-csi/internal/util/log"
|
||||
|
||||
@ -192,9 +194,15 @@ func (vs *VolumeGroupServer) DeleteVolumeGroup(
|
||||
// resolve the volume group
|
||||
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())
|
||||
|
||||
return &volumegroup.DeleteVolumeGroupResponse{}, nil
|
||||
}
|
||||
|
||||
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