-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util: return correct status code for VolumeGroupSnapshot #5024
Conversation
@Madhu-1 updated the ControllerGetVolumeGroup as well, to differentiate the case of internal errors vs actual not found errors, please take a look now. |
bf9292a
to
f7ed505
Compare
@@ -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.DebugLog(ctx, "VolumeGroup %q doesn't exists", req.GetVolumeGroupId()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log it as error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are logging it as error in previous functions, hence just added it as a DebugLog
instead so that only if required these should be logged. Do you think we should log it anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be fine we should log it as error here as well.
internal/rbd/group/group_snapshot.go
Outdated
@@ -69,6 +71,12 @@ func GetVolumeGroupSnapshot( | |||
|
|||
attrs, err := vgs.getVolumeGroupAttributes(ctx) | |||
if err != nil { | |||
if errors.Is(err, librbd.ErrNotFound) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we can get this error condition met? i don't think getVolumeGroupAttributes
directly return librbd error can you please check on this one again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are adding the librbd.ErrNotFound
error to ErrRBDGroupNotFound
error here:
ErrRBDGroupNotFound = fmt.Errorf("%w: RBD group not found", librbd.ErrNotFound) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets compare this with ErrRBDGroupNotFound
instead of librbd.ErrNotFound
as getVolumeGroupAttributes
is returning ErrRBDGroupNotFound
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, missed that change.
Updated it now.
@@ -229,10 +238,20 @@ func (cs *ControllerServer) GetVolumeGroupSnapshot( | |||
|
|||
groupSnapshot, err := mgr.GetVolumeGroupSnapshotByID(ctx, groupSnapshotID) | |||
if err != nil { | |||
if errors.Is(err, group.ErrRBDGroupNotFound) { | |||
log.DebugLog(ctx, "VolumeGroupSnapshot %q doesn't exists", groupSnapshotID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log as error
21b0954
to
87acd2b
Compare
@Nikhil-Ladha, do we need to back port this to |
Yeah, we should backport this along with the previous PR. |
@Mergifyio backport release-v3.13 |
❌ Command disallowed due to command restrictions in the Mergify configuration.
|
I don't seem to have permissions to do so :/ |
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 18a62ec |
Fix status codes that are returned for Get/Delete RPC calls for VolumeGroup/VolumeGroupSnapshot. Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
87acd2b
to
851e4d1
Compare
/test ci/centos/k8s-e2e-external-storage/1.29 |
/test ci/centos/mini-e2e-helm/k8s-1.29 |
/test ci/centos/mini-e2e/k8s-1.29 |
/test ci/centos/k8s-e2e-external-storage/1.31 |
/test ci/centos/k8s-e2e-external-storage/1.30 |
/test ci/centos/upgrade-tests-cephfs |
/test ci/centos/mini-e2e-helm/k8s-1.31 |
/test ci/centos/mini-e2e-helm/k8s-1.30 |
/test ci/centos/upgrade-tests-rbd |
/test ci/centos/mini-e2e/k8s-1.31 |
/test ci/centos/mini-e2e/k8s-1.30 |
Sure, lets merge this first then will backport both in order. |
Fix status codes that are returned for Get/Delete RPC calls for VolumeGroup/VolumeGroupSnapshot.