Skip to content

cephfs,mon: fs rename must require FS to be offline and refuse_client_session to be set#53899

Merged
rishabh-d-dave merged 4 commits intoceph:mainfrom
rishabh-d-dave:before-fs-rename-fail-fs
Nov 7, 2023
Merged

cephfs,mon: fs rename must require FS to be offline and refuse_client_session to be set#53899
rishabh-d-dave merged 4 commits intoceph:mainfrom
rishabh-d-dave:before-fs-rename-fail-fs

Conversation

@rishabh-d-dave
Copy link
Contributor

@rishabh-d-dave rishabh-d-dave commented Oct 9, 2023

Before renaming a CephFS, make sure that the CephFS is offline and refuse_client_session is set for it.

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

Contribution Guidelines

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
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@rishabh-d-dave rishabh-d-dave requested a review from a team as a code owner October 9, 2023 20:01
@rishabh-d-dave rishabh-d-dave requested a review from a team October 9, 2023 20:01
@rishabh-d-dave rishabh-d-dave requested a review from batrick October 9, 2023 20:02
@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch from 45b19a9 to dc494c1 Compare October 10, 2023 06:20
@vshankar
Copy link
Contributor

@rishabh-d-dave ping back when ready for another round of review.

@dparmar18
Copy link
Contributor

why not enable fs rename code to do it on its own? i.e. fail fs before renaming and then post rename set joinable to true? this can save operator's time and reduce complexity for a naive user i guess

@vshankar
Copy link
Contributor

why not enable fs rename code to do it on its own? i.e. fail fs before renaming and then post rename set joinable to true?

Because its destructive and doing it by default is not a good idea.

this can save operator's time and reduce complexity for a naive user i guess

Its the naive users we need to give extra care at times :)

Signed-off-by: Rishabh Dave <ridave@redhat.com>
@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch from dc494c1 to 117b0a6 Compare October 10, 2023 19:55
@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch 3 times, most recently from c5e9d0f to aa3232f Compare October 10, 2023 20:04
@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch 2 times, most recently from 7f51106 to 5d5419a Compare October 11, 2023 10:09
@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

@rishabh-d-dave
Copy link
Contributor Author

@rishabh-d-dave
Copy link
Contributor Author

jenkins test api

@rishabh-d-dave rishabh-d-dave added the wip-rishabh-testing Rishabh's testing label label Oct 12, 2023
@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch 2 times, most recently from eac7a7b to 2e63452 Compare October 31, 2023 20:18
@rishabh-d-dave rishabh-d-dave changed the title cephfs,mon: check if FS is down before renaming an FS cephfs,mon: allow FS rename only if FS is down Nov 1, 2023
@rishabh-d-dave
Copy link
Contributor Author

rishabh-d-dave commented Nov 1, 2023

@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch 2 times, most recently from c3119b9 to 78d9e6d Compare November 1, 2023 13:15
@vshankar
Copy link
Contributor

vshankar commented Nov 2, 2023

http://pulpito.front.sepia.ceph.com/rishabh-2023-10-28_17:50:16-fs:volumes-rishabh-fs-rename-testing-testing-default-smithi/

EDIT

This job failed. It also failed during integration test runs. This is failing due to a case that needs to be covered in mgr/vol plugin due to this changes in this PR.

Could you describe the failure and the commit diff that subsequently fixed it?

@rishabh-d-dave
Copy link
Contributor Author

@vshankar

Could you describe the failure and the commit diff that subsequently fixed it?

subvolume rename would fail because the code for it wouldn't check if the FS is offline. Here's the fix for it - 45b0336

@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch from 78d9e6d to ed9cb3a Compare November 2, 2023 10:23
@vshankar
Copy link
Contributor

vshankar commented Nov 2, 2023

@rishabh-d-dave As discussed in slack, it would suffice with the existing checks in the monitor to disallow rename if the file system is still online.

EDIT: s/IRC/slack

