]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/pg_autoscaler: fix division by zero 33420/head
authorSage Weil <sage@redhat.com>
Tue, 18 Feb 2020 23:57:00 +0000 (17:57 -0600)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Thu, 20 Feb 2020 02:03:42 +0000 (09:03 +0700)
Fixes: https://tracker.ceph.com/issues/44186
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 4a45b438c8921e47e329fb04535f8ecedf2a3051)

src/pybind/mgr/pg_autoscaler/module.py

index c452d555fdf394981aa4aa16df4d55dea6829baf..4954bd3a529aacdac3ab1be854b9dad403ade797 100644 (file)
@@ -449,7 +449,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' % (
@@ -459,7 +459,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' % (