mirror of
https://github.com/ceph/ceph
synced 2025-02-24 19:47:44 +00:00
pybind/mgr/pg_autoscaler: extract CrushSubtreeResourceStatus out
as it also serves as part of interface of get_subtree_resource_status(), not only its internals. to ease adding the type annotations, this class is promoted out of the class. Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
4efd740080
commit
9bb55e8480
@ -79,6 +79,23 @@ class PgAdjustmentProgress(object):
|
||||
refs=[("pool", self.pool_id)])
|
||||
|
||||
|
||||
class CrushSubtreeResourceStatus:
|
||||
def __init__(self):
|
||||
self.root_ids = []
|
||||
self.osds = set()
|
||||
self.osd_count = None # Number of OSDs
|
||||
self.pg_target = None # Ideal full-capacity PG count?
|
||||
self.pg_current = 0 # How many PGs already?
|
||||
self.pg_left = 0
|
||||
self.capacity = None # Total capacity of OSDs in subtree
|
||||
self.pool_ids = []
|
||||
self.pool_names = []
|
||||
self.pool_count = None
|
||||
self.pool_used = 0
|
||||
self.total_target_ratio = 0.0
|
||||
self.total_target_bytes = 0 # including replication / EC overhead
|
||||
|
||||
|
||||
class PgAutoscaler(MgrModule):
|
||||
"""
|
||||
PG autoscaler.
|
||||
@ -248,22 +265,6 @@ class PgAutoscaler(MgrModule):
|
||||
pool_root = {}
|
||||
roots = []
|
||||
|
||||
class CrushSubtreeResourceStatus(object):
|
||||
def __init__(self):
|
||||
self.root_ids = []
|
||||
self.osds = set()
|
||||
self.osd_count = None # Number of OSDs
|
||||
self.pg_target = None # Ideal full-capacity PG count?
|
||||
self.pg_current = 0 # How many PGs already?
|
||||
self.pg_left = 0
|
||||
self.capacity = None # Total capacity of OSDs in subtree
|
||||
self.pool_ids = []
|
||||
self.pool_names = []
|
||||
self.pool_count = None
|
||||
self.pool_used = 0
|
||||
self.total_target_ratio = 0.0
|
||||
self.total_target_bytes = 0 # including replication / EC overhead
|
||||
|
||||
# identify subtrees (note that they may overlap!)
|
||||
for pool_id, pool in osdmap.get_pools().items():
|
||||
cr_name = crush.get_rule_by_id(pool['crush_rule'])['rule_name']
|
||||
|
Loading…
Reference in New Issue
Block a user