Skip to content

nvmeof: Add external client support #6251

Merged
mergify[bot] merged 2 commits into
ceph:develfrom
gadididi:nvmeof/external_clients
Jun 3, 2026
Merged

nvmeof: Add external client support #6251
mergify[bot] merged 2 commits into
ceph:develfrom
gadididi:nvmeof/external_clients

Conversation

@gadididi

@gadididi gadididi commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

@nixpanic

Add external client support

Support allowHostNQNs in VAC for external (non-K8s) clients. Hosts can be managed via mutable parameters.
Add host reconciliation logic (add/remove) for NVMe-oF subsystems.
auto-generate subsystem NQN if not provided (for external Client- they have dedicated StorageClass, without SubsystemNQN label) .

In this design, each PVC gets its own NVMe-oF subsystem. That means:

  • One subsystem per namespace (PVC): When a new PVC is created, a unique NVMe-oF subsystem is also created for it (if no provided SubsystemNQN in the SC) .
  • Isolation: Each volume is isolated at the NVMe-oF layer - no sharing of subsystems between volumes by default - prevent external hosts access storage to each other, we dont want to leave the responsibly to the client!
  • Access control: Only hosts explicitly added to that subsystem (via allowHostNQNs in VAC) can access the volume.

issue: #6240

Checklist:

  • Commit Message Formatting: Commit titles and messages follow
    guidelines in the developer
    guide
    .
  • Reviewed the developer guide on Submitting a Pull
    Request
  • Pending release
    notes

    updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@mergify mergify Bot added the component/nvme-of Issues and PRs related to NVMe-oF. label Apr 26, 2026
@gadididi gadididi force-pushed the nvmeof/external_clients branch 2 times, most recently from ba8d811 to 9e8560e Compare April 27, 2026 08:01
@gadididi gadididi changed the title nvmeof: external clients [WIP] nvmeof: Add external client support Apr 27, 2026
@gadididi gadididi requested a review from nixpanic April 27, 2026 09:15
@gadididi gadididi marked this pull request as ready for review April 27, 2026 09:20
@gadididi gadididi force-pushed the nvmeof/external_clients branch from 9e8560e to b22de20 Compare April 27, 2026 10:14
@gadididi gadididi self-assigned this Apr 27, 2026
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 thread internal/nvmeof/nvmeof.go Outdated
Comment thread internal/nvmeof/volume.go
@gadididi gadididi force-pushed the nvmeof/external_clients branch from b22de20 to d9bc798 Compare April 29, 2026 08:25
@gadididi gadididi requested review from Rakshith-R and nixpanic April 29, 2026 10:44
@gadididi

gadididi commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

This PR is not tested yet. There is an issue in ODF Jenkins. Once it will resolve I will test this PR.

UPDATE:
I tested this PR. all goes smoothly.

@gadididi gadididi force-pushed the nvmeof/external_clients branch from d9bc798 to 6f8aef8 Compare April 30, 2026 09:52
Comment thread internal/nvmeof/controller/controllerserver.go
@gadididi gadididi requested a review from nixpanic May 10, 2026 06:47
@gadididi gadididi added the keepalive This label can be used to disable stale bot activiity in the repo label May 10, 2026
@gadididi gadididi force-pushed the nvmeof/external_clients branch from 6f8aef8 to d8185d1 Compare May 13, 2026 11:40
@gadididi gadididi requested a review from Copilot May 13, 2026 11:40

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 extends the NVMe-oF controller path to better support external (non-Kubernetes) clients by making subsystem host access mutable via VolumeAttributesClass parameters and by auto-generating a subsystem NQN when one is not provided.

Changes:

  • Auto-generate a default NVMe-oF subsystem NQN during CreateVolume when subsystemNQN is not provided.
  • Add gateway-side host listing and host reconciliation (add/remove) to match a desired allowHostNQNs list.
  • Extend ControllerModifyVolume() to handle both QoS updates and host allow-list updates, using a shared gateway-connection helper.

Reviewed changes

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

File Description
internal/nvmeof/volume.go Makes subsystemNQN optional by generating a default based on volumeID.
internal/nvmeof/volume_test.go Adds coverage for default subsystem NQN generation when missing.
internal/nvmeof/nvmeof.go Adds ListHosts() and UpdateHostsForSubsystem() reconciliation logic.
internal/nvmeof/controller/controllerserver.go Parses allowHostNQNs, wires host/QoS updates into ControllerModifyVolume, and passes volumeID for default NQN generation.
Comments suppressed due to low confidence (1)

internal/nvmeof/controller/controllerserver.go:1121

  • The comment for AllowHostNQNs documents that users can set the value to "" to allow any host, but parseHostsParameters only accepts a YAML list of strings and will fail to parse "". Either implement explicit support for the wildcard value (and define how it maps to gateway behavior), or update the documentation/validation to disallow it.
