From: Jeff Layton Date: Wed, 6 Feb 2019 19:35:32 +0000 (-0500) Subject: mgr/rook: fix result handling for RookWriteCompletions X-Git-Tag: v14.1.0~177^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ae295542e88a88865f90209fb0962f39099bf9a9;p=ceph.git mgr/rook: fix result handling for RookWriteCompletions Add a result property, and ensure that the create_osd codepath returns a string with the result when an exception isn't triggered. Signed-off-by: Jeff Layton --- diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index 850ccfaf086d..2199b43a819d 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -78,7 +78,7 @@ class RookWriteCompletion(orchestrator.WriteCompletion): self.executed = False # Result of k8s API call, this is set if executed==True - self.k8s_result = None + self._result = None self.effective = False @@ -92,6 +92,10 @@ class RookWriteCompletion(orchestrator.WriteCompletion): global all_completions all_completions.append(self) + @property + def result(self): + return self._result + @property def is_persistent(self): return (not self.is_errored) and self.executed @@ -106,7 +110,7 @@ class RookWriteCompletion(orchestrator.WriteCompletion): def execute(self): if not self.executed: - self.k8s_result = self.execute_cb() + self._result = self.execute_cb() self.executed = True if not self.effective: @@ -403,7 +407,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): "support OSD creation.") def execute(): - self.rook_cluster.add_osds(drive_group, all_hosts) + return self.rook_cluster.add_osds(drive_group, all_hosts) def is_complete(): # Find OSD pods on this host diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index 740151f620f3..5d319b4758c1 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -404,8 +404,7 @@ class RookCluster(object): }) if len(patch) == 0: - log.warning("No-op adding stateful service") - return + return "No change" try: self.rook_api_patch( @@ -416,3 +415,5 @@ class RookCluster(object): raise ApplyException( "Failed to create OSD entries in Cluster CRD: {0}".format( e)) + + return "Success"