Skip to content
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

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

ecosysbin
Copy link

@ecosysbin ecosysbin commented Feb 12, 2025

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.

@mergify mergify bot added the component/rbd Issues related to RBD label Feb 12, 2025
@ecosysbin ecosysbin changed the title rbd: Update return error massage when delete volume failed and the fu… rbd: Update return error massage when delete volume failed Feb 12, 2025
Copy link

Thanks for taking this issue! Let us know if you have any questions!

@nixpanic
Copy link
Member

@Mergifyio rebase

The build failures have been addressed. If all is well, the CI jobs should pass now.

Copy link
Contributor

mergify bot commented Feb 13, 2025

rebase

✅ Branch has been successfully rebased

@nixpanic nixpanic changed the title rbd: Update return error massage when delete volume failed rbd: Update return error message when delete volume failed Feb 13, 2025
Copy link
Member

@nixpanic nixpanic left a 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:

  1. line length in the commit message should be < 80 characters, please add some line-breaks
  2. 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!

@ecosysbin ecosysbin force-pushed the devel branch 3 times, most recently from 0a1b9cd to a441f0e Compare February 14, 2025 02:24
Comment on lines 720 to 726
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
Copy link
Contributor

@Rakshith-R Rakshith-R Feb 14, 2025

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.

Copy link
Author

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.

}
}

return knownErr
Copy link
Contributor

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.

}

return knownErr
Copy link
Member

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.

Copy link
Author

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.

Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more comment.

Comment on lines 726 to 727

return knownErr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return knownErr

This is not required since trashremove has done the job?

Copy link
Author

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

Comment on lines 891 to 892

return knownErr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return knownErr

This is not required since trashremove has done the job?

Copy link
Author

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.

@ecosysbin ecosysbin force-pushed the devel branch 2 times, most recently from 1b63839 to e9251fc Compare February 14, 2025 09:12
@ecosysbin ecosysbin requested a review from Rakshith-R February 14, 2025 09:18
@ecosysbin ecosysbin force-pushed the devel branch 2 times, most recently from fce8eef to 4160eb2 Compare February 14, 2025 10:17
nixpanic
nixpanic previously approved these changes Feb 14, 2025
Copy link
Member

@nixpanic nixpanic left a 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 👍


return err
return fmt.Errorf("failed to add task to remove image: %v, failed to trash remove image: %v", knownErr, trashRemoveError)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to use %w for error formatting, not %v. This causes golangci-lint to fail:

image

Copy link
Author

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.

@mergify mergify bot dismissed nixpanic’s stale review February 15, 2025 00:58

Pull request has been modified.

@Rakshith-R
Copy link
Contributor

hey @ecosysbin
There's golangci lint failure
https://github.com/ceph/ceph-csi/actions/runs/13340136953/job/37320372109?pr=5138

internal/rbd/rbd_util.go:724: the line is 124 characters long, which exceeds the maximum of 120 characters. (lll)
level=info msg="[runner] Processors filtering stat (in/out): diff: 1/1, max_same_issues: 1/1, path_prefixer: 1/1, cgo: 381/294, path_prettifier: 294/294, skip_files: 294/294, max_per_file_from_linter: 1/1, path_shortener: 1/1, severity-rules: 1/1, invalid_issue: 294/294, exclude: 294/294, uniq_by_line: 1/1, nolint: 228/1, max_from_linter: 1/1, fixer: 1/1, skip_dirs: 294/294, autogenerated_exclude: 294/294, exclude-rules: 294/228, sort_results: 1/1, filename_unadjuster: 294/294, identifier_marker: 294/294, source_code: 1/1"
			return fmt.Errorf("failed to add task to remove image: %w, failed to trash remove image: %w", knownErr, trashRemoveError)

Please take a look.

Copy link
Contributor

mergify bot commented Feb 19, 2025

queue

🛑 The pull request has been removed from the queue default

The merge conditions cannot be satisfied due to failing checks.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

@mergify mergify bot added the ok-to-test Label to trigger E2E tests label Feb 19, 2025
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.31

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.30

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.31

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.30

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.31

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.32

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.30

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.32

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.32

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Feb 19, 2025
Copy link
Contributor

mergify bot commented Feb 19, 2025

This pull request has been removed from the queue for the following reason: checks failed.

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: @mergifyio requeue

@ecosysbin
Copy link
Author

@nixpanic I see the CI error shows 'Error cloning remote repo 'origin'', what can we do next step?
ERROR: Error cloning remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting

@Rakshith-R
Copy link
Contributor

/retest ci/centos/k8s-e2e-external-storage/1.32

@Rakshith-R
Copy link
Contributor

@nixpanic I see the CI error shows 'Error cloning remote repo 'origin'', what can we do next step? ERROR: Error cloning remote repo 'origin' ERROR: Maximum checkout retry attempts reached, aborting

I think its a CI issue, not due to this pr.
We'll take care of this.

@Rakshith-R Rakshith-R added the ci/retry/e2e Label to retry e2e retesting on approved PR's label Feb 19, 2025
@ceph-csi-bot
Copy link
Collaborator

/retest ci/centos/mini-e2e/k8s-1.32

@ceph-csi-bot
Copy link
Collaborator

@ecosysbin "ci/centos/mini-e2e/k8s-1.32" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

/retest ci/centos/upgrade-tests-rbd

@ceph-csi-bot
Copy link
Collaborator

@ecosysbin "ci/centos/upgrade-tests-rbd" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

/retest ci/centos/mini-e2e/k8s-1.30

@ceph-csi-bot
Copy link
Collaborator

@ecosysbin "ci/centos/mini-e2e/k8s-1.30" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

/retest ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

@ecosysbin "ci/centos/upgrade-tests-cephfs" test failed. Logs are available at location for debugging

@ceph-csi-bot
Copy link
Collaborator

@Mergifyio requeue

Copy link
Contributor

mergify bot commented Feb 19, 2025

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

@mergify mergify bot merged commit 0907ba9 into ceph:devel Feb 19, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/retry/e2e Label to retry e2e retesting on approved PR's component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message is not right when delete pv failed
4 participants