Skip to content

mon, cephfs: Add auth caps for CephFS fsids - #32581

Merged
ajarr merged 15 commits into
ceph:masterfrom
rishabh-d-dave:wip-djf-15070
Sep 11, 2020
Merged

ajarr merged 15 commits into
ceph:masterfrom
rishabh-d-dave:wip-djf-15070

Conversation

@rishabh-d-dave

@rishabh-d-dave rishabh-d-dave commented Jan 9, 2020 •

Copy link
Copy Markdown
Contributor

Fixes: https://tracker.ceph.com/issues/15070
First 3 commits are rebased and modified version of PR #26855.

  • Add new MON and MDS auth caps to restrict access based on fsnames.
  • Allow passing fsnames and paths in same cap.
  • Make fs authorize subcommand assign MON cap specific to that FS
  • Update doc client-auth for the changes above and improve it.
  • Make changes to qa/ code to support multi-FS tests -
    • Create new CephFSMount attributes for client's keyring, CephFS name and mountpoints on host and Ceph FS
    • Update all mount creation calls to use keyword arguments.
    • Allow reusing mount objects
    • Add remount method to remount Ceph FS in a single call
    • Allow not aborting when mount command fails (useful for negative tests)
    • Improve filesystem.py
      • Add a method to destroy an FS
      • Modify Filesytem.recreate() and mds_cluster.delete_all_filesystems()
    • Add helper methods to read/write files from CephFS mounts
    • Improve setup/teardown for CephFS tests in general
  • Add tests for multifs_auth and for fs authorize subcommand.

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • 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 backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

Comment thread src/mds/Server.cc Resolved
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@batrick and @fullerdj if the PR looks fine, what next? Anything besides adding tests? Some of the changes requested on #26855 are outstanding, I'll go ahead with right now.

@fullerdj

fullerdj commented Jan 9, 2020

Copy link
Copy Markdown
Contributor

Hi Rishabh,

This will need a test associated with it.

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

Also need to address especially: #26855 (comment)

@gregsfortytwo @liewegas do you have a suggestion on how that would look? mon allow r fscid=<fscid>?

Comment thread src/mds/Server.cc Resolved
@gregsfortytwo

Copy link
Copy Markdown
Member

Also need to address especially: #26855 (comment)

@gregsfortytwo @liewegas do you have a suggestion on how that would look? mon allow r fscid=<fscid>?

Yes, that looks right to me if you're trying to restrict a user to reading only from fscid 1. As you note in the previous comment, an "allow rw" would supersede any separate "allow fscid=N" clause, so they'd need to be stuck together in any case.
Was that the whole question?

@batrick

batrick commented Jan 21, 2020

Copy link
Copy Markdown
Member

Also need to address especially: #26855 (comment)
@gregsfortytwo @liewegas do you have a suggestion on how that would look? mon allow r fscid=<fscid>?

Yes, that looks right to me if you're trying to restrict a user to reading only from fscid 1. As you note in the previous comment, an "allow rw" would supersede any separate "allow fscid=N" clause, so they'd need to be stuck together in any case.
Was that the whole question?

Yes, I think so. Thanks!

@batrick batrick added this to the octopus milestone Jan 24, 2020
@batrick

batrick commented Jan 30, 2020

Copy link
Copy Markdown
Member

Needs rebase

@rishabh-d-dave
rishabh-d-dave force-pushed the wip-djf-15070 branch 3 times, most recently from 78c6eb8 to 5a6df79 Compare February 11, 2020 17:38
@rishabh-d-dave rishabh-d-dave added the wip-rishabh-testing Rishabh's testing label label Feb 12, 2020
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

Testing bits of my patch in that applies in qa that can't be tested with vstart_runner.py

@rishabh-d-dave rishabh-d-dave removed the wip-rishabh-testing Rishabh's testing label label Feb 12, 2020
@rishabh-d-dave
rishabh-d-dave force-pushed the wip-djf-15070 branch 5 times, most recently from a3d13e4 to 1b02da6 Compare February 17, 2020 15:07
@batrick batrick removed this from the octopus milestone Feb 19, 2020
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@batrick

