]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: avoid to reweight a currently out osd
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 5 May 2016 08:19:06 +0000 (16:19 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 6 May 2016 03:36:26 +0000 (11:36 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/OSDMonitor.cc

index e8e1fa778a58af773e4d6031576a3dbeca608fb7..3991c3c06d12ab2f368d25720bf07410803d0582 100644 (file)
@@ -632,13 +632,17 @@ int OSDMonitor::reweight_by_utilization(int oload,
         util_by_osd.begin();
        p != util_by_osd.end();
        ++p) {
+    unsigned weight = osdmap.get_weight(p->first);
+    if (weight == 0) {
+      // skip if OSD is currently out
+      continue;
+    }
     float util = p->second;
 
     if (util >= overload_util) {
       // 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
-      unsigned weight = osdmap.get_weight(p->first);
       unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
       if (weight > max_change)
        new_weight = MAX(new_weight, weight - max_change);
@@ -665,7 +669,6 @@ int OSDMonitor::reweight_by_utilization(int oload,
     }
     if (!no_increasing && util <= underload_util) {
       // assign a higher weight.. if we can.
-      unsigned weight = osdmap.get_weight(p->first);
       unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
       new_weight = MIN(new_weight, weight + max_change);
       if (new_weight > 0x10000)