From: Sebastian Wagner Date: Mon, 8 Feb 2021 09:00:21 +0000 (+0100) Subject: mgr/dashboard: adapt to now orch interface X-Git-Tag: v17.1.0~2786^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b92dc7120588b53293f8fcff5180b428d7f4a1ff;p=ceph.git mgr/dashboard: adapt to now orch interface Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/dashboard/services/orchestrator.py b/src/pybind/mgr/dashboard/services/orchestrator.py index 3d25091e2996..5463c4e7a757 100644 --- a/src/pybind/mgr/dashboard/services/orchestrator.py +++ b/src/pybind/mgr/dashboard/services/orchestrator.py @@ -6,8 +6,8 @@ from functools import wraps from typing import Any, Dict, List, Optional from ceph.deployment.service_spec import ServiceSpec -from orchestrator import Completion, DaemonDescription, DeviceLightLoc, \ - HostSpec, InventoryFilter, OrchestratorClientMixin, OrchestratorError, \ +from orchestrator import DaemonDescription, DeviceLightLoc, HostSpec, \ + InventoryFilter, OrchestratorClientMixin, OrchestratorError, OrchResult, \ ServiceDescription, raise_if_exception from .. import mgr @@ -31,15 +31,11 @@ class OrchestratorAPI(OrchestratorClientMixin): available=False, message='Orchestrator is unavailable: {}'.format(str(e))) - def orchestrator_wait(self, completions): - return self._orchestrator_wait(completions) - def wait_api_result(method): @wraps(method) def inner(self, *args, **kwargs): completion = method(self, *args, **kwargs) - self.api.orchestrator_wait([completion]) raise_if_exception(completion) return completion.result return inner @@ -68,11 +64,11 @@ class HostManger(ResourceManager): return self.api.remove_host(hostname) @wait_api_result - def add_label(self, host: str, label: str) -> Completion: + def add_label(self, host: str, label: str) -> OrchResult[str]: return self.api.add_host_label(host, label) @wait_api_result - def remove_label(self, host: str, label: str) -> Completion: + def remove_label(self, host: str, label: str) -> OrchResult[str]: return self.api.remove_host_label(host, label) @@ -117,7 +113,7 @@ class ServiceManager(ResourceManager): raise_if_exception(c) @wait_api_result - def apply(self, service_spec: Dict) -> Completion: + def apply(self, service_spec: Dict) -> OrchResult[List[str]]: spec = ServiceSpec.from_json(service_spec) return self.api.apply([spec]) @@ -178,7 +174,7 @@ class OrchClient(object): @wait_api_result def blink_device_light(self, hostname, device, ident_fault, on): - # type: (str, str, str, bool) -> Completion + # type: (str, str, str, bool) -> OrchResult[List[str]] return self.api.blink_device_light( ident_fault, on, [DeviceLightLoc(hostname, device, device)])