Merge pull request #13531 from LiumxNL/fix-osd-utilization

mon/OSDMonitor: fix dividing by zero in OSDUtilizationDumper

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-02-27 17:51:03 +08:00 committed by GitHub
commit af5e1e8d39

View File

@ -679,7 +679,9 @@ protected:
int64_t kb = 0, kb_used = 0, kb_avail = 0;
double util = 0;
if (get_bucket_utilization(qi.id, &kb, &kb_used, &kb_avail))
util = 100.0 * (double)kb_used / (double)kb;
if (kb_used && kb)
util = 100.0 * (double)kb_used / (double)kb;
double var = 1.0;
if (average_util)
var = util / average_util;