Skip to content

mgr/volumes: accept unit with subvolume resize - #62342

Merged
chrisphoffman merged 4 commits into
ceph:mainfrom
dparmar18:i62673
Jul 24, 2026
Merged

chrisphoffman merged 4 commits into
ceph:mainfrom
dparmar18:i62673

Conversation

@dparmar18

@dparmar18 dparmar18 commented Mar 17, 2025 •

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added cephfs Ceph File System pybind tests labels Mar 17, 2025
@dparmar18
dparmar18 requested a review from a team as a code owner March 17, 2025 16:41
@dparmar18
dparmar18 requested a review from a team March 17, 2025 16:42
Comment thread qa/tasks/cephfs/test_volumes.py Resolved
Comment thread doc/cephfs/fs-volumes.rst Resolved
@dparmar18

Copy link
Copy Markdown
Contributor Author

@neesingh-rh @ceph/cephfs RFR

@neesingh-rh neesingh-rh 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.

The patch looks good. Will approve once I test it locally.

@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

@dparmar18

Copy link
Copy Markdown
Contributor Author

last push - no code change, resolved conflicts with a rebase

@dparmar18 dparmar18 closed this Mar 27, 2025
@dparmar18 dparmar18 reopened this Mar 27, 2025
@dparmar18
dparmar18 requested a review from neesingh-rh April 10, 2025 09:19
@dparmar18

Copy link
Copy Markdown
Contributor Author

why is "Check for missing .qa links / Check for missing .qa links" failing? I dont think there is any missing .qa link

@dparmar18

Copy link
Copy Markdown
Contributor Author

@neesingh-rh RFR

@dparmar18

Copy link
Copy Markdown
Contributor Author

bumping up this PR, RFR @ceph/cephfs

@dparmar18
dparmar18 requested a review from a team May 13, 2025 12:39
@dparmar18

Copy link
Copy Markdown
Contributor Author

jenkins test make check

chrisphoffman
chrisphoffman previously approved these changes May 15, 2025
@chrisphoffman
chrisphoffman self-requested a review May 15, 2025 17:34
@chrisphoffman
chrisphoffman dismissed their stale review May 15, 2025 17:35

Wrong button during review, will continue and re-review.

