From: xie xingguo Date: Fri, 19 Jul 2019 08:43:57 +0000 (+0800) Subject: mgr/progress: clamp pg recovery ratio to 0 X-Git-Tag: v15.1.0~2049^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8df45b4e15cf037b8b5623537621441bd30642da;p=ceph.git mgr/progress: clamp pg recovery ratio to 0 There were times that I could observe the num_bytes_recovered field of pg_stat_t may decrease, e.g., due to the primary switching (or similar). Clamp the pg recovery ratio to 0 too since it might go negative. Signed-off-by: xie xingguo --- diff --git a/src/pybind/mgr/progress/module.py b/src/pybind/mgr/progress/module.py index 1a529a81213..1c940376ed2 100644 --- a/src/pybind/mgr/progress/module.py +++ b/src/pybind/mgr/progress/module.py @@ -237,6 +237,7 @@ class PgRecoveryEvent(Event): # exceed the contents of the PG (moment in time), we # must clamp this ratio = min(ratio, 1.0) + ratio = max(ratio, 0.0) else: # Dataless PGs (e.g. containing only OMAPs) count