]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: adapt to now orch interface
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 8 Feb 2021 09:00:21 +0000 (10:00 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 1 Mar 2021 15:50:42 +0000 (16:50 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/dashboard/services/orchestrator.py

index 3d25091e29960cbbb848906523d81dee3d7c1c60..5463c4e7a757b44c8ae25e0732e70440270450e0 100644 (file)
@@ -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)])