// AllowHostNQNs is the VolumeAttributesClass mutable parameter key for specifying
// a YAML list of host NQNs to allow access to a volume. Use "*" to allow any host.
// Example:
//
//	allowHostNQNs: |
//	  - nqn.2014-08.org.nvmexpress:host1
//	  - nqn.2014-08.org.nvmexpress:host2
const AllowHostNQNs = "allowHostNQNs"

Comment thread internal/nvmeof/controller/controllerserver.go Outdated
Comment thread internal/nvmeof/controller/controllerserver.go

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

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

Comments suppressed due to low confidence (2)

internal/nvmeof/controller/controllerserver.go:561

  • parseHostsParameters returns a nil slice when allowHostNQNs is present but empty. Downstream callers use hostsList != nil to decide whether to reconcile, so setting allowHostNQNs: "" cannot remove all currently-allowed hosts (it is treated like the parameter is absent). Return a non-nil empty slice (or return an explicit present boolean) when the key exists but is empty so ControllerModifyVolume can reconcile to an empty allow-list.
func parseHostsParameters(params map[string]string) ([]string, error) {
	allowHostNQNs, exists := params[AllowHostNQNs]
	if !exists {
		return nil, nil
	}
	var allowHostsList []string
	if allowHostNQNs == "" {
		return allowHostsList, nil
	}

internal/nvmeof/controller/mutable_params_test.go:175

  • The test case for empty allowHostNQNs currently expects a nil slice, which matches the current parsing but also hides the need to distinguish “parameter present but empty list” from “parameter absent”. Update this test to expect a non-nil empty slice (or otherwise assert the presence semantics) so regressions in host reconciliation (clearing all hosts) are caught.

Comment thread internal/nvmeof/controller/controllerserver.go
Comment thread internal/nvmeof/nvmeof.go
@gadididi gadididi force-pushed the nvmeof/external_clients branch 2 times, most recently from 852fd6c to b16bc7d Compare May 13, 2026 13:56
@gadididi gadididi requested a review from a team May 14, 2026 07:14

@nixpanic nixpanic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good, just one unit-test is missing.

Comment thread internal/nvmeof/controller/controllerserver.go
@nixpanic

nixpanic commented Jun 3, 2026

Copy link
Copy Markdown
Member

Wait for #6314 to be merged, then @mergifyio rebase and after rebasing is complete, add the ok-to-test label for automatic merging.

@iPraveenParihar

Copy link
Copy Markdown
Contributor

@Mergifyio rebase

gadididi added 2 commits June 3, 2026 10:05
Extracted common gateway connection logic
into `withGatewayConnection()` helper to avoid code duplication
between QoS and host management operations (in the next commit).

The helper manages:
- Secret retrieval
- NVMe-oF metadata extraction from volume
- Gateway connection with automatic cleanup
- Operation execution via callback function
Refactored modifyNVMeoFQoS to use the new helper.

Signed-off-by: gadi-didi <gadi.didi@ibm.com>
Implements dynamic host access control for NVMe-oF volumes to support
external(non-Kubernetes) clients through VolumeAttributesClass.

Changes:
- Add `parseHostsParameters()` to parse YAML host list from VAC
- Implement `modifyNVMeoFHosts()` for runtime host updates
- Add `ListHosts()` and `UpdateHostsForSubsystem()` for host updateing
- Support allowHostNQNs parameter in CreateVolume and ControllerModifyVolume
- Auto-generate subsystem NQN from volumeID if not provided

Users can now specify external hosts in VAC mutable parameters:
  allowHostNQNs: |
    - nqn.2014-08.org.nvmexpress:host1
    - nqn.2014-08.org.nvmexpress:host2

Signed-off-by: gadi-didi <gadi.didi@ibm.com>
@ceph-csi-bot ceph-csi-bot force-pushed the nvmeof/external_clients branch from c686822 to c754bd6 Compare June 3, 2026 10:05
@mergify

mergify Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

rebase

✅ Branch has been successfully rebased

@gadididi gadididi added the ok-to-test Label to trigger E2E tests label Jun 3, 2026
@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/k8s-e2e-external-storage/1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-rbd

@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.33

@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.33

@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.33

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

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

@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 Jun 3, 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 Jun 3, 2026
@mergify

mergify Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Deprecation notice: This pull request comes from a fork and was queued with update_method=rebase and update_bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the merge queue will no longer be able to rebase fork pull requests with this configuration. To avoid disruption, switch to update_method=merge in your queue rule.

@mergify mergify Bot added the queued label Jun 3, 2026
@mergify

mergify Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-06-03 13:39 UTC · Rule: default
  • Checks skipped · PR is already up-to-date
  • Merged2026-06-03 13:40 UTC · at c754bd636f18170f18dd9d48edd7c7d1f6250836 · rebase

This pull request spent 58 seconds in the queue, including 9 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit 734c5b1 into ceph:devel Jun 3, 2026
44 checks passed
@gadididi gadididi deleted the nvmeof/external_clients branch June 3, 2026 13:41
@mergify mergify Bot removed the queued label Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/nvme-of Issues and PRs related to NVMe-oF. keepalive This label can be used to disable stale bot activiity in the repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants