Skip to content

Commit

Permalink
pybind/mgr/balancer: re-initialize everything on instantiating a new …
Browse files Browse the repository at this point in the history
…Eval

Otherwise there might be obsolete pool/root infos etc.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
  • Loading branch information
xiexingguo committed Jan 29, 2018
1 parent f8029dc commit bce4fbf
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/pybind/mgr/balancer/module.py
Expand Up @@ -97,28 +97,27 @@ def show(self):


class Eval:
root_ids = {} # root name -> id
pool_name = {} # pool id -> pool name
pool_id = {} # pool name -> id
pool_roots = {} # pool name -> root name
root_pools = {} # root name -> pools
target_by_root = {} # root name -> target weight map
count_by_pool = {}
count_by_root = {}
actual_by_pool = {} # pool -> by_* -> actual weight map
actual_by_root = {} # pool -> by_* -> actual weight map
total_by_pool = {} # pool -> by_* -> total
total_by_root = {} # root -> by_* -> total
stats_by_pool = {} # pool -> by_* -> stddev or avg -> value
stats_by_root = {} # root -> by_* -> stddev or avg -> value

score_by_pool = {}
score_by_root = {}

score = 0.0

def __init__(self, ms):
self.ms = ms
self.root_ids = {} # root name -> id
self.pool_name = {} # pool id -> pool name
self.pool_id = {} # pool name -> id
self.pool_roots = {} # pool name -> root name
self.root_pools = {} # root name -> pools
self.target_by_root = {} # root name -> target weight map
self.count_by_pool = {}
self.count_by_root = {}
self.actual_by_pool = {} # pool -> by_* -> actual weight map
self.actual_by_root = {} # pool -> by_* -> actual weight map
self.total_by_pool = {} # pool -> by_* -> total
self.total_by_root = {} # root -> by_* -> total
self.stats_by_pool = {} # pool -> by_* -> stddev or avg -> value
self.stats_by_root = {} # root -> by_* -> stddev or avg -> value

self.score_by_pool = {}
self.score_by_root = {}

self.score = 0.0

def show(self, verbose=False):
if verbose:
Expand Down

0 comments on commit bce4fbf

Please sign in to comment.