Teuthology testing fails with both kernel as well as FUSE client. Here's the links to the tests -
http://pulpito.ceph.com/rishabh-2020-02-14_12:07:11-fs-wip-rishabh-wip-djf-15070-distro-basic-smithi/
http://pulpito.ceph.com/rishabh-2020-02-18_05:31:37-kcephfs-wip-rishabh-wip-djf-15070-distro-basic-smithi/

Here's the failure of kernel client -

======
2020-02-18T13:23:43.531 INFO:tasks.cephfs_test_runner:FAIL: test_write (tasks.cephfs.test_multifs.TestClientsWithOutAuth)
2020-02-18T13:23:43.531 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2020-02-18T13:23:43.531 INFO:tasks.cephfs_test_runner:Only have 1 clients, require 2
2020-02-18T13:23:43.531 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2020-02-18T13:23:43.531 INFO:tasks.cephfs_test_runner:Ran 5 tests in 5.179s
2020-02-18T13:23:43.532 INFO:tasks.cephfs_test_runner:

Looks like I need to modify some file qa/suites to provision 2 clients instead of 1.

And, here's the failure for FUSE client -

Traceback (most recent call last):
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_master/teuthology/run_tasks.py", line 89, in run_tasks
    manager.__enter__()
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/teuthworker/src/git.ceph.com_ceph-c_wip-rishabh-wip-djf-15070/qa/tasks/ceph_fuse.py", line 137, in task
    mount.mount()
  File "/home/teuthworker/src/git.ceph.com_ceph-c_wip-rishabh-wip-djf-15070/qa/tasks/cephfs/fuse_mount.py", line 39, in mount
    return self._mount(mount_path, mount_fs_name)
  File "/home/teuthworker/src/git.ceph.com_ceph-c_wip-rishabh-wip-djf-15070/qa/tasks/cephfs/fuse_mount.py", line 144, in _mount
    waited
RuntimeError: Fuse mount failed to populate /sys/ after 31 seconds

Looks like the command to mount was executed successfully but the mount itself failed for some reason. I've got not idea what's the reason behind this. The remounting is different from any remounting in the sense that this time mounting happens with a different client ID and keyring,

FYI: These tests ran successfully when I tested with vstart_runner.py.

This commit adds a new argument check_status to mount methods of
KernelMount, FuseMount, LocalKernelMount and LocalFuseMount. When value
of this argument is False, these methods would catch the
CommandFailedError exception and would return a tuple consisting of the
exception itself, and stdout and stderr of the mount command. This
allows reusing these mount methods while running negative tests for
commands.

The name "check_status" is selected so since teuthology's run() and
vstart_runner's run() use a variable with same name for the very same
purpose.

Signed-off-by: Rishabh Dave <[email protected]>
And reset_obj_attrs parameter to it so that the caller of the method can
choose to destroy the Ceph FS represented by the object without
disturbing the object attributes.

Signed-off-by: Rishabh Dave <[email protected]>
Modify cephfs.filesystem.Filesystem.recreate() method to delete only the
FS represented by the object instead of deleting the every FS on the
Ceph cluster.

Signed-off-by: Rishabh Dave <[email protected]>
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

Added DNM to test changes the fix for ceph API tests.

Modify filesystem.Filesystem.delete_all_filesystems() method to make it
more succinct, move it to class MDSCluster instead and update every call
to it accordingly.

Signed-off-by: Rishabh Dave <[email protected]>
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins render docs

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

@rishabh-d-dave

rishabh-d-dave commented Sep 11, 2020 •

Copy link
Copy Markdown
Contributor Author

Tests ran successfully with teuthology -
multifs, fuse client: https://pulpito.ceph.com/rishabh-2020-09-11_06:19:54-fs-wip-rishabh-15070-distro-basic-smithi/
Missed out kernel client out, triggered tests for it now Kernel tests failed since error messages can differ across kernel version I suppose - https://pulpito.ceph.com/rishabh-2020-09-11_09:30:41-kcephfs-wip-rishabh-15070-distro-basic-smithi/

