Cleanup #44977
openmgr: make inter-module calls explicit
0%
Description
mgr.remote
API method allows ceph-mgr modules to invoke methods from other modules. The following is a partial diagram of the current dependencies (>30).
While this provides straight-forward communication between modules, it basically hides the dependencies between them ("every Python method might be an API for someone else"), and might pose maintainability issues and security risks (as compromising a module might result in the exposure of all other modules' data and operations).
Possible solutions would involve make the 'contract' explicit:
- Using a decorator @export()/@public()/@remote() to highlight which methods are being consumed by other modules:
# called module/provider @remote(from=['dashboard']) def _json(self): ...
- Reusing the approach taken for COMMANDS/OPTIONS:
# calling module REMOTES = [ {'module': 'progress', 'method': '_json'}, ]
The above could be or not enforced by ceph-mgr
(enforcing meaning that a remote method needs to be either exported by the provider or registered by the consumer). Just being a hint would help some module's contributors learn that someone else is using a module's method externally.
Files
Updated by Sebastian Wagner about 4 years ago
This is incomplete. All calls to methods of OrchestratorClientMixin are also remote.