Skip to content

mgr/vol: make "snapshot getpath" cmd work with v1 and legacy - #63127

Merged
rishabh-d-dave merged 4 commits into
ceph:mainfrom
rishabh-d-dave:vols-snappath-v1-and-legacy
May 12, 2025
Merged

rishabh-d-dave merged 4 commits into
ceph:mainfrom
rishabh-d-dave:vols-snappath-v1-and-legacy

Conversation

@rishabh-d-dave

Copy link
Copy Markdown
Contributor

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

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

@rishabh-d-dave
rishabh-d-dave requested review from a team and vshankar May 6, 2025 10:37
@rishabh-d-dave
rishabh-d-dave force-pushed the vols-snappath-v1-and-legacy branch 2 times, most recently from 390a884 to 2b785d2 Compare May 6, 2025 12:02
@rishabh-d-dave
rishabh-d-dave force-pushed the vols-snappath-v1-and-legacy branch from 2b785d2 to 222be9d Compare May 6, 2025 12:59
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@vshankar

vshankar commented May 6, 2025

Copy link
Copy Markdown
Contributor

test_snap_schedules.py handcraft the snapshot path in _get_subvol_snapdir_path(). Suggest, changing that to use this new interface.

@rishabh-d-dave
rishabh-d-dave force-pushed the vols-snappath-v1-and-legacy branch from 222be9d to b2213ec Compare May 6, 2025 14:20
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

test_snap_schedules.py handcraft the snapshot path in _get_subvol_snapdir_path(). Suggest, changing that to use this new interface.

@vshankar There must be more such instances where such improvements can be made, let's do that on a separate PR?

@vshankar

vshankar commented May 6, 2025

Copy link
Copy Markdown
Contributor

test_snap_schedules.py handcraft the snapshot path in _get_subvol_snapdir_path(). Suggest, changing that to use this new interface.

@vshankar There must be more such instances where such improvements can be made, let's do that on a separate PR?

How many are such instances? It should be a straight-forward usage of the new API, isn't it?

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

test_snap_schedules.py handcraft the snapshot path in _get_subvol_snapdir_path(). Suggest, changing that to use this new interface.

@vshankar There must be more such instances where such improvements can be made, let's do that on a separate PR?

How many are such instances? It should be a straight-forward usage of the new API, isn't it?

@vshankar
I think I've seen a few in test_volumes.py as well. Also, it's beyond scope of this PR, we only want to add tests for this command against v1 and legacy.

@vshankar

vshankar commented May 6, 2025

Copy link
Copy Markdown
Contributor

@vshankar
I think I've seen a few in test_volumes.py as well. Also, it's beyond scope of this PR, we only want to add tests for this command against v1 and legacy.

It's not entirely beyond the scope -- you get tests run for other uses. If its just test_volumes and test_snap_schedule, I suggest changing those to use the new interface.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@vshankar
I think I've seen a few in test_volumes.py as well. Also, it's beyond scope of this PR, we only want to add tests for this command against v1 and legacy.

It's not entirely beyond the scope -- you get tests run for other uses. If its just test_volumes and test_snap_schedule, I suggest changing those to use the new interface.

@vshankar The more we make such changes in the tests, the higher will be chance that QA might fail due to some error in making those changes. And that will make it longer to merge this PR. I would really prefer to avoid it in interest of time.

@vshankar

vshankar commented May 6, 2025

Copy link
Copy Markdown
Contributor

@vshankar
I think I've seen a few in test_volumes.py as well. Also, it's beyond scope of this PR, we only want to add tests for this command against v1 and legacy.

It's not entirely beyond the scope -- you get tests run for other uses. If its just test_volumes and test_snap_schedule, I suggest changing those to use the new interface.

@vshankar The more we make such changes in the tests, the higher will be chance that QA might fail due to some error in making those changes. And that will make it longer to merge this PR. I would really prefer to avoid it in interest of time.

I understand that and I also understand the push that's required to get stuff merged. But when things break (and that has happened before), a lot many things have to be redone. So, let's spend a bit more time in ensuring nothing obvious breaks.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