Comment thread qa/tasks/cephfs/test_volumes.py Outdated
"""
invalid_values = ("10A", "1y00Ki", "af00", "G", "", " ", "-1t", "-1",
"1GT", "2MM", "5Di", "8Bi", "i", "7iB", ".10.G",
"10Ki.B", "20G/.", "Gi32Ki")

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.

1.K as a value passes but should fail.

ceph fs subvolume resize cephfs sv1 1.K
*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***
[
    {
        "bytes_used": 0
    },
    {
        "bytes_quota": 1024
    },
    {
        "bytes_pcent": "0.00"
    }
]

Can you double check all types of invalid_values we ironed out here are included:
https://github.com/ceph/ceph/pull/58962/files#diff-7f7425997b0e903d49a6e867b5cbcc42a0c54a56804fe27edfd692ba60cf98d7R197

@dparmar18 dparmar18 May 16, 2025 •

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.

thanks for the review and finding this error :), the regex had a mistake which used to consider N. values. I've fixed the regex and tested it out locally. On top of it your review also helped me figure out one more issue - the incapability of my code to handle byte values (i.e. B as suffix) but now with the latest push i've patched it too. I've also added more cases in the test case you pointed out https://github.com/ceph/ceph/compare/5b5830b819b28d1d2cfa5136a616719bd089fc3e..058c87deae23ca136eb51e885e9cc2739da55f15

log excerpts from a local run:

2025-05-16 16:27:12,633.633 INFO:tasks.vstart_runner:> ./bin/ceph fs subvolume resize cephfs subvol7520 1.K
Error EINVAL: invalid size option '1.k'

Invalid bytes related cases:

2025-05-16 16:27:14,446.446 INFO:tasks.vstart_runner:> ./bin/ceph fs subvolume resize cephfs subvol7520 10.64B
Error EINVAL: Invalid byte value : 10.64
2025-05-16 16:27:14,699.699 INFO:tasks.vstart_runner:> ./bin/ceph fs subvolume resize cephfs subvol7520 1.B
Error EINVAL: invalid size option '1.b'
2025-05-16 16:27:14,957.957 INFO:tasks.vstart_runner:> ./bin/ceph fs subvolume resize cephfs subvol7520 .B
Error EINVAL: invalid size option '.b'
2025-05-16 16:27:15,222.222 INFO:tasks.vstart_runner:> ./bin/ceph fs subvolume resize cephfs subvol7520 B.1.
Error EINVAL: invalid size option 'b.1'

@github-actions

github-actions Bot commented Nov 6, 2025

Copy link
Copy Markdown

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

@dparmar18

Copy link
Copy Markdown
Contributor Author

@vshankar ready to be tested

@vshankar

Copy link
Copy Markdown
Contributor

@vshankar ready to be tested

I will only be able to get to this next week.

@vshankar

Copy link
Copy Markdown
Contributor

@rishabh-d-dave PTAL

@rishabh-d-dave rishabh-d-dave 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. Left few nits.

Comment on lines +392 to +396
if multiplier is not None:
return float(value) * multiplier
else:
raise VolumeException(-errno.EINVAL,
f"Invalid subvolume unit: {unit}")

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.

Suggested change
if multiplier is not None:
return float(value) * multiplier
else:
raise VolumeException(-errno.EINVAL,
f"Invalid subvolume unit: {unit}")
if multiplier is None:
raise VolumeException(-errno.EINVAL,
f"Invalid subvolume unit: {unit}")
else:
return float(value) * multiplier

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.

both are equally readable IMO but i guess the if block is simpler to read, i'll push the change.

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.

@@ -371,7 +371,37 @@ def set_attrs(self, path, attrs):
raise VolumeException(-errno.EINVAL,
"invalid fscrypt_file specified: '{0}'".format(fscrypt_file))

def separate_unit_suffix(self, subvol_size):

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.

Rename method name to something more suitable?

Suggested change
def separate_unit_suffix(self, subvol_size):
def conv_to_bytes(self, subvol_size):

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.

changing to convert_to_bytes()

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.

Comment on lines +4472 to +4474
with self.assertRaises(CommandFailedError):
self._fs_cmd("subvolume", "resize", self.volname, subvolume,
invalid_value)

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.

Let's check the error message to. It's convenient to do so using negtest_ceph_cmd() method.

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.

I feel checking errno is enough here, if there is no hard need i'd prefer keeping this. wdyt?

Comment on lines +397 to +398
else:
return None

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.

I believe it's impossible for execution to reach here, so this can be removed.

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.

for very weird inputs like Ki10 or something there will be no match. check test_subvolume_resize_invalid_unit().

@dparmar18
dparmar18 force-pushed the i62673 branch 2 times, most recently from f9afe76 to 9f9db02 Compare December 18, 2025 13:06
@dparmar18

Copy link
Copy Markdown
Contributor Author

last push was just a rebase

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Feb 16, 2026
@dparmar18 dparmar18 removed the stale label Feb 17, 2026
@dparmar18

Copy link
Copy Markdown
Contributor Author

@vshankar please include this in the next batch.

@dparmar18

Copy link
Copy Markdown
Contributor Author

@vshankar ping

@vshankar

Copy link
Copy Markdown
Contributor

@vshankar ping

Deferring this to @chrisphoffman

@dparmar18

Copy link
Copy Markdown
Contributor Author

@chrisphoffman ping

1 similar comment
@dparmar18

Copy link
Copy Markdown
Contributor Author

@chrisphoffman ping

@chrisphoffman

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by choffman started 2026-07-15-15:47.

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.

5 participants