Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/nfs: adjust export creation CLI args, and allow rgw user exports #43611

Merged
merged 10 commits into from Nov 4, 2021

Conversation

liewegas
Copy link
Member

@liewegas liewegas commented Oct 20, 2021

  • for nfs export create rgw, take either bucket or user or both. If we get only the user, do an export for the user that shows buckets at the top level. If bucket+user, then use that user instead of the bucket owner. If bucket only, behavior is as before (use bucket owner as the user).
  • adjust hte CLI arg position for nfs export create cephfs to put the fsname as the last positional argument. This aligns the 2 export create commands so that cluster_id and pseudo_path both come first (which FWIW is more intutive anyway)
  • adjust tests so that all callers use named arguments for all of these commands, so that they work both before and after the CLI positional argument order change.

Note that the change for the nfs export create cephfs could be dropped, but I think it si worth the potential user breakage to end up with a better CLI.

TODO

  • add release note, and encourage users to use named arguments whenever using these interfaces
  • add test for rgw user-level export (including bucket creation with mkdir)

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

@ajarr
Copy link
Contributor

ajarr commented Oct 25, 2021

do we need a tracker ticket for this PR to make it easier for pacific backport?

@alfonsomthd
Copy link
Contributor

@liewegas In the GUI we dropped the rgw user id selection because the rgw user was not customizable: the bucket was used as the path and the bucket owner as the user. Can you give more context here on what are the implications for the Dashboard?

@liewegas
Copy link
Member Author

@liewegas In the GUI we dropped the rgw user id selection because the rgw user was not customizable: the bucket was used as the path and the bucket owner as the user. Can you give more context here on what are the implications for the Dashboard?

It turns out there are two kinds of NFS exports for RGW: bucket and user. The bucket ones are currently implemented (and you're right--we just use the bucket owner as the user in that case). What I missed was that you can also export an RGW user, in which case the top-level directory is a list of the buckets owned by that user, mkdir creates a bucket, etc.

So this PR makes 2 changes:

  • you can create a user export (by passing --user <user> only)
  • you can create a bucket export and also specify the rgw user (by passing both --user ... and --bucket ...).

I forgot about the dashboard implications, as per usual (sigh!). I suspect the UI probably should have a radio box to select the type of export? And make the user optional the bucket case?

@alfonsomthd
Copy link
Contributor

alfonsomthd commented Oct 27, 2021

  • you can create a bucket export and also specify the rgw user (by passing both --user ... and --bucket ...).

I understand that if both (user & bucket) are passed, it creates an export that:

  • the export user is the bucket owner.
  • The bucket is the export path.
  • If the bucket does not exist for that user, the NFS module will trigger the bucket creation.

Is this correct?

@liewegas
Copy link
Member Author

  • the export user is the bucket owner.

Almost. If you pass both user and bucket, then

  • it is a bucket export
  • the user is the specified user (not the bucket owner)

I don't think it will create the bucket for you (at least I have not heard of such a thing).

If you pass bucket only, then we default to the bucket owner.

@github-actions
Copy link

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

Signed-off-by: Sage Weil <sage@newdream.net>
@github-actions github-actions bot added cephfs Ceph File System tests labels Nov 2, 2021
@liewegas liewegas force-pushed the nfs-rgw-by-user branch 2 times, most recently from a1e6a78 to 900c6de Compare November 2, 2021 20:29
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Put fsname after cluster_id + pseudo_path so that it aligns with the change
to the rgw command.

Signed-off-by: Sage Weil <sage@newdream.net>
Put bucket name last so that it paves the way for an optional 'user' arg
to go along with it.

Signed-off-by: Sage Weil <sage@newdream.net>
@liewegas
Copy link
Member Author

liewegas commented Nov 2, 2021

jenkins test make check

1 similar comment
@liewegas
Copy link
Member Author

liewegas commented Nov 3, 2021

jenkins test make check

@liewegas
Copy link
Member Author

liewegas commented Nov 3, 2021

@sebastian-philipp @alfonsomthd This is passing tests now!

@liewegas
Copy link
Member Author

liewegas commented Nov 3, 2021

jenkins test api

Copy link
Contributor

@mgfritch mgfritch left a comment

Choose a reason for hiding this comment

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

one minor issue in the error path, but otherwise lgtm!

src/pybind/mgr/nfs/export.py Show resolved Hide resolved
Copy link
Contributor

@ajarr ajarr left a comment

Choose a reason for hiding this comment

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

Looks good!

src/pybind/mgr/nfs/module.py Show resolved Hide resolved
src/pybind/mgr/nfs/tests/test_nfs.py Outdated Show resolved Hide resolved
- move the bucket / user position after the cluster_id and pseudo_path
(since they are optional)
- require bucket or user or both
- if bucket, use the bucket owner
- if bucket+user, use that user
- if user only, then export at top-level (all users buckets)

Fixes: https://tracker.ceph.com/issues/53134
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
@liewegas liewegas merged commit d87d2bd into ceph:master Nov 4, 2021
8 checks passed
@liewegas liewegas mentioned this pull request Nov 4, 2021
1 task
@liewegas liewegas mentioned this pull request Nov 11, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants