]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/smb: remove restriction on 1MiB smb config objects in rados 63562/head
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 28 May 2025 16:55:25 +0000 (12:55 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 28 May 2025 16:55:25 +0000 (12:55 -0400)
commitaf8214d46b81113ae910331d83c1f99e3db0ef01
treee2327a2999dd1ddc9fb897a702bb0683a695ec67
parentbf95acdd1d1752c984db57c827129573e8f02cec
mgr/smb: remove restriction on 1MiB smb config objects in rados

For convenience I had originally capped the size of objects created
by the smb mgr module to 1MiB in order to avoid having to read objects
with more than one rados call. This value matched a value hardcoded in
the NFS mgr module.

However, testers are trying to create a large number of shares and some
configurations caused the JSON contents we try to write to a rados
object to exceed 1MiB. Implement a _read_all function to allow objects
to exceed the chunk size and remove the matching restriction from
the write path.

I was able to test this change by create 4096 shares. Prior to the
change the a traceback similar to the following would occur. After the
change it did not occur and I could verify the object in rados was
>1MiB.
```
Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1930, in
_handle_command
    return CLICommand.COMMANDS[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 527, in call
    return self.func(mgr, **kwargs)
  File "/usr/share/ceph/mgr/object_format.py", line 592, in
_format_response
    robj = f(*args, **kwargs)
  File "/usr/share/ceph/mgr/smb/module.py", line 148, in apply_resources
    return self._handler.apply(resources.load_text(inbuf))
  File "/usr/share/ceph/mgr/smb/handler.py", line 412, in apply
    self._sync_modified(results)
  File "/usr/share/ceph/mgr/smb/handler.py", line 580, in _sync_modified
    self._sync_clusters(cluster_ids)
  File "/usr/share/ceph/mgr/smb/handler.py", line 564, in _sync_clusters
    self._save_cluster_settings(change_group)
  File "/usr/share/ceph/mgr/smb/handler.py", line 640, in
_save_cluster_settings
    _save_pending_config(
  File "/usr/share/ceph/mgr/smb/handler.py", line 1397, in
_save_pending_config
    centry.set(cconfig)
  File "/usr/share/ceph/mgr/smb/rados_store.py", line 89, in set
    self.write(json.dumps(obj))
  File "/usr/share/ceph/mgr/smb/rados_store.py", line 71, in write
    assert len(data) < _CHUNK_SIZE
AssertionError
```

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/rados_store.py