mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +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>
This commit is contained in:
committed by
mergify[bot]
parent
ca1ccdd9bf
commit
18a62ec9de
@ -18,6 +18,7 @@ package group
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
@ -69,6 +70,12 @@ func GetVolumeGroupSnapshot(
|
||||
|
||||
attrs, err := vgs.getVolumeGroupAttributes(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrRBDGroupNotFound) {
|
||||
log.ErrorLog(ctx, "%v, returning empty volume group snapshot %q", vgs, err)
|
||||
|
||||
return vgs, err
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("failed to get volume attributes for id %q: %w", vgs, err)
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ func (cvg *commonVolumeGroup) getVolumeGroupAttributes(ctx context.Context) (*jo
|
||||
attrs = &journal.VolumeGroupAttributes{}
|
||||
}
|
||||
|
||||
if attrs.GroupName == "" || attrs.CreationTime == nil {
|
||||
if attrs.GroupName == "" {
|
||||
log.ErrorLog(ctx, "volume group with id %v not found", cvg.id)
|
||||
|
||||
return nil, ErrRBDGroupNotFound
|
||||
|
@ -77,7 +77,7 @@ func GetVolumeGroup(
|
||||
|
||||
attrs, err := vg.getVolumeGroupAttributes(ctx)
|
||||
if err != nil {
|
||||
if errors.Is(err, librbd.ErrNotFound) {
|
||||
if errors.Is(err, ErrRBDGroupNotFound) {
|
||||
log.ErrorLog(ctx, "%v, returning empty volume group %q", vg, err)
|
||||
|
||||
return vg, err
|
||||
|
Reference in New Issue
Block a user