But when things break (and that has happened before), a lot many things have to be redone.

@vshankar
AFAIU, test_snap_schedules.py and test_volumes.py will get refactored with this. Nothing will break if don't make that change. Anyways, will proceed to make the change.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@vshankar I've made the changes in test_volumes.py. I also went through test_snap_schedules.py, specifically the method you mentioned (_get_subvol_snapdir_path()). This method constructs path for parent directory of snapshot prefix directory and not the path of a specific snapshot directory, therefore this command won't help.

@vshankar

vshankar commented May 6, 2025

Copy link
Copy Markdown
Contributor

@vshankar I've made the changes in test_volumes.py. I also went through test_snap_schedules.py, specifically the method you mentioned (_get_subvol_snapdir_path()). This method constructs path for parent directory of snapshot prefix directory and not the path of a specific snapshot directory, therefore this command won't help.

Really? If you see:

    def _get_subvol_snapdir_path(self, version, subvol, group):
	args = ['subvolume', 'getpath', 'cephfs', subvol]
        if group:
            args += ['--group_name', group]

        path = self.get_ceph_cmd_stdout("fs", *args).rstrip()
        if version >= 2:
            path += "/.."
        return path[1:]

It first fetches the subvolume path and then for v2 version where the snapshots are taken a level up, /.. is suffixed and for earlier versions, the subvolume path is used as snapshot path. Can you fault my logic here?

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@vshankar I've made the changes in test_volumes.py. I also went through test_snap_schedules.py, specifically the method you mentioned (_get_subvol_snapdir_path()). This method constructs path for parent directory of snapshot prefix directory and not the path of a specific snapshot directory, therefore this command won't help.

Really? If you see:

    def _get_subvol_snapdir_path(self, version, subvol, group):
	args = ['subvolume', 'getpath', 'cephfs', subvol]
        if group:
            args += ['--group_name', group]

        path = self.get_ceph_cmd_stdout("fs", *args).rstrip()
        if version >= 2:
            path += "/.."
        return path[1:]

It first fetches the subvolume path and then for v2 version where the snapshots are taken a level up, /.. is suffixed

Yes, so parent path of snapshot prefix directory is being derived (/volumes/_nogroup/subvol1) and what snapshot getpath returns is path to a specific snapshot (/volumes/_nogroup/subvol1/<uuid>/.snap/<snap-name>). Both are different. So latter can't replace former.

Also, snapshot getpath requires snap name to be passed. We neither have snap names passed to this method nor in code region that call this method.

and for earlier versions, the subvolume path is used as snapshot path. Can you fault my logic here?

Even for earlier version path derived is not snapshot path. Snapshot prefix directory is discovered and attached to it later.

Overall, goal in both the cases is to find the path to the snapshot prefix directory and not path to a specific snapshot.

/volumes/_nogroup/subvol1 vs /volumes/_nogroup/subvol1/<uuid>/.snap/<snap-name> or /volumes/_nogroup/subvol1/.snap/<snap-name>.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test api

@vshankar

vshankar commented May 6, 2025

Copy link
Copy Markdown
Contributor

@vshankar I've made the changes in test_volumes.py. I also went through test_snap_schedules.py, specifically the method you mentioned (_get_subvol_snapdir_path()). This method constructs path for parent directory of snapshot prefix directory and not the path of a specific snapshot directory, therefore this command won't help.

Really? If you see:

    def _get_subvol_snapdir_path(self, version, subvol, group):
	args = ['subvolume', 'getpath', 'cephfs', subvol]
        if group:
            args += ['--group_name', group]

        path = self.get_ceph_cmd_stdout("fs", *args).rstrip()
        if version >= 2:
            path += "/.."
        return path[1:]

It first fetches the subvolume path and then for v2 version where the snapshots are taken a level up, /.. is suffixed

Yes, so parent path of snapshot prefix directory is being derived (/volumes/_nogroup/subvol1) and what snapshot getpath returns is path to a specific snapshot (/volumes/_nogroup/subvol1/<uuid>/.snap/<snap-name>). Both are different. So latter can't replace former.

