Project

General

Profile

Actions

Cleanup #44977

open

mgr: make inter-module calls explicit

Added by Ernesto Puerta about 4 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
ceph-mgr
Target version:
-
% Done:

0%

Tags:
maintainability
Backport:
Reviewed:
Affected Versions:
Pull request ID:

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

Ceph-mgr_remote_deps.png (22.7 KB) Ceph-mgr_remote_deps.png Ernesto Puerta, 04/07/2020 03:37 PM
Actions #1

Updated by Sebastian Wagner about 4 years ago

This is incomplete. All calls to methods of OrchestratorClientMixin are also remote.

Actions

Also available in: Atom PDF