Skip to content

mgr/dashboard: add deprecation warning on ns add cli command - #70209

Merged
Hezko merged 1 commit into
ceph:mainfrom
Hezko:warn-on-deprecated-param
Jul 28, 2026
Merged

Hezko merged 1 commit into
ceph:mainfrom
Hezko:warn-on-deprecated-param

Conversation

@Hezko

@Hezko Hezko commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

The user will now have an indication when using a deprecated parameter.

[xxx@xxx ~]# ceph nvmeof namespace add --nqn nqn.2016-06.io.spdk:cnode1.mygroup1 --rbd_pool nvmeof --rbd_image_name image4 --create-image=true --size=10MB
Adding namespace 17 to nqn.2016-06.io.spdk:cnode1.mygroup1: Successful
Warning: --size is deprecated, please use --rbd-image-size


[xxx@xxx ~]# ceph nvmeof namespace add --nqn nqn.2016-06.io.spdk:cnode1.mygroup1 --rbd_pool nvmeof --rbd_image_name image4 --create-image=true --size=10MB
Error EINVAL: RBD image nvmeof/image4 is already used by a namespace with UUID 5fc1327b-efbb-4252-abeb-613276a1685f in subsystem nqn.2016-06.io.spdk:cnode1.mygroup1, group mygroup1, either delete the namespace or use the "force" argument,
you can find the offending namespace by using the "namespace list" CLI command on subsystem nqn.2016-06.io.spdk:cnode1.mygroup1
Warning: --size is deprecated, please use --rbd-image-size

Fixes: https://tracker.ceph.com/issues/78228

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@Hezko

Hezko commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Hezko
Hezko force-pushed the warn-on-deprecated-param branch 2 times, most recently from 08fc092 to 2ff2f71 Compare July 22, 2026 08:45
Comment on lines +501 to +502
out_format = cmd_dict.get('format')
args_map = self._args_map_from_argspec(cmd_dict, inbuf)

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.

Bug: _args_map_from_argspec was inside the try block before — it can throw on malformed args. Moving it out means those exceptions are now uncaught and will crash instead of returning HandleCommandResult(-EINVAL, '', str(e)).

Keep both lines inside try, init deprecated_warnings = '' before try, then compute warnings inside try right after args_map:

        deprecated_warnings = ''
        try:
            out_format = cmd_dict.get('format')
            args_map = self._args_map_from_argspec(cmd_dict, inbuf)

            if out_format == 'plain' or not out_format:
                for param, msg in self._deprecated_params.items():
                    if args_map.get(param) is not None:
                        deprecated_warnings += f"\nWarning: {msg}"

            ret = super().call(mgr, cmd_dict, inbuf)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

great catch! fixed and added a test for this case.
Thank you!

@github-project-automation github-project-automation Bot moved this from New to Review in progress in Ceph-Dashboard Jul 22, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 11:10
@Hezko
Hezko force-pushed the warn-on-deprecated-param branch from 2ff2f71 to 3723e76 Compare July 23, 2026 11:10
@Hezko
Hezko requested a review from afreen23 July 23, 2026 11:10

Copilot AI 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.

Pull request overview

Adds deprecation warnings when --size is used with NVMe-oF namespace creation commands.

Changes:

  • Adds reusable deprecated-parameter warning support.
  • Configures --size deprecation for namespace creation and its alias.
  • Adds unit tests for warning behavior and output formats.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/pybind/mgr/dashboard/services/nvmeof_cli.py Implements deprecated-parameter warnings.
src/pybind/mgr/dashboard/controllers/nvmeof.py Marks namespace size as deprecated.
src/pybind/mgr/dashboard/tests/test_nvmeof_cli.py Tests warning generation and error handling.

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

LGTM

@github-project-automation github-project-automation Bot moved this from Review in progress to Reviewer approved in Ceph-Dashboard Jul 27, 2026
Copilot AI review requested due to automatic review settings July 27, 2026 10:03
@Hezko
Hezko force-pushed the warn-on-deprecated-param branch from 3723e76 to 6ac6f8b Compare July 27, 2026 10:03

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 27, 2026 18:38
@Hezko
Hezko force-pushed the warn-on-deprecated-param branch from 6ac6f8b to 68ee29f Compare July 27, 2026 18:38

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 28, 2026 02:18
@Hezko
Hezko force-pushed the warn-on-deprecated-param branch from 68ee29f to 7368a64 Compare July 28, 2026 02:18

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 28, 2026 04:30
@Hezko
Hezko force-pushed the warn-on-deprecated-param branch from 7368a64 to c47b6f4 Compare July 28, 2026 04:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hezko

Hezko commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test docs

@Hezko
Hezko merged commit aac1f3c into ceph:main Jul 28, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in Ceph-Dashboard Jul 28, 2026
@Hezko
Hezko deleted the warn-on-deprecated-param branch July 28, 2026 06:25
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log aac1f3c478593208e0d3ab20c835704db5569b85^..aac1f3c478593208e0d3ab20c835704db5569b85

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/30334772823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants