]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/progress: added the time an event has been in progress
authorKamoltat (Junior) Sirivadhna <ksirivad@redhat.com>
Fri, 5 Jul 2019 20:32:50 +0000 (16:32 -0400)
committerKamoltat (Junior) Sirivadhna <ksirivad@redhat.com>
Fri, 5 Jul 2019 20:32:50 +0000 (16:32 -0400)
In ceph -s and out/mgr.x.log
now can see how long event has been in
progress for when osd is marked in and out.

Signed-off-by: Kamoltat (Junior) Sirivadhna <ksirivad@redhat.com>
src/pybind/mgr/progress/module.py

index 46ab9e7d03914a303f01e9ce0ef907802803b790..07bffec2d321952188c59fe87e4c04f343c9df86 100644 (file)
@@ -215,13 +215,25 @@ class PgRecoveryEvent(Event):
                         # as half done.
                         ratio = 0.5
                     complete_accumulate += ratio
+        
+        # Update duration of event in seconds/minutes/hours
+        duration = (datetime.datetime.utcnow() - self.started_at)
+        duration_sec = duration.seconds
+        duration_min = duration_sec //60
+        duration_hr = duration_min // 60
 
         self._pgs = list(set(self._pgs) ^ complete)
         completed_pgs = self._original_pg_count - len(self._pgs)
         self._progress = (completed_pgs + complete_accumulate)\
             / self._original_pg_count
-        self._refresh()
 
+        # Because the spacing of 'in' and 'out' characters are different
+        if self._message[31] == "i":
+            self._message = self._message[:34] + "(since {0}h {1}m {2}s)".format(duration_hr, duration_min, duration_sec)
+        else:
+            self._message = self._message[:34] + " (since {0}h {1}m {2}s)".format(duration_hr, duration_min, duration_sec)
+        self._refresh()
+        
         log.info("Updated progress to {0} ({1})".format(
             self._progress, self._message
         ))