From 4a45b438c8921e47e329fb04535f8ecedf2a3051 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 18 Feb 2020 17:57:00 -0600 Subject: [PATCH] mgr/pg_autoscaler: fix division by zero Fixes: https://tracker.ceph.com/issues/44186 Signed-off-by: Sage Weil --- src/pybind/mgr/pg_autoscaler/module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index a3668532ed28..404fb503a2f0 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -508,7 +508,7 @@ class PgAutoscaler(MgrModule): too_much_target_bytes = [] for root_id, total in iteritems(total_bytes): total_target = total_target_bytes[root_id] - if total_target > 0 and total > root_map[root_id].capacity: + if total_target > 0 and total > root_map[root_id].capacity and root_map[root_id].capacity: too_much_target_bytes.append( 'Pools %s overcommit available storage by %.03fx due to ' 'target_size_bytes %s on pools %s' % ( @@ -518,7 +518,7 @@ class PgAutoscaler(MgrModule): target_bytes_pools[root_id] ) ) - elif total_target > root_map[root_id].capacity: + elif total_target > root_map[root_id].capacity and root_map[root_id].capacity: too_much_target_bytes.append( 'Pools %s overcommit available storage by %.03fx due to ' 'collective target_size_bytes of %s' % ( -- 2.47.3