File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,12 @@ package rbd
1818
1919import (
2020 "context"
21+ "errors"
2122 "fmt"
2223 "slices"
2324
2425 "github.com/ceph/ceph-csi/internal/rbd"
26+ "github.com/ceph/ceph-csi/internal/rbd/group"
2527 "github.com/ceph/ceph-csi/internal/rbd/types"
2628 "github.com/ceph/ceph-csi/internal/util/log"
2729
@@ -192,9 +194,15 @@ func (vs *VolumeGroupServer) DeleteVolumeGroup(
192194 // resolve the volume group
193195 vg , err := mgr .GetVolumeGroupByID (ctx , req .GetVolumeGroupId ())
194196 if err != nil {
197+ if errors .Is (err , group .ErrRBDGroupNotFound ) {
198+ log .DebugLog (ctx , "VolumeGroup %q doesn't exists" , req .GetVolumeGroupId ())
199+
200+ return & volumegroup.DeleteVolumeGroupResponse {}, nil
201+ }
202+
195203 return nil , status .Errorf (
196- codes .NotFound ,
197- "could not find volume group %q: %s" ,
204+ codes .Internal ,
205+ "could not fetch volume group %q: %s" ,
198206 req .GetVolumeGroupId (),
199207 err .Error ())
200208 }
Original file line number Diff line number Diff line change @@ -145,6 +145,12 @@ func (cvg *commonVolumeGroup) getVolumeGroupAttributes(ctx context.Context) (*jo
145145 attrs = & journal.VolumeGroupAttributes {}
146146 }
147147
148+ if attrs .GroupName == "" || attrs .CreationTime == nil {
149+ log .ErrorLog (ctx , "volume group with id %v not found" , cvg .id )
150+
151+ return nil , ErrRBDGroupNotFound
152+ }
153+
148154 cvg .requestName = attrs .RequestName
149155 cvg .name = attrs .GroupName
150156 cvg .creationTime = attrs .CreationTime
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
2222 "fmt"
2323
2424 "github.com/ceph/go-ceph/rados"
25+ librados "github.com/ceph/go-ceph/rados"
2526 librbd "github.com/ceph/go-ceph/rbd"
2627 "github.com/container-storage-interface/spec/lib/go/csi"
2728 "github.com/csi-addons/spec/lib/go/volumegroup"
@@ -31,7 +32,10 @@ import (
3132 "github.com/ceph/ceph-csi/internal/util/log"
3233)
3334
34- var ErrRBDGroupNotConnected = errors .New ("RBD group is not connected" )
35+ var (
36+ ErrRBDGroupNotConnected = fmt .Errorf ("%w: RBD group is not connected" , librados .ErrNotConnected )
37+ ErrRBDGroupNotFound = fmt .Errorf ("%w: RBD group not found" , librbd .ErrNotFound )
38+ )
3539
3640// volumeGroup handles all requests for 'rbd group' operations.
3741type volumeGroup struct {
You can’t perform that action at this time.
0 commit comments