Project

General

Profile

Bug #52757

ceph-mgr modules require MgrModule at module level

Added by Joshua Hesketh over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

The documentation0 states that to create a ceph-mgr module, you just need a file `module.py` with a class that inherits from `MgrModule`.

However, `PyModuleRegistry.cc` simply checks that `module.py` exists in the directory, and then passes the python module onto `PyModule` which checks for a subclass of `MgrModule`. In other words, it is necessary for the MgrModule subclass to exist in the module's `__init__.py`. This is done by the boilerplate that all modules have:

from .module import MyModule

Either the documentation needs updating to make this requirement clearer, or PyModule needs to actually load `module.py` and look in there fore the subclass.

The latter is my preference as if we are going to require `module.py`, then we should use it. If we simply require the subclass to exist inside the python module (ie `__init__.py`), then perhaps we should remove the requirement for a specific file to allow a developer to place their module however they see fit so long as it is exposed/imported via init.py.

(Please excuse the confusing terminology between python modules and ceph-mgr modules).

[0] https://docs.ceph.com/en/latest/mgr/modules/#creating-a-module

History

#1 Updated by Sebastian Wagner over 2 years ago

  • Priority changed from Normal to Low

Also available in: Atom PDF