From: Kiefer Chang Date: Wed, 2 Sep 2020 12:25:52 +0000 (+0800) Subject: mgr/dashboard: refator orchestrator service and daemon APIs X-Git-Tag: v15.2.8~5^2~1^2~2^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e4467b7df16e5162e4a98d3d5089a2569713ffa4;p=ceph.git mgr/dashboard: refator orchestrator service and daemon APIs - Allow listing services by service_type. - Allow listing daemons by daemon_type. Signed-off-by: Kiefer Chang (cherry picked from commit b88638873bd738af1ce258549abb6c25e0683907) --- diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index c8a4d900723..bb9014bec65 100644 --- a/src/pybind/mgr/dashboard/controllers/host.py +++ b/src/pybind/mgr/dashboard/controllers/host.py @@ -166,7 +166,7 @@ class Host(RESTController): @raise_if_no_orchestrator def daemons(self, hostname: str) -> List[dict]: orch = OrchClient.instance() - daemons = orch.services.list_daemons(None, hostname) + daemons = orch.services.list_daemons(hostname=hostname) return [d.to_json() for d in daemons] @handle_orchestrator_error('host') diff --git a/src/pybind/mgr/dashboard/controllers/service.py b/src/pybind/mgr/dashboard/controllers/service.py index 9f1e70bb94d..509a2147a68 100644 --- a/src/pybind/mgr/dashboard/controllers/service.py +++ b/src/pybind/mgr/dashboard/controllers/service.py @@ -13,7 +13,7 @@ class Service(RESTController): @raise_if_no_orchestrator def list(self, service_name: Optional[str] = None) -> List[dict]: orch = OrchClient.instance() - return [service.to_json() for service in orch.services.list(service_name)] + return [service.to_json() for service in orch.services.list(service_name=service_name)] @raise_if_no_orchestrator def get(self, service_name: str) -> List[dict]: @@ -27,5 +27,5 @@ class Service(RESTController): @raise_if_no_orchestrator def daemons(self, service_name: str) -> List[dict]: orch = OrchClient.instance() - daemons = orch.services.list_daemons(service_name) + daemons = orch.services.list_daemons(service_name=service_name) return [d.to_json() for d in daemons] diff --git a/src/pybind/mgr/dashboard/services/orchestrator.py b/src/pybind/mgr/dashboard/services/orchestrator.py index ea33b9a37ee..a1f22a9a067 100644 --- a/src/pybind/mgr/dashboard/services/orchestrator.py +++ b/src/pybind/mgr/dashboard/services/orchestrator.py @@ -84,8 +84,10 @@ class InventoryManager(ResourceManager): class ServiceManager(ResourceManager): @wait_api_result - def list(self, service_name: Optional[str] = None) -> List[ServiceDescription]: - return self.api.describe_service(None, service_name) + def list(self, + service_type: Optional[str] = None, + service_name: Optional[str] = None) -> List[ServiceDescription]: + return self.api.describe_service(service_type, service_name) @wait_api_result def get(self, service_name: str) -> ServiceDescription: @@ -94,8 +96,11 @@ class ServiceManager(ResourceManager): @wait_api_result def list_daemons(self, service_name: Optional[str] = None, + daemon_type: Optional[str] = None, hostname: Optional[str] = None) -> List[DaemonDescription]: - return self.api.list_daemons(service_name, host=hostname) + return self.api.list_daemons(service_name=service_name, + daemon_type=daemon_type, + host=hostname) def reload(self, service_type, service_ids): if not isinstance(service_ids, list):