-
Notifications
You must be signed in to change notification settings - Fork 560
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
rbd: Update return error message when delete volume failed #5138
Conversation
Thanks for taking this issue! Let us know if you have any questions! |
@Mergifyio rebase The build failures have been addressed. If all is well, the CI jobs should pass now. |
✅ Branch has been successfully rebased |
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.
Hi @ecosysbin, there are two minor CI failures that you need to address before we can get this merged:
- line length in the commit message should be < 80 characters, please add some line-breaks
- before each
return
statemens, golangci-lint expects an empty line
Please correct these things, and force-push your branch again. Ideally rebase your branch on the latest master, so that an unrelated build failure is prevented.
Thanks!
0a1b9cd
to
a441f0e
Compare
internal/rbd/rbd_util.go
Outdated
err = librbd.TrashRemove(ri.ioctx, ri.ImageID, true) | ||
if err != nil { | ||
log.ErrorLog(ctx, "failed to delete rbd image: %s, %v", ri, err) | ||
|
||
return err |
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.
Thanks for catching this and the pr !
Present code hides trash remove task error while the current pr changes hide trash remove error.
Let's just return both error when librbd.TrashRemove cmd fails like suggested below:
trashRemoveErr = librbd.TrashRemove(ri.ioctx, ri.ImageID, true)
if err != nil {
log.ErrorLog(ctx, "failed to delete rbd image: %s, %v", ri, trashRemoveErr)
return fmt.Errorf("failed to add task to remove image: %w, failed to trash remove image: %w",err, trashRemoveError)
I would be more comfortable with this kind of simple change.
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.
Ok, it's a good idea. I have done it.
internal/rbd/rbd_util.go
Outdated
} | ||
} | ||
|
||
return knownErr |
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.
This will involve similar changes as suggested with trash remove error.
internal/rbd/rbd_util.go
Outdated
} | ||
|
||
return knownErr |
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 is it required to return the knownErr
here? librbd.TrashRemove()
was a success, so the goal of the function (removing the image from the trash) was achieved.
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.
Ok, I have modify it.
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.
one more comment.
internal/rbd/rbd_util.go
Outdated
|
||
return knownErr |
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.
return knownErr |
This is not required since trashremove has done the job?
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.
ok,I have modified it
internal/rbd/rbd_util.go
Outdated
|
||
return knownErr |
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.
return knownErr |
This is not required since trashremove has done the job?
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.
Ok, I have done it.
1b63839
to
e9251fc
Compare
fce8eef
to
4160eb2
Compare
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.
Thanks! Looks good to me 👍
internal/rbd/rbd_util.go
Outdated
|
||
return err | ||
return fmt.Errorf("failed to add task to remove image: %v, failed to trash remove image: %v", knownErr, trashRemoveError) |
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.
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.
At the begin, It was set %w and it also show golangci-lint to fail, so I want to try %v. Now, I recovered to %w.
Pull request has been modified.
hey @ecosysbin
Please take a look. |
🛑 The pull request has been removed from the queue
|
/test ci/centos/k8s-e2e-external-storage/1.31 |
/test ci/centos/k8s-e2e-external-storage/1.30 |
/test ci/centos/mini-e2e-helm/k8s-1.31 |
/test ci/centos/mini-e2e-helm/k8s-1.30 |
/test ci/centos/mini-e2e/k8s-1.31 |
/test ci/centos/k8s-e2e-external-storage/1.32 |
/test ci/centos/mini-e2e/k8s-1.30 |
/test ci/centos/mini-e2e-helm/k8s-1.32 |
/test ci/centos/upgrade-tests-cephfs |
/test ci/centos/mini-e2e/k8s-1.32 |
/test ci/centos/upgrade-tests-rbd |
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks:
You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
@nixpanic I see the CI error shows 'Error cloning remote repo 'origin'', what can we do next step? |
/retest ci/centos/k8s-e2e-external-storage/1.32 |
I think its a CI issue, not due to this pr. |
/retest ci/centos/mini-e2e/k8s-1.32 |
@ecosysbin "ci/centos/mini-e2e/k8s-1.32" test failed. Logs are available at location for debugging |
/retest ci/centos/upgrade-tests-rbd |
@ecosysbin "ci/centos/upgrade-tests-rbd" test failed. Logs are available at location for debugging |
/retest ci/centos/mini-e2e/k8s-1.30 |
@ecosysbin "ci/centos/mini-e2e/k8s-1.30" test failed. Logs are available at location for debugging |
/retest ci/centos/upgrade-tests-cephfs |
@ecosysbin "ci/centos/upgrade-tests-cephfs" test failed. Logs are available at location for debugging |
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
Describe what this PR does
Issue: When delete pv failed, error message shows 'volume deletion failed: rpc error:
code = Internal desc = rbd: ret=-39, Directory not empty', the actual failed reason is 'access denied'
Fixes: #5132
This commit ensures ceph-csi return right error massage.