Skip to content

nvmeof: fix dhchap key-value bug in rbd metadata#6085

Merged
mergify[bot] merged 1 commit into
ceph:develfrom
gadididi:nvmeof/bug_fix_dh_chap_key_error
Feb 18, 2026
Merged

nvmeof: fix dhchap key-value bug in rbd metadata#6085
mergify[bot] merged 1 commit into
ceph:develfrom
gadididi:nvmeof/bug_fix_dh_chap_key_error

Conversation

@gadididi

Copy link
Copy Markdown
Contributor

dh-chap key-value in rbd metadata was mandatory by mistake. it failed if dh-chap key was not found (in case of not using dh-chap feature..)
make it as optional.

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!)

dh-chap key-value in rbd metadata was mandatory by mistake.
it failed if dh-chap key was not found (in case of not using
dh-chap feature..)
make it as optional.

Signed-off-by: gadi-didi <gadi.didi@ibm.com>
@gadididi gadididi requested review from Copilot and nixpanic February 17, 2026 18:39
@gadididi gadididi self-assigned this Feb 17, 2026
@gadididi gadididi added bug Something isn't working component/nvme-of Issues and PRs related to NVMe-oF. ci/skip/e2e skip running e2e CI jobs labels Feb 17, 2026

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

Adjusts NVMe-oF RBD metadata retrieval so DH-CHAP-related metadata is treated as optional, avoiding failures when DH-CHAP is not in use.

Changes:

  • Splits NVMe-oF RBD metadata keys into required vs optional sets.
  • Skips missing/empty optional metadata keys instead of failing metadata retrieval.

Comment on lines +1208 to +1213
value, err := rbdVol.GetMetadata(key)
if err != nil {
log.DebugLog(ctx, "Optional metadata %s not found: %v", key, err)

continue
}

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

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

In the optional-metadata loop, any error from GetMetadata() is treated as “not found” and silently ignored. That can mask real failures (e.g., inability to open the image, permission/IO issues) and the log message becomes misleading. Consider only skipping errors that are errors.Is(err, librbd.ErrNotFound) and returning other errors (similar to patterns used elsewhere in the repo, e.g. internal/rbd/qos.go).

Copilot uses AI. Check for mistakes.
Comment on lines +1206 to +1220
// Optional metadata keys
for _, key := range optionalKeys {
value, err := rbdVol.GetMetadata(key)
if err != nil {
log.DebugLog(ctx, "Optional metadata %s not found: %v", key, err)

continue
}
if value == "" {
log.DebugLog(ctx, "Optional metadata %s is empty", key)

continue
}
metadata[key] = value
}

Copilot AI Feb 17, 2026

Copy link

Choose a reason for hiding this comment

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

This change alters behavior to allow missing DH-CHAP/KMSID metadata. There are unit tests in this package, but none appear to exercise getNVMeoFMetadata’s handling of absent optional keys. Consider adding a focused test (or refactoring the metadata-read/parsing logic into a helper that can be unit-tested with a fake types.Volume) to prevent regressions where missing optional metadata incorrectly fails volume cleanup/unpublish flows.

Copilot uses AI. Check for mistakes.
@nixpanic nixpanic requested a review from a team February 18, 2026 12:49
@mergify mergify Bot added the queued label Feb 18, 2026
mergify Bot added a commit that referenced this pull request Feb 18, 2026
@mergify

mergify Bot commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

Rule: default


This pull request spent 38 minutes 25 seconds in the queue, including 37 minutes 37 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of:
    • all of:
      • base=devel
      • status-success=codespell
      • status-success=go-test
      • status-success=golangci-lint
      • status-success=lint-extras
      • status-success=mod-check
      • status-success=multi-arch-build
      • status-success=uncommitted-code-check
      • any of:
        • label=ci/skip/e2e
        • all of:
          • status-success=ci/centos/k8s-e2e-external-storage/1.33
          • status-success=ci/centos/k8s-e2e-external-storage/1.34
          • status-success=ci/centos/k8s-e2e-external-storage/1.35
          • status-success=ci/centos/mini-e2e-helm/k8s-1.33
          • status-success=ci/centos/mini-e2e-helm/k8s-1.34
          • status-success=ci/centos/mini-e2e-helm/k8s-1.35
          • status-success=ci/centos/mini-e2e/k8s-1.33
          • status-success=ci/centos/mini-e2e/k8s-1.34
          • status-success=ci/centos/mini-e2e/k8s-1.35
          • status-success=ci/centos/upgrade-tests-cephfs
          • status-success=ci/centos/upgrade-tests-rbd
    • all of:
      • base~=^(release-.+)$
      • status-success=codespell
      • status-success=go-test
      • status-success=golangci-lint
      • status-success=lint-extras
      • status-success=mod-check
      • status-success=multi-arch-build
      • status-success=uncommitted-code-check
      • any of:
        • label=ci/skip/e2e
        • all of:
          • status-success=ci/centos/k8s-e2e-external-storage/1.32
          • status-success=ci/centos/mini-e2e-helm/k8s-1.32
          • status-success=ci/centos/mini-e2e/k8s-1.32
          • status-success=ci/centos/k8s-e2e-external-storage/1.33
          • status-success=ci/centos/k8s-e2e-external-storage/1.34
          • status-success=ci/centos/mini-e2e-helm/k8s-1.33
          • status-success=ci/centos/mini-e2e-helm/k8s-1.34
          • status-success=ci/centos/mini-e2e/k8s-1.33
          • status-success=ci/centos/mini-e2e/k8s-1.34
          • status-success=ci/centos/upgrade-tests-cephfs
          • status-success=ci/centos/upgrade-tests-rbd
    • all of:
      • base=release-v3.15
      • status-success=codespell
      • status-success=go-test
      • status-success=golangci-lint
      • status-success=lint-extras
      • status-success=mod-check
      • status-success=multi-arch-build
      • status-success=uncommitted-code-check
      • any of:
        • label=ci/skip/e2e
        • all of:
          • status-success=ci/centos/k8s-e2e-external-storage/1.31
          • status-success=ci/centos/k8s-e2e-external-storage/1.32
          • status-success=ci/centos/mini-e2e-helm/k8s-1.31
          • status-success=ci/centos/mini-e2e-helm/k8s-1.32
          • status-success=ci/centos/mini-e2e/k8s-1.31
          • status-success=ci/centos/mini-e2e/k8s-1.32
          • status-success=ci/centos/k8s-e2e-external-storage/1.33
          • status-success=ci/centos/mini-e2e-helm/k8s-1.33
          • status-success=ci/centos/mini-e2e/k8s-1.33
          • status-success=ci/centos/upgrade-tests-cephfs
          • status-success=ci/centos/upgrade-tests-rbd
    • all of:
      • base=ci/centos
      • status-success=ci/centos/jjb-validate
      • status-success=ci/centos/job-validation

@mergify mergify Bot merged commit 18436b6 into ceph:devel Feb 18, 2026
34 checks passed
@mergify mergify Bot removed the queued label Feb 18, 2026
@gadididi gadididi deleted the nvmeof/bug_fix_dh_chap_key_error branch February 18, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci/skip/e2e skip running e2e CI jobs component/nvme-of Issues and PRs related to NVMe-oF.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants