Skip to content

Commit e003be8

Browse files
committed
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 <[email protected]>
1 parent 0e5e1aa commit e003be8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/pybind/mgr/ceph_module.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class BaseMgrModule(object):
107107
def _ceph_set_uri(self, uri: str) -> None: ...
108108
def _ceph_set_device_wear_level(self, devid: str, val: float) -> None: ...
109109
def _ceph_have_mon_connection(self) -> bool: ...
110-
def _ceph_update_progress_event(self, evid: str, desc: str, progress: float, add_to_ceph_s: bool) -> None: ...
110+
def _ceph_update_progress_event(self, evid: str, desc: str, progress: float, add_to_ceph_s: bool=False) -> None: ...
111111
def _ceph_complete_progress_event(self, evid: str) -> None: ...
112112
def _ceph_clear_all_progress_events(self) -> None: ...
113113
def _ceph_dispatch_remote(self, module_name: str, method_name: str, *args: Any, **kwargs: Any) -> Any: ...

src/pybind/mgr/mgr_module.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2506,11 +2506,13 @@ def have_mon_connection(self) -> bool:
25062506

25072507
return self._ceph_have_mon_connection()
25082508

2509+
@API.perm('w')
2510+
@API.expose
25092511
def update_progress_event(self,
25102512
evid: str,
25112513
desc: str,
25122514
progress: float,
2513-
add_to_ceph_s: bool) -> None:
2515+
add_to_ceph_s: bool = False) -> None:
25142516
return self._ceph_update_progress_event(evid, desc, progress, add_to_ceph_s)
25152517

25162518
@API.perm('w')

0 commit comments

Comments
 (0)