Skip to content

cleanup: validate unknown parameters in ControllerModifyVolume - #6458

Open
nixpanic wants to merge 2 commits into
ceph:develfrom
nixpanic:ControllerModifyVolume/InvalidArgument
Open

cleanup: validate unknown parameters in ControllerModifyVolume#6458
nixpanic wants to merge 2 commits into
ceph:develfrom
nixpanic:ControllerModifyVolume/InvalidArgument

Conversation

@nixpanic

@nixpanic nixpanic commented Aug 5, 2026

Copy link
Copy Markdown
Member

Add validation to reject unknown mutable parameters in ControllerModifyVolume.
Previously, unknown parameters were silently ignored, which could lead to
confusion when users specify incorrect parameter names.

Related: #6443

@nixpanic
nixpanic requested review from a team and gadididi August 5, 2026 11:23
@mergify mergify Bot added the cleanup label Aug 5, 2026
@nixpanic nixpanic added component/nfs Issues related to NFS component/nvme-of Issues and PRs related to NVMe-oF. labels Aug 5, 2026
Rakshith-R
Rakshith-R previously approved these changes Aug 5, 2026
black-dragon74
black-dragon74 previously approved these changes Aug 5, 2026
Comment thread internal/nvmeof/controller/controllerserver.go Outdated

@iPraveenParihar iPraveenParihar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

few questions

Comment thread internal/nvmeof/controller/controllerserver.go Outdated
Comment thread internal/nfs/controller/controllerserver.go Outdated
@black-dragon74
black-dragon74 dismissed their stale review August 5, 2026 12:14

Outstanding reviews.

Comment thread internal/nvmeof/controller/controllerserver.go Outdated
@nixpanic
nixpanic force-pushed the ControllerModifyVolume/InvalidArgument branch from 3471981 to 3f7d560 Compare August 5, 2026 16:06
@mergify
mergify Bot dismissed Rakshith-R’s stale review August 5, 2026 16:10

Pull request has been modified.

@nixpanic
nixpanic force-pushed the ControllerModifyVolume/InvalidArgument branch from 3f7d560 to 218c870 Compare August 5, 2026 18:20
@nixpanic
nixpanic requested a review from a team as a code owner August 5, 2026 18:20
Comment thread internal/nvmeof/controller/controllerserver.go Outdated
Comment thread internal/nvmeof/controller/controllerserver.go Outdated
Comment thread internal/nvmeof/controller/controllerserver.go Outdated
Comment on lines +295 to +306
// Validate that only known parameters are provided (before any I/O)
knownParams := []string{
nfs.ParameterServer,
nfs.ParameterClients,
}

for param := range req.GetMutableParameters() {
if !slices.Contains(knownParams, param) {
return nil, status.Errorf(codes.InvalidArgument,
"unknown mutable parameter: %s", param)
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we need to have similar check before creating the subvolume or else we need a defer to cleanup the subvolume if anything fails after creation, i prefer to have input validation before loop of create/delete

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Currently CephFS does not support mutable parameters. But, well, #6390 is almost there now too. I'll add the extra checks/filtering in CreateVolume too, similar as what is done for nvmeof.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is done in the last update of this PR.

Copilot AI lite review requested due to automatic review settings August 6, 2026 08:29
@nixpanic
nixpanic force-pushed the ControllerModifyVolume/InvalidArgument branch from 218c870 to 6eca8d5 Compare August 6, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds explicit validation for unknown mutable_parameters keys in ControllerModifyVolume (and NVMe-oF CreateVolume request validation), to avoid silently accepting typos/mistakes in VolumeAttributesClass mutable parameters.

Changes:

  • NVMe-oF: validate ControllerModifyVolume and CreateVolume request mutable_parameters to reject unknown keys.
  • NVMe-oF: avoid passing MutableParameters through to the RBD backend CreateVolume call.
  • NFS: avoid passing MutableParameters through to the CephFS backend CreateVolume call; validate ControllerModifyVolume mutable parameters.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/nvmeof/controller/controllerserver.go Adds allowlist validation for NVMe-oF mutable parameters and strips mutable parameters from the RBD backend create request.
internal/nfs/controller/controllerserver.go Strips mutable parameters from the CephFS backend create request and adds allowlist validation for NFS mutable parameters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/nfs/controller/controllerserver.go
Comment thread internal/nvmeof/controller/controllerserver.go
Comment thread internal/nvmeof/controller/controllerserver.go
gadididi
gadididi previously approved these changes Aug 6, 2026

@gadididi gadididi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good thanks!

@nixpanic

nixpanic commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

The NFS Controller gets parameters with CreateVolume, but should not pass these parameters on to CephFS CreateVolume. However, those parameters are critical for NFS functioning correctly, so those parameters need to be stored in the VolumeContext of the volume that the CephFS CreateVolume procedure returns.

Working on correcting this.

@nixpanic
nixpanic force-pushed the ControllerModifyVolume/InvalidArgument branch from 20e6097 to 5977885 Compare August 7, 2026 12:40
@nixpanic
nixpanic requested a review from Madhu-1 August 7, 2026 12:41
@mergify
mergify Bot dismissed stale reviews from Madhu-1 and iPraveenParihar August 7, 2026 12:41

Pull request has been modified.

@nixpanic

nixpanic commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

/retest ci/centos/mini-e2e/k8s-1.37/cephfs

@nixpanic
nixpanic requested review from a team August 7, 2026 14:53
@nixpanic

nixpanic commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

@iPraveenParihar and @Madhu-1 , this PR should be ready now. NFS (and CephFS) passes e2e now too.

Once this is merged, run @mergifyio rebase on #6390 and queue is for e2e+merging again.

@nixpanic

nixpanic commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

@Mergifyio rebase

@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

rebase

🛑 The pull request rule doesn't match anymore

Details

This action has been cancelled.

Filter out NFS-specific mutable parameters (server, clients) before
passing the request to the CephFS backend. NFS handles these parameters
separately through ControllerModifyVolume.

This prevents the CephFS backend from receiving parameters it doesn't
understand, which would cause validation errors.

Assisted-by: AskBob <askbob@ibm.com>
Signed-off-by: Niels de Vos <ndevos@ibm.com>
Add validation for unknown mutable parameters in ControllerModifyVolume
to catch configuration errors early.

Create a shared nvmeofMutableParams slice to define all valid NVMe-oF
mutable parameters in one place, eliminating code duplication.

Filter out NVMe-oF-specific mutable parameters before passing the
request to the RBD backend. NVMe-oF handles these parameters separately
through ControllerModifyVolume.

This prevents the RBD backend from receiving parameters it doesn't
understand, which would cause validation errors.

Remove redundant rbd.HasQoSParams() checks that became dead code after
the validation was moved earlier in the flow.

Assisted-by: AskBob <askbob@ibm.com>
Signed-off-by: Niels de Vos <ndevos@ibm.com>
@ceph-csi-bot
ceph-csi-bot force-pushed the ControllerModifyVolume/InvalidArgument branch from 5977885 to b0daf72 Compare August 7, 2026 16:19
@nixpanic nixpanic added the ok-to-test Label to trigger E2E tests label Aug 7, 2026
@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot ceph-csi-bot added ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. and removed ok-to-test Label to trigger E2E tests labels Aug 7, 2026
@mergify mergify Bot removed the ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup component/nfs Issues related to NFS component/nvme-of Issues and PRs related to NVMe-oF.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants