Skip to content

mgr/smb: add RGW-backed SMB share support - #69103

Merged
phlogistonjohn merged 7 commits into
ceph:mainfrom
Sodani:shsodani_ceph_rgw_new_module
Jun 26, 2026
Merged

phlogistonjohn merged 7 commits into
ceph:mainfrom
Sodani:shsodani_ceph_rgw_new_module

Conversation

@Sodani

@Sodani Sodani commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Add support for creating SMB shares backed by RGW buckets,
allowing S3-compatible object storage to be exported over SMB.

Key changes:

Add share create rgw CLI command for RGW share creation
Implement RGW credential retrieval using radosgw-admin
Add RGWStorage resource class with S3 authentication support
Track rgw_buckets in orchestration alongside CephFS volumes
Create CephX entities conditionally for CephFS shares only
Implementation details:

Register share create rgw before share create for correct CLI routing
Trigger orchestration when either vols or rgw_buckets are present
Use S3 access and secret keys for RGW share authentication
Improve logging with CephFS and RGW share breakdown details

New CLI :
ceph smb share create rgw <cluster_id> <bkt_id> <share_id> [--share-name=<share_name>] [--user-id=<user_id>] [--readonly]

example: ceph smb share create rgw mysmb share2 bkt2 --share-name=s2 user1

Declarative :

Define share

  • resource_type: ceph.smb.share
    cluster_id: mysmb
    share_id: ds1
    name: dshare1
    rgw:
    bucket: bkt1
    user_id: user1

Testing:

Created a cluster with a CephFS share, then added an RGW share.
Verified both shares inside the container using net conf list.
Created a cluster with an RGW share first, then added a CephFS share.
Verified both shares successfully.
Verified successful deletion of both CephFS and RGW shares.
Signed-off-by: Shweta Sodani [email protected]

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)

@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch from fef009f to 8f305ba Compare May 27, 2026 08:09
@Sodani Sodani changed the title mgr/smb: add RGW-backed SMB share support WIP : mgr/smb: add RGW-backed SMB share support May 27, 2026
@avanthakkar

Copy link
Copy Markdown
Contributor

jenkins test make check

@avanthakkar

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

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

Generally, this looks like a fantastic start. I have shared a few initial thoughts. Most important to me right now is type decoupling via protocol types (see inline).

I'll share more thoughts in the future as the PR evolves. Thanks!

Comment thread src/pybind/mgr/smb/resources.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/module.py Resolved
Comment thread src/pybind/mgr/smb/handler.py Resolved
Comment thread src/pybind/mgr/smb/handler.py Resolved
@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch 2 times, most recently from d13419b to 308f75e Compare June 1, 2026 06:59
@Sodani

Sodani commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Sodani

Sodani commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch from 308f75e to 8bf5a4a Compare June 3, 2026 10:41
@Sodani

Sodani commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Updated this PR with decoupling via protocol types as mentioned by @phlogistonjohn as a review comment.

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

Very nice improvements thanks. I think this is very close to being reviewable (conditional on having the corresponding samba features available :-) ).

I have a couple thoughts about testing:

  • I would like to see a few new tests in test_smb.py that tests the new resource type for show/apply & the new cli command (mocked). You don't need to go wild, but some coverage here would be good
  • This is a pretty major new feature and I think it demands some level of teuthology test. Depending on the timelines involved I propose two paths: (a) we add new teuthology tests as part of this PR or (b) we skip teuthology in this PR but add coverage for this feature as a new subtask to https://tracker.ceph.com/issues/76672

We can discuss / debate the latter at your convenience.

Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/handler.py Resolved
@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch from 8bf5a4a to a2445f2 Compare June 4, 2026 06:20
Comment thread src/pybind/mgr/smb/staging.py Resolved
Comment thread src/pybind/mgr/smb/resources.py Resolved
Comment thread src/pybind/mgr/smb/handler.py Resolved
Comment thread src/pybind/mgr/smb/module.py Resolved
Comment thread src/pybind/mgr/smb/module.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/staging.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
Comment thread src/pybind/mgr/smb/rgw.py Resolved
@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch from a2445f2 to 3d1464e Compare June 4, 2026 10:00
@Sodani Sodani changed the title WIP : mgr/smb: add RGW-backed SMB share support mgr/smb: add RGW-backed SMB share support Jun 4, 2026
Comment thread doc/mgr/smb.rst Resolved
@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch 2 times, most recently from 41998ef to 0f74024 Compare June 5, 2026 10:30
@phlogistonjohn

Copy link
Copy Markdown
Contributor

Just so this is not lost in resolved threads:

Yes .. i will first use Share.covert() for now and later i will explore dedicated resources approach . Hope this is fine.

Totally fine. It's quite annoying to add a new type still. Don't hesitate to ask q's if you start experimenting in this area and run into issues.

@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch from 0f74024 to 0ce7c8f Compare June 5, 2026 13:50
@Sodani

Sodani commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor Author

This PR, few comments not yet resolved since i have not added a code for that , remaining all comment i resolved also added a test cases as well .

@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch from 0ce7c8f to b3c93a4 Compare June 8, 2026 14:38
@avanthakkar

Copy link
Copy Markdown
Contributor

jenkins test make check

1 similar comment
@Sodani

Sodani commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch 2 times, most recently from c9720c8 to 259880e Compare June 9, 2026 08:25
@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch 2 times, most recently from 016c9d9 to a2ee8b0 Compare June 24, 2026 08:44
@Sodani

Sodani commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor Author

test result o/p for latest code change (Moving ceph_rgw config , keyring and id to global section)
Created share 1 and share 2 (rgw share)

[global]
        load printers = No
        printing = bsd
        printcap name = /dev/null
        disable spoolss = Yes
        smbd profiling level = on
        server smb transports = 445
        ceph_rgw:config_file = /etc/ceph/ceph.conf
        ceph_rgw:keyring_file = /etc/ceph/keyring
        ceph_rgw:id = smb.rgw.cluster.mysmb
        netbios name = mysmb

[share2]
        path = /
        vfs objects = ceph_rgw
        ceph_rgw:bucket = bkt2
        ceph_rgw:user_id = test1
        ceph_rgw:access_key = ABC123
        ceph_rgw:secret_access_key = ABC123
        ceph_rgw:debug = off
        read only = No
        browseable = Yes
        kernel share modes = no
        smbd profiling share = yes

[share1]
        path = /
        vfs objects = ceph_rgw
        ceph_rgw:bucket = bkt1
        ceph_rgw:user_id = test1
       ceph_rgw:access_key = ABC123
        ceph_rgw:secret_access_key = ABC123
        ceph_rgw:debug = off
        read only = No
        browseable = Yes
        kernel share modes = no
        smbd profiling share = yes

Deleted share2

[root@mycephfs14 ~]# podman exec -it 68fd88f6245f net conf list
[global]
        load printers = No
        printing = bsd
        printcap name = /dev/null
        disable spoolss = Yes
        smbd profiling level = on
        server smb transports = 445
        ceph_rgw:config_file = /etc/ceph/ceph.conf
        ceph_rgw:keyring_file = /etc/ceph/keyring
        ceph_rgw:id = smb.rgw.cluster.mysmb
        netbios name = mysmb

[share1]
        path = /
        vfs objects = ceph_rgw
        ceph_rgw:bucket = bkt1
        ceph_rgw:user_id = test1
        ceph_rgw:access_key = ABC123
        ceph_rgw:secret_access_key = ABC123
        ceph_rgw:debug = off
        read only = No
        browseable = Yes
        kernel share modes = no
        smbd profiling share = yes

Deleted Share1 and created cephfs share

[global]                                                                                                 
        load printers = No                                                                                                    
        printing = bsd                                                                                                        
        printcap name = /dev/null                                                                                             
        disable spoolss = Yes                                                                                                 
        smbd profiling level = on                                                                                             
        server smb transports = 445                                                                                           
        netbios name = mysmb                                                                                                  
                                                                                                                              
[smb1]                                                                                                                        
        path = /volumes/_nogroup/mysub/1e327b4a-edf3-4d4b-a35b-bd032dad019d/                                                  
        vfs objects = acl_xattr ceph_snapshots ceph_new                                                                       
        acl_xattr:security_acl_name = user.NTACL                                                                              
        ceph_new:config_file = /etc/ceph/ceph.conf                                                                            
        ceph_new:filesystem = mycephfs1                                                                                       
        ceph_new:user_id = smb.fs.cluster.mysmb                                                                               
        read only = No                                                                                                        
        browseable = Yes                                                                                                      
        kernel share modes = no                                                                                               
        x:ceph:id = mysmb.smb1                                                                                                
        smbd profiling share = yes                                                                                            
        posix locking = no
        ceph_new:proxy = yes

@avanthakkar
avanthakkar self-requested a review June 24, 2026 08:51

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

Some mostly minor stuff. I plan on doing some local practical tests of these patches later today.

Comment thread src/pybind/mgr/smb/handler.py Resolved
Comment thread src/pybind/mgr/smb/handler.py Resolved
Comment thread doc/mgr/smb.rst Resolved
Comment thread doc/mgr/smb.rst Resolved
Comment thread doc/mgr/smb.rst Resolved
Comment thread doc/mgr/smb.rst Resolved
Comment thread doc/mgr/smb.rst Resolved
Comment thread src/pybind/mgr/smb/resources.py Resolved
@Sodani
Sodani force-pushed the shsodani_ceph_rgw_new_module branch 2 times, most recently from 6112608 to 713c714 Compare June 25, 2026 12:32
@Sodani

Sodani commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

Shweta Sodani and others added 6 commits June 25, 2026 21:49
- Add RGWStorage component class for RGW bucket storage backend
- Include fields: bucket, user_id, access_key_id, secret_access_key
- Add password conversion support for credentials
- Update Share class to accept optional rgw field and added convert
  defination
- Update Share validation to support both cephfs and rgw backends
- Ensure exactly one storage backend (cephfs or rgw) is specified

This is the first step in implementing RGW storage support for SMB
shares, similar to the existing NFS RGW export functionality.

Signed-off-by: Shweta Sodani <[email protected]>
- Add rgw.py module for RGW integration
- Implement fetch_rgw_credentials() to get user credentials from radosgw-admin
- Implement validate_rgw_bucket() to check bucket existence
- Handle bucket owner lookup when user_id not provided
- Add proper error handling and logging

This provides the foundation for RGW authentication in SMB shares,
similar to the NFS RGW export implementation.

Signed-off-by: Shweta Sodani <[email protected]>
- Add 'smb share create rgw' CLI command
- Import rgw module for credential management
- Fetch RGW credentials using radosgw-admin
- Create Share resource with RGWStorage backend
- Handle errors from credential fetching

This enables users to create SMB shares backed by RGW buckets,
similar to 'nfs export create rgw' functionality.

Example usage:
  ceph smb share create rgw mysmb share1 mybucket

Signed-off-by: Shweta Sodani <[email protected]>
…rror handling

- Add _generate_rgw_share() function for RGW share configuration
- Skip CephFS authorization for RGW shares in cluster assembly
- Configure Samba VFS with RGW-specific parameters:
  - rgw_bucket, rgw_user_id, rgw_access_key, rgw_secret_key
- Validate bucket accessibility using radosgw-admin
- Ensure proper error handling in share creation flow

This enables the handler to generate proper Samba configuration for
RGW-backed shares along with validation and error handling.

Signed-off-by: Shweta Sodani <[email protected]>
Add test cases for RGW-backed SMB shares

Key changes:
- RGWStorage creation, validation, and serialization
- Edge cases: None values, mutual exclusion

Signed-off-by: Shweta Sodani <[email protected]>
Signed-off-by: Avan Thakkar <[email protected]>
@phlogistonjohn

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

Refactored RGW credential management to use dedicated RGWCredential
resources instead of embedding credentials directly in Share resources.
This will help to reuse the same credential across multiple shares using
same user.

RGW credentials must not appear in the public RADOS store, which any
client with pool caps can read. Instead, write a config:merge stub
containing only the credential fields to the private mon config-key
store, and pass its URI to the container alongside the primary config
URI via extra_config_uris.

- Public config: ceph_rgw:access_key / secret_access_key are empty strings
- Private stub: stored under smb/config/<cluster_id>/config.smb.rgw,
  contains only the real credential values via config:merge
- extra_config_uris: new Config field carrying supplementary URIs
  appended to SAMBACC_CONFIG after the primary config_uri

Signed-off-by: Avan Thakkar <[email protected]>
Signed-off-by: Shweta Sodani <[email protected]>
@phlogistonjohn

Copy link
Copy Markdown
Contributor

Teuthology results:
2 failures out of 50 tests. Both failures were well-known ctdb status flakes.

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

LGTM

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

LGTM, thanks!

@phlogistonjohn
phlogistonjohn merged commit c43103e into ceph:main Jun 26, 2026
6 checks passed
mheler added a commit to mheler/ceph that referenced this pull request Aug 26, 2026
Replace mon 'allow *' and the osd tag cap with the rgw profile. The
profile covers pool creation on first write, which is what the mon cap
was there for.

auth get-or-create refuses an entity that already exists with different
caps, so fall back to auth caps. Anything created before this carries
the old caps and would error on the next apply.

Signed-off-by: Matthew N. Heler <[email protected]>
(cherry picked from commit 853cdfa)

Conflicts:
	src/pybind/mgr/smb/rgw_auth.py
	  the mgr/smb module does not exist in squid; its prerequisite
	  (ceph#69103) has not been merged
	  there. Nothing to apply, so this is an empty commit recording
	  that the upstream change was intentionally not backported.
mheler added a commit to mheler/ceph that referenced this pull request Aug 26, 2026
Replace mon 'allow *' and the osd tag cap with the rgw profile. The
profile covers pool creation on first write, which is what the mon cap
was there for.

auth get-or-create refuses an entity that already exists with different
caps, so fall back to auth caps. Anything created before this carries
the old caps and would error on the next apply.

Signed-off-by: Matthew N. Heler <[email protected]>
(cherry picked from commit 853cdfa)

Conflicts:
	src/pybind/mgr/smb/rgw_auth.py
	  does not exist in tentacle; its prerequisite
	  (ceph#69103) has not been merged
	  there. Nothing to apply, so this is an empty commit recording
	  that the upstream change was intentionally not backported.
mheler added a commit to mheler/ceph that referenced this pull request Aug 26, 2026
Replace mon 'allow *' and the osd tag cap with the rgw profile. The
profile covers pool creation on first write, which is what the mon cap
was there for.

auth get-or-create refuses an entity that already exists with different
caps, so fall back to auth caps. Anything created before this carries
the old caps and would error on the next apply.

Signed-off-by: Matthew N. Heler <[email protected]>
(cherry picked from commit 853cdfa)

Conflicts:
	src/pybind/mgr/smb/rgw_auth.py
	  does not exist in umbrella; its prerequisite
	  (ceph#69103) has not been merged
	  there. Nothing to apply, so this is an empty commit recording
	  that the upstream change was intentionally not backported.
mheler added a commit to mheler/ceph that referenced this pull request Sep 3, 2026
Replace mon 'allow *' and the osd tag cap with the rgw profile. The
profile covers pool creation on first write, which is what the mon cap
was there for.

auth get-or-create refuses an entity that already exists with different
caps, so fall back to auth caps. Anything created before this carries
the old caps and would error on the next apply.

Signed-off-by: Matthew N. Heler <[email protected]>
(cherry picked from commit 853cdfa)

Conflicts:
	src/pybind/mgr/smb/rgw_auth.py
	  the mgr/smb module does not exist in squid; its prerequisite
	  (ceph#69103) has not been merged
	  there. Nothing to apply, so this is an empty commit recording
	  that the upstream change was intentionally not backported.
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.

3 participants