Skip to content

pybind/ceph_argparse: enforce non-empty validation and clean CLI error output - #69386

Open
joscollin wants to merge 4 commits into
ceph:mainfrom
joscollin:wip-58645-fix-error-when-creating-subvolume
Open

joscollin wants to merge 4 commits into
ceph:mainfrom
joscollin:wip-58645-fix-error-when-creating-subvolume

Conversation

@joscollin

@joscollin joscollin commented Jun 10, 2026 •

Copy link
Copy Markdown
Member

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

  • Updates CephString.valid() in ceph_argparse.py to reject literal empty string inputs ("") whenever strict validation rules (goodchars) are active, preventing malformed creation commands from silently passing it.
  • Refactors CephString validation exceptions to be better readable.
  • Modifies volumes/module.py to explicitly apply the goodchars regex string filtering pattern to the optional group_name parameter signature, ensuring subvolume group names match the identical syntax validation constraints enforced on subvolumes.
  • Introduces unit tests inside test_ceph_argparse.py, provisions an integration suite task in test_volumes.py to protect against parent directory metadata xattr corruption.

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.

@joscollin
joscollin requested a review from a team as a code owner June 10, 2026 09:21
@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch from 1f1ab6a to 3d7f095 Compare June 10, 2026 10:56
@kotreshhr kotreshhr self-assigned this Jun 10, 2026
@joscollin
joscollin marked this pull request as draft June 10, 2026 15:35
@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch 5 times, most recently from f0c2f48 to 0e458d3 Compare June 11, 2026 09:54
@joscollin

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch 2 times, most recently from 3cdf184 to 9b1fb5a Compare June 12, 2026 02:53
@joscollin

Copy link
Copy Markdown
Member Author

jenkins test make check

@joscollin

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch from 9b1fb5a to 420fc84 Compare June 12, 2026 13:41
@joscollin
joscollin marked this pull request as ready for review June 12, 2026 13:42
@joscollin
joscollin requested a review from vshankar June 12, 2026 13:50
Comment thread src/pybind/ceph_argparse.py Resolved
Comment thread src/pybind/ceph_argparse.py Resolved
Comment thread src/test/pybind/test_ceph_argparse.py Resolved
@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch 2 times, most recently from 0aa7d91 to c30a258 Compare June 15, 2026 08:43
@joscollin joscollin changed the title pybind/ceph_argparse: allow CephString to handle unknown parameters pybind/ceph_argparse: enforce non-empty validation and clean CLI error output Jun 15, 2026
@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch from c30a258 to 36d1948 Compare June 16, 2026 03:34
@joscollin

Copy link
Copy Markdown
Member Author

jenkins test windows

@joscollin

Copy link
Copy Markdown
Member Author

jenkins test docs

@vshankar
vshankar requested a review from tchaikov July 7, 2026 06:39
Comment thread src/pybind/mgr/volumes/module.py Resolved
Comment thread src/pybind/ceph_argparse.py Resolved
Comment thread qa/tasks/cephfs/filesystem.py Resolved
@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch from 36d1948 to e30640d Compare July 13, 2026 13:07
@joscollin

Copy link
Copy Markdown
Member Author

Dropped the unnecessary '' to None fix and Updated the commit message.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

…hString

Fix a bug where certain CLI commands or subvolume operations throw unhandled
exceptions instead of a proper error message when handled an empty string
or invalid character sequence.

Changes:
* Block literal empty strings ("") from silently slipping past arguments
  requiring defined goodchars restrictions.
* Deterministically sort the output list of invalid offending characters to
  make checking validation error strings consistent and user-readable.

Fixes: https://tracker.ceph.com/issues/58645
Signed-off-by: Jos Collin <[email protected]>
…p_name

Apply the goodchars regex validation filter to the group_name parameter
within the volumes manager module interface. This ensures that subvolume
group names are strictly validated against the same allowed character
constraints as subvolume names during creation, preventing invalid or
malformed string inputs from slipping into the group configuration path.

This change fixes a core parameter-shifting bug that occurs when the
subvolume name is entirely omitted from the CLI invocation. In that case,
the subvolumegroup name erroneously cascades down to become interpreted
as the subvolume name, leaving the subvolume group field empty. Because
the subvolume group name parameter was not previously vetted against
goodchars, this empty group layout string was silently accepted by the
manager module, leading to a layout corruption.

Fixes: https://tracker.ceph.com/issues/58645
Signed-off-by: Jos Collin <[email protected]>
Introduce targeted unit tests to test_ceph_argparse.py to verify the
robustness of CephString formatting and validation gates.

Changes:
* Add test_ceph_string_empty_rejection to confirm that empty string inputs
  are inherently blocked when a goodchars pattern constraint is active.
* Add test_ceph_string_error_formatting to verify that invalid characters
  are extracted, deterministically sorted, and properly single-quoted
  in error messages.

Fixes: https://tracker.ceph.com/issues/58645
Signed-off-by: Jos Collin <[email protected]>
Introduce a comprehensive suite of negative integration tests to verify that
'ceph fs subvolume create' and 'ceph fs subvolumegroup create' commands cleanly
reject empty, literal empty, or whitespace-only inputs.

Changes:
* Add the new TestEmptyStringForCreates class to the fs:volumes testing
  suite.
* Assert that empty strings passed as positional arguments trigger structural
  syntax blocks for both subvolumes and subvolumegroups.
* Assert that empty string overrides passed via the optional '--group_name'
  flag are caught cleanly by the validation layer.
* Add a regression check (test_empty_subvolume_group_corruption) to explicitly
  ensure that blocked empty creation requests do not accidentally poison the
  'ceph.dir.subvolume' xattr of parent layout structures.

Fixes: https://tracker.ceph.com/issues/58645
Signed-off-by: Jos Collin <[email protected]>
@joscollin
joscollin force-pushed the wip-58645-fix-error-when-creating-subvolume branch from e30640d to 7ea4c1e Compare July 20, 2026 05:30
@joscollin

Copy link
Copy Markdown
Member Author

Rebased, resolving conflicts.

@vshankar

Copy link
Copy Markdown
Contributor

@joscollin Thanks for the rebase. I will run this through fs suite this week. We may want to do a broader run for other components additionally.

@joscollin

Copy link
Copy Markdown
Member Author

Thanks @vshankar! Looking forward to the test results.

@vshankar

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-07-21-10:48.

@vshankar
vshankar requested a review from ljflores August 5, 2026 05:57
@vshankar

vshankar commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@vshankar

vshankar commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@ljflores - gentle nudge on this.

@joscollin

Copy link
Copy Markdown
Member Author

@vshankar Let's merge this.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants