Bug #55817
openSome of ceph-mgr plugins don't have 'NOTIFY_TYPE' defined
0%
Description
During the start, ceph-mgr daemon could fail with the error messages shown below:
<...>
2022-06-01T12:48:15.170-0400 7f713a20a500 1 mgr[py] Loading python module 'balancer'
2022-06-01T12:48:15.191-0400 7f713a20a500 10 mgr[py] Computed sys.path '/usr/share/ceph/mgr:/local/lib/python3.8/dist-packages:/lib/python3/dist-packages:/lib/python3.8/dist-packages:lib/python38.zip:/lib/python3.8:/lib/python3.8/lib-dynload'
2022-06-01T12:48:15.293-0400 7f713a20a500 4 mgr[py] load_subclass_of: found class: 'balancer.Module'
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer status
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer mode name=mode,type=CephChoices,strings=none|crush-compat|upmap
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer on
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer off
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer pool ls
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer pool add name=pools,type=CephString,n=N
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer pool rm name=pools,type=CephString,n=N
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer eval name=option,type=CephString,req=false
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer eval-verbose name=option,type=CephString,req=false
2022-06-01T12:48:15.293-0400
7f713a20a500 20 mgr[py] loaded command balancer optimize
name=plan,type=CephString name=pools,type=CephString,n=N,req=false
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer show name=plan,type=CephString
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer rm name=plan,type=CephString
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer reset
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer dump name=plan,type=CephString
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer ls
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded command balancer execute name=plan,type=CephString
2022-06-01T12:48:15.293-0400 7f713a20a500 10 mgr[py] loaded 16 commands
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option active
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option begin_time
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option end_time
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option begin_weekday
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option end_weekday
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option crush_compat_max_iterations
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option crush_compat_metrics
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option crush_compat_step
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option min_score
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option mode
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option sleep_interval
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option upmap_max_optimizations
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option upmap_max_deviation
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option pool_ids
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option log_level
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option log_to_file
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option log_to_cluster
2022-06-01T12:48:15.293-0400 7f713a20a500 20 mgr[py] loaded module option log_to_cluster_level
2022-06-01T12:48:15.293-0400 7f713a20a500 10 mgr[py] loaded 18 options
2022-06-01T12:48:15.293-0400 7f713a20a500 -1 mgr[py] Module balancer has missing NOTIFY_TYPES member
<...>
The error shown at the bottom line prevents systemd unit ceph-mgr@.service from a start sending the daemon into infinite restart loop.
The RC of the issue that some of plugins, including alarms, balancer, influx e.a. don't have a variable NOTIFY_TYPES of the NotifyType class defined here https://github.com/ceph/ceph/blob/v16.2.9/src/pybind/mgr/mgr_module.py#L86 and introduced some time ago. The technical cause of the error is here: https://github.com/ceph/ceph/blob/v16.2.9/src/mgr/PyModule.cc#L476
The current work around could be to add a dummy type of notification into the enum class, and then use it in plugins for the backward compatibility by adding the NotifyType to the import:
from mgr_module import MgrModule, HandleCommandResult, NotifyType
and then define a NOTIFY_TYPES list.
NOTIFY_TYPES = [ NotifyType.empty ]
This fix was tested with alarms and balancer plugins. The affected version is (at least) 16.2.9
No data to display