Also, snapshot getpath requires snap name to be passed. We neither have snap names passed to this method nor in code region that call this method.

and for earlier versions, the subvolume path is used as snapshot path. Can you fault my logic here?

Even for earlier version path derived is not snapshot path. Snapshot prefix directory is discovered and attached to it later.

Overall, goal in both the cases is to find the path to the snapshot prefix directory and not path to a specific snapshot.

/volumes/_nogroup/subvol1 vs /volumes/_nogroup/subvol1/<uuid>/.snap/<snap-name> or /volumes/_nogroup/subvol1/.snap/<snap-name>.

Ah! I see -- we need the snapshot name. I was thinking in terms of path to snapdir rather than paths to the exact snapshot. Makes sense.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@vshankar Does rest of the PR look okay?

Comment thread qa/tasks/cephfs/test_volumes.py Resolved

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

@rishabh-d-dave I'm seeing dup code from existing tests. Better to clean those up.

Comment thread qa/tasks/cephfs/test_volumes.py Outdated

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.

why not use self.mount_a.snapdirname?

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.

It is available in KernelMount instances but not in FuseMount instances.

Comment thread qa/tasks/cephfs/test_volumes.py Resolved

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

I guess since this only changes tests then the current code with v1 works?

Comment thread qa/tasks/cephfs/test_volumes.py Resolved
@vshankar

vshankar commented May 7, 2025

Copy link
Copy Markdown
Contributor

I guess since this only changes tests then the current code with v1 works?

... and legacy too (which gets upgraded to v1 anyway). But yeh, I have that question too :)

the path to a specific snapshot wherever possible.

Signed-off-by: Rishabh Dave <[email protected]>
@rishabh-d-dave
rishabh-d-dave force-pushed the vols-snappath-v1-and-legacy branch from e7744d5 to 3e70066 Compare May 8, 2025 11:13
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

I guess since this only changes tests then the current code with v1 works?

Yes, wasn't that why we decided to switch from returning ENOTSUP to supporting it?

@rishabh-d-dave
rishabh-d-dave requested review from batrick and vshankar May 8, 2025 11:27
@rishabh-d-dave

rishabh-d-dave commented May 8, 2025 •

Copy link
Copy Markdown
Contributor Author

@vshankar @batrick PTAL

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@vshankar

vshankar commented May 8, 2025

Copy link
Copy Markdown
Contributor

I guess since this only changes tests then the current code with v1 works?

Yes, wasn't that why we decided to switch from returning ENOTSUP to supporting it?

That was not the question @batrick asked. @batrick wanted to confirm if the only thing required is to add tests since the snapshot getpath operation is also supported by v1/legacy.

@rishabh-d-dave

rishabh-d-dave commented May 8, 2025 •

Copy link
Copy Markdown
Contributor Author

I guess since this only changes tests then the current code with v1 works?

Yes, wasn't that why we decided to switch from returning ENOTSUP to supporting it?

That was not the question @batrick asked. @batrick wanted to confirm if the only thing required is to add tests since the snapshot getpath operation is also supported by v1/legacy.

Yes, only thing required is to add tests. That is, the current code for v1 and legacy already supports snapshot getpath command. This is exactly what led us to change our decision and close the previous PR.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

1 similar comment
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@batrick

batrick commented May 8, 2025

Copy link
Copy Markdown
Member

I guess since this only changes tests then the current code with v1 works?

Yes, wasn't that why we decided to switch from returning ENOTSUP to supporting it?

That was not the question @batrick asked. @batrick wanted to confirm if the only thing required is to add tests since the snapshot getpath operation is also supported by v1/legacy.

Yes, only thing required is to add tests. That is, the current code for v1 and legacy already supports snapshot getpath command. This is exactly what led us to change our decision and close the previous PR.

If this is only adding tests then, do we need the extreme urgency of getting this merged?

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

fine w/ me

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@rishabh-d-dave rishabh-d-dave left a comment

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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants