diff options
author | Sage Weil <sage@newdream.net> | 2012-05-30 11:53:18 -0700 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2012-05-30 11:53:37 -0700 |
commit | a167213a9eecb796f6ec89492f22bae86719effa (patch) | |
tree | f7c9c8508957d13d5de88da8c562ae88ac7ffa12 /src/mon/OSDMonitor.cc | |
parent | 519fadbc96bc496b7da7920531d19472e6c43786 (diff) | |
download | ceph-a167213a9eecb796f6ec89492f22bae86719effa.tar.gz |
mon: fix reweight_by_utilization waiting
Propose if we changed something, but not if we don't.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'src/mon/OSDMonitor.cc')
-rw-r--r-- | src/mon/OSDMonitor.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index cfe710363ff..ec083c3fda6 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -316,6 +316,7 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str) oss << buf; std::string sep; oss << "overloaded osds: "; + bool changed = false; for (hash_map<int,osd_stat_t>::const_iterator p = pgm.osd_stat.begin(); p != pgm.osd_stat.end(); ++p) { @@ -334,6 +335,7 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str) (float)weight / (float)0x10000, (float)new_weight / (float)0x10000); oss << buf << sep; + changed = true; } } if (sep.empty()) { @@ -341,7 +343,7 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str) } out_str = oss.str(); dout(0) << "reweight_by_utilization: finished with " << out_str << dendl; - return 0; + return changed; } void OSDMonitor::create_pending() @@ -2392,11 +2394,16 @@ bool OSDMonitor::prepare_command(MMonCommand *m) } string out_str; err = reweight_by_utilization(oload, out_str); - if (err) { - ss << "FAILED to reweight-by-utilization: " << out_str; + if (err < 0) { + ss << "FAILED reweight-by-utilization: " << out_str; } - else { + else if (err == 0) { + ss << "no change: " << out_str; + } else { ss << "SUCCESSFUL reweight-by-utilization: " << out_str; + getline(ss, rs); + paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version())); + return true; } } else if (m->cmd.size() == 3 && m->cmd[1] == "thrash") { |