client recovery: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:39-fs-wip-rishabh-15070-distro-basic-smithi/
strays: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:34-fs-wip-rishabh-15070-distro-basic-smithi/
quota: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:27-fs-wip-rishabh-15070-distro-basic-smithi/
alternate pool: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:22-fs-wip-rishabh-15070-distro-basic-smithi/
volume client: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:17-fs-wip-rishabh-15070-distro-basic-smithi/
sessionmap: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:12-fs-wip-rishabh-15070-distro-basic-smithi/
admin: https://pulpito.ceph.com/rishabh-2020-09-11_06:20:06-fs-wip-rishabh-15070-distro-basic-smithi/

Quota tests had 4 jobs, 2 CentOS 8 and 2 RHEL 8. RHEL 8 jobs failed, apparently, for not a related reason. I'm taking a deeper look into the logs...

Comment thread qa/tasks/cephfs/test_multifs_auth.py Resolved
Add testsuite for testing authorization on Ceph cluster with multiple
file systems and enable it to be executable with Teuthology framework.

Also add helper methods required to setup the test environment for
multi-FS tests.

Signed-off-by: Rishabh Dave <[email protected]>
Right now, only client IDs are stashed and restored but with the recent
changes (addition of more attributes to mount objects, specifically),
this is not enough. Saving and restoring these details before and after
tests respectively ensures that mount commands rus smoothly. Not doing
this typically leads to mount command failure for the second test in the
testsuite under execution since the client IDs are saved and restored in
CephFSTestCase.setUp and CephFSTestCase.tearDown respectively but the
rest of the details are not.

Signed-off-by: Rishabh Dave <[email protected]>
Make caps FS-specific affects "fs authorize" subcommand. Let's add few
tests to verify its behaviour.

Signed-off-by: Rishabh Dave <[email protected]>
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rishabh-d-dave

rishabh-d-dave commented Sep 11, 2020 •

Copy link
Copy Markdown
Contributor Author

quota - https://pulpito.ceph.com/rishabh-2020-09-11_15:22:09-fs-wip-rishabh-15070-distro-basic-smithi
alternate pool - https://pulpito.ceph.com/rishabh-2020-09-11_15:22:04-fs-wip-rishabh-15070-distro-basic-smithi/
volume client - https://pulpito.ceph.com/rishabh-2020-09-11_15:21:59-fs-wip-rishabh-15070-distro-basic-smithi/
sessionmap - https://pulpito.ceph.com/rishabh-2020-09-11_15:21:54-fs-wip-rishabh-15070-distro-basic-smithi/
client recovery - https://pulpito.ceph.com/rishabh-2020-09-11_15:22:22-fs-wip-rishabh-15070-distro-basic-smithi/
strays - https://pulpito.ceph.com/rishabh-2020-09-11_15:22:16-fs-wip-rishabh-15070-distro-basic-smithi/
failover - https://pulpito.ceph.com/rishabh-2020-09-11_17:24:36-fs-wip-rishabh-15070-distro-basic-smithi/

admin - https://pulpito.ceph.com/rishabh-2020-09-11_15:21:49-fs-wip-rishabh-15070-distro-basic-smithi/
mulitfs kcephfs - https://pulpito.ceph.com/rishabh-2020-09-11_16:15:00-kcephfs-wip-rishabh-15070-distro-basic-smithi/
multifs fuse - https://pulpito.ceph.com/rishabh-2020-09-11_16:31:01-fs-wip-rishabh-15070-distro-basic-smithi/

There are few failures on quota just like last batch of tests (the failures aren't related) and on multifs kcephfs too has failures but those the failures are not due to tests. Looks like few smithi machines didn't respond back in time.

@ajarr

ajarr commented Sep 11, 2020 •

Copy link
Copy Markdown
Contributor

Thanks, Rishabh!

@rishabh-d-dave

rishabh-d-dave commented Sep 11, 2020 •

Copy link
Copy Markdown
Contributor Author

@ajarr @batrick Thanks for all the review and help. :D

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.

9 participants