@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch 2 times, most recently from cfe0fc7 to ca0633b Compare November 2, 2023 13:42
@rishabh-d-dave rishabh-d-dave changed the title cephfs,mon: allow FS rename only if FS is down cephfs,mon: fs rename must require FS to be offline and refuse_client_session to be set Nov 2, 2023
@rishabh-d-dave
Copy link
Contributor Author

rishabh-d-dave commented Nov 2, 2023

I've moved the commit (ca0633b) from PR #54306 to here and closed that PR.

Reject the attempt to rename the CephFS is the CephFS is not offline.
Add new tests for this and update current tests (test_admin.py and
test_volumes.py) accordingly.

Fixes: https://tracker.ceph.com/issues/63154
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Move tests for "ceph fs volume rename" command to a new class. This
makes it possible to run this group of tests in a single command.

This provides a convenient way to execute these tests which is necessary
after the changes has been made to the code for the "ceph fs volume
rename" command.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
client_refuse_session must be set for a CephFS before an attempt to
rename a CephFS can be made. Add a new test for this, and update current
tests (test_admin.py and test_volumes.py) accordingly.

Fixes: https://tracker.ceph.com/issues/63154
Signed-off-by: Rishabh Dave <ridave@redhat.com>
@rishabh-d-dave rishabh-d-dave force-pushed the before-fs-rename-fail-fs branch from ca0633b to 3f93d74 Compare November 2, 2023 16:44
@rishabh-d-dave
Copy link
Contributor Author

rishabh-d-dave commented Nov 3, 2023

@vshankar
Copy link
Contributor

vshankar commented Nov 6, 2023

@rishabh-d-dave also requires a note in PendingReleaseNotes.

# data pool names unchanged
self.assertCountEqual(orig_data_pool_names, list(self.fs.data_pools.values()))

def test_rename_when_fs_is_online(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this test really required since test_admin.test_rename_when_fs_is_online exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In mgr/volumes, the code for renaming volumes is more than 100 LoC. IMHO, it is a nice idea to keep this test here so that we catch issues sooner.

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed yesterday that the nature of this test isn't clear since we already have the corresponding test in test_admin. What specific 100 LoC is this test validating? Sorry, but this isn't an excuse to writing duplicate tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @vshankar. This was a mistake. I was supposed to merge "fs swap" PR and leave this one unmerged but I made a mistake while merging the batch of PRs and ended up with the reverse. You may check the fs swap PR, it's still unmerged - #50212. I'll open a PR to delete the test.

Sorry to get you angry. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @vshankar. This was a mistake. I was supposed to merge "fs swap" PR and leave this one unmerged but I made a mistake while merging the batch of PRs and ended up with the reverse. You may check the fs swap PR, it's still unmerged - #50212. I'll open a PR to delete the test.

Sorry to get you angry. :)

I was not angry - just that I didn't find an explanation regarding the pending comments :)

Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

CephFS integration tests were successful - https://tracker.ceph.com/projects/cephfs/wiki/Main#7-Nov-2023

@rishabh-d-dave rishabh-d-dave merged commit 380ac6c into ceph:main Nov 7, 2023
@rishabh-d-dave rishabh-d-dave deleted the before-fs-rename-fail-fs branch November 7, 2023 17:53
@vshankar
Copy link
Contributor

vshankar commented Nov 8, 2023

@rishabh-d-dave What about this comment - #53899 (comment) ?

rishabh-d-dave added a commit to rishabh-d-dave/ceph that referenced this pull request Dec 5, 2023
With merging of PR ceph#53899 it is mandatory now for CephFS to be offline
and refuse_client_session to be set before an attempt to rename the
CephFS is made.

Fixes: ceph#53899
Fixes: https://tracker.ceph.com/issues/63154
Signed-off-by: Rishabh Dave <ridave@redhat.com>
rishabh-d-dave added a commit to rishabh-d-dave/ceph that referenced this pull request Dec 5, 2023
With merging of PR ceph#53899 it is mandatory now for CephFS to be offline
and refuse_client_session to be set before an attempt to rename the
CephFS is made. Add a release note for this.

Fixes: ceph#53899
Fixes: https://tracker.ceph.com/issues/63154
Signed-off-by: Rishabh Dave <ridave@redhat.com>
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