X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Fcontrollers%2Fdaemon.py;h=d5c288131b92e5263f92f49607341ee5d4684ec7;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=eeea5a326255541fc08d071b51d15834265d836f;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/controllers/daemon.py b/ceph/src/pybind/mgr/dashboard/controllers/daemon.py index eeea5a326..d5c288131 100644 --- a/ceph/src/pybind/mgr/dashboard/controllers/daemon.py +++ b/ceph/src/pybind/mgr/dashboard/controllers/daemon.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from typing import Optional +from typing import List, Optional from ..exceptions import DashboardException from ..security import Scope @@ -31,3 +31,19 @@ class Daemon(RESTController): orch = OrchClient.instance() res = orch.daemons.action(action=action, daemon_name=daemon_name, image=container_image) return res + + @raise_if_no_orchestrator([OrchFeature.DAEMON_LIST]) + @handle_orchestrator_error('daemon') + @RESTController.MethodMap(version=APIVersion.DEFAULT) + def list(self, daemon_types: Optional[List[str]] = None): + """List all daemons in the cluster. Also filter by the daemon types specified + + :param daemon_types: List of daemon types to filter by. + :return: Returns list of daemons. + :rtype: list + """ + orch = OrchClient.instance() + daemons = [d.to_dict() for d in orch.services.list_daemons()] + if daemon_types: + daemons = [d for d in daemons if d['daemon_type'] in daemon_types] + return daemons