mgr/dashboard: add progress module tasks to list of dashboard tasks

Fixes: https://tracker.ceph.com/issues/38202

Signed-off-by: Ricardo Dias <rdias@suse.com>
This commit is contained in:
Ricardo Dias 2019-07-15 15:08:39 +01:00
parent 63334ee2b2
commit 96ff50e883
No known key found for this signature in database
GPG Key ID: 74390C579BD37B68
2 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@ from ..security import Permission, Scope
from ..controllers.rbd_mirroring import get_daemons_and_pools
from ..exceptions import ViewCacheNoDataException
from ..tools import TaskManager
from ..services import progress
@ApiController('/summary')
@ -73,6 +74,13 @@ class Summary(BaseController):
executing_tasks = [task for task in exe_t if self._task_permissions(task['name'])]
finished_tasks = [task for task in fin_t if self._task_permissions(task['name'])]
e, f = progress.get_progress_tasks()
executing_tasks.extend(e)
finished_tasks.extend(f)
executing_tasks.sort(key=lambda t: t['begin_time'], reverse=True)
finished_tasks.sort(key=lambda t: t['end_time'], reverse=True)
result = {
'health_status': self._health_status(),
'mgr_id': mgr.get_mgr_id(),

View File

@ -3,12 +3,21 @@ from __future__ import absolute_import
from . import ApiController, RESTController
from ..tools import TaskManager
from ..services import progress
@ApiController('/task')
class Task(RESTController):
def list(self, name=None):
executing_t, finished_t = TaskManager.list_serializable(name)
e, f = progress.get_progress_tasks()
executing_t.extend(e)
finished_t.extend(f)
executing_t.sort(key=lambda t: t['begin_time'], reverse=True)
finished_t.sort(key=lambda t: t['end_time'], reverse=True)
return {
'executing_tasks': executing_t,
'finished_tasks': finished_t