]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: fix result handling for RookWriteCompletions 26317/head
authorJeff Layton <jlayton@redhat.com>
Wed, 6 Feb 2019 19:35:32 +0000 (14:35 -0500)
committerJeff Layton <jlayton@redhat.com>
Thu, 7 Feb 2019 14:36:43 +0000 (09:36 -0500)
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 <jlayton@redhat.com>
src/pybind/mgr/rook/module.py
src/pybind/mgr/rook/rook_cluster.py

index 850ccfaf086dbe2f73604730fe3f7aa267ea3182..2199b43a819d68b14c7e727c1bac48c8201ee98b 100644 (file)
@@ -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
index 740151f620f3196994d1d8ba90292c80258b14cc..5d319b4758c19d8274808c10846859ddb393c531 100644 (file)
@@ -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"