Repository navigation
fix(services): keep error classes through the service enable path - #882
Open
johnramsden wants to merge 2 commits into
Open
johnramsden wants to merge 2 commits into
johnramsden wants to merge 2 commits into
Conversation
johnramsden
added this pull request to stack #894
September 23, 2026 04:20
3 of 5 tasks
This was referenced Sep 23, 2026
johnramsden
marked this pull request as ready for review
September 23, 2026 04:29
johnramsden
force-pushed
the
rgw-stack/02-error-classes
branch
from
September 23, 2026 18:19
7d8d2ba to
74100ee
Compare
johnramsden
force-pushed
the
rgw-stack/02-error-classes
branch
from
September 24, 2026 19:32
74100ee to
78cd4e1
Compare
lmlg
approved these changes
Sep 24, 2026
sabaini
reviewed
Sep 29, 2026
sabaini
left a comment
Collaborator
There was a problem hiding this comment.
hm, the added test does not actually call cmdEnableServicePut() though, right?
possibly expand test coverage to handle this?
johnramsden
force-pushed
the
rgw-stack/02-error-classes
branch
from
September 29, 2026 18:43
78cd4e1 to
bb8e03e
Compare
Member
Author
|
See 11f7c1a |
EnableService in ceph/services_placement.go runs five phases for every
service: PopulateParams, HospitalityCheck, ServiceInit,
PostPlacementCheck and DbUpdate. It wrapped each phase's error with
fmt.Errorf("...: %v", err), which keeps the text but drops the error
value, so errors.Is could never classify the failure. The handler
cmdEnableServicePut in api/services.go then returned
mcTypes.SyncResponse(false, err), which answers HTTP 200 with an error
body regardless of what actually failed.
That is a real bug affecting every service enabled through this path
today, not just RGW: mon, mgr, mds, nfs, rgw, rbd-mirror and
cephfs-mirror all silently returned 200 on a failed enable. The phase
errors are now wrapped with %w so the error value survives, and
cmdEnableServicePut and cmdRGWServiceDelete answer through the new
serviceErrorResponse in api/services.go instead of the 200-returning
SyncResponse. A body that cannot be decoded is now a 400 instead of a
500.
The rest of the change is scaffolding for the RGW placement work later
in this series: ceph/placement.go gains two sentinel errors,
ErrRgwFrontendInvalid for a request the caller must fix and
ErrPlacementOperationFailed for a failure on the member, and
serviceErrorResponse maps them to 400 and 500. Nothing returns either
sentinel yet; they land now so the classification mechanism can be
reviewed on its own, separately from the RGW code that will first use
it, in "feat(rgw): make the member-side RGW apply safe to repeat".
Later, the placement reconcile pass added by "feat(placement):
reconcile RGW across the cluster" also classifies against these two
sentinels when it aggregates per-member RGW dispatch failures.
Two smaller changes in ceph/services_placement.go: PopulateParams now
runs before updateConfigFunc renders ceph.conf, so a request that
cannot be parsed changes nothing on disk. ServicePlacementHandler no
longer logs payload.Payload at debug level, which for RGW carries the
TLS private key.
Co-authored-by: Peter Sabaini <peter.sabaini@canonical.com>
Assisted-by: claude-code:claude-fable-5-1
Assisted-by: pi:gpt-6-astra
Signed-off-by: John Ramsden <john.ramsden@canonical.com>
Assisted-by: omp:openai/gpt-6-astra Signed-off-by: John Ramsden <john.ramsden@canonical.com>
johnramsden
force-pushed
the
rgw-stack/02-error-classes
branch
from
October 6, 2026 00:47
11f7c1a to
362240e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
EnableServiceinceph/services_placement.goruns five phases for every service:PopulateParams,HospitalityCheck,ServiceInit,PostPlacementCheckandDbUpdate. It wrapped each phase's error withfmt.Errorf("...: %v", err), which keeps the text but drops the error value, soerrors.Iscould never classify the failure. The handlercmdEnableServicePutinapi/services.gothen returnedmcTypes.SyncResponse(false, err), which answers HTTP 200 with an error body regardless of what actually failed.That is a real bug affecting every service enabled through this path today, not just RGW: mon, mgr, mds, nfs, rgw, rbd-mirror and cephfs-mirror all silently returned 200 on a failed enable. The phase errors are now wrapped with
%wso the error value survives, andcmdEnableServicePutandcmdRGWServiceDeleteanswer through the newserviceErrorResponseinapi/services.goinstead of the 200-returningSyncResponse. A body that cannot be decoded is now a 400 instead of a 500.The rest of the change is scaffolding for the RGW placement work later in this series:
ceph/placement.gogains two sentinel errors,ErrRgwFrontendInvalidfor a request the caller must fix andErrPlacementOperationFailedfor a failure on the member, andserviceErrorResponsemaps them to 400 and 500. Nothing returns either sentinel yet; they land now so the classification mechanism can be reviewed on its own, separately from the RGW code that will first use it.Two smaller changes:
PopulateParamsnow runs beforeupdateConfigFuncrendersceph.conf, so a request that cannot be parsed changes nothing on disk.ServicePlacementHandlerno longer logspayload.Payloadat debug level, which for RGW carries the TLS private key.Stack: PR 2 of 13. Merge in order. Each PR is one logical change on top of the one before it.
Type of change
How has this been tested?
Contributor checklist
Please check that you have: