From: Ernesto Puerta Date: Fri, 5 Sep 2025 15:40:21 +0000 (+0200) Subject: mgr/progress: expose API from CLI X-Git-Tag: testing/wip-vshankar-testing-20250924.134331-debug~13^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e003be839b09793d12ce0cbc65c601771ff895a6;p=ceph-ci.git mgr/progress: expose API from CLI Fixes: https://tracker.ceph.com/issues/72893 Through cli-api mgr module, users can invoke ceph-mgr Python API from the CLI. The progress module API was partially exposed. This change allows them to create progress event from the CLI. Example: ```bash ceph mgr module enable cli_api ceph mgr cli update_progress_event evid_18 "Upgrading foo..." 0.1 --add-to-ceph-s { "evid_18": { "message": "Upgrading foo...", "progress": 0.10000000149011612, "add_to_ceph_s": true } } ``` Signed-off-by: Ernesto Puerta --- diff --git a/src/pybind/mgr/ceph_module.pyi b/src/pybind/mgr/ceph_module.pyi index 9c9e4c0d339..69eb7e863de 100644 --- a/src/pybind/mgr/ceph_module.pyi +++ b/src/pybind/mgr/ceph_module.pyi @@ -107,7 +107,7 @@ class BaseMgrModule(object): def _ceph_set_uri(self, uri: str) -> None: ... def _ceph_set_device_wear_level(self, devid: str, val: float) -> None: ... def _ceph_have_mon_connection(self) -> bool: ... - def _ceph_update_progress_event(self, evid: str, desc: str, progress: float, add_to_ceph_s: bool) -> None: ... + def _ceph_update_progress_event(self, evid: str, desc: str, progress: float, add_to_ceph_s: bool=False) -> None: ... def _ceph_complete_progress_event(self, evid: str) -> None: ... def _ceph_clear_all_progress_events(self) -> None: ... def _ceph_dispatch_remote(self, module_name: str, method_name: str, *args: Any, **kwargs: Any) -> Any: ... diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 2830a0b1622..8549e15d8e2 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -2506,11 +2506,13 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): return self._ceph_have_mon_connection() + @API.perm('w') + @API.expose def update_progress_event(self, evid: str, desc: str, progress: float, - add_to_ceph_s: bool) -> None: + add_to_ceph_s: bool = False) -> None: return self._ceph_update_progress_event(evid, desc, progress, add_to_ceph_s) @API.perm('w')