summaryrefslogtreecommitdiff
path: root/src/mon/OSDMonitor.cc
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-05-30 11:53:35 -0700
committerSage Weil <sage@newdream.net>2012-05-30 11:53:35 -0700
commit519fadbc96bc496b7da7920531d19472e6c43786 (patch)
treedc2036de139eb4330b597bdffb2b2e380903e0ee /src/mon/OSDMonitor.cc
parent07498d66233f388807a458554640cb77424114c0 (diff)
downloadceph-519fadbc96bc496b7da7920531d19472e6c43786.tar.gz
osd: fix rewewight_by_utilization
Update the incremental, not the in-memory OSDMap! Fixes: #2454 Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'src/mon/OSDMonitor.cc')
-rw-r--r--src/mon/OSDMonitor.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 38f61a65655..cfe710363ff 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -326,12 +326,13 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str)
// Assign a lower weight to overloaded OSDs. The current weight
// is a factor to take into account the original weights,
// to represent e.g. differing storage capacities
- float weight = osdmap.get_weightf(p->first);
- float new_weight = (average_util / util) * weight;
- osdmap.set_weightf(p->first, new_weight);
+ unsigned weight = osdmap.get_weight(p->first);
+ unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
+ pending_inc.new_weight[p->first] = new_weight;
char buf[128];
snprintf(buf, sizeof(buf), "%d [%04f -> %04f]", p->first,
- weight, new_weight);
+ (float)weight / (float)0x10000,
+ (float)new_weight / (float)0x10000);
oss << buf << sep;
}
}