def _check_osds(self, server_map, osd_map): log.debug("K8sevents checking OSD configuration") changes = list() before_osds = list() for svr in self.server_map: before_osds.extend(self.server_map[svr].get('osd', [])) after_osds = list() for svr in server_map: after_osds.extend(server_map[svr].get('osd', [])) if set(before_osds) == set(after_osds): # no change in osd id's pass else: # osd changes detected osd_msg = "Ceph OSD '{}' ({} @ {}B) has been {} host {}" osds = ListDiff(before_osds, after_osds) for new_osd in osds.added: changes.append( self._generate_config_logentry(msg=osd_msg.format( new_osd, osd_map[new_osd]['deviceclass'], MgrModule.to_pretty_iec(osd_map[new_osd]['capacity']), 'added to', osd_map[new_osd]['hostname']))) for removed_osd in osds.removed: changes.append( self._generate_config_logentry(msg=osd_msg.format( removed_osd, osd_map[removed_osd]['deviceclass'], MgrModule.to_pretty_iec(osd_map[removed_osd] ['capacity']), 'removed from', osd_map[removed_osd]['hostname']))) return changes
def update(self, module: MgrModule, progress: float) -> None: desc = 'increasing' if self.pg_num < self.pg_num_target else 'decreasing' module.remote('progress', 'update', self.ev_id, ev_msg="PG autoscaler %s pool %d PGs from %d to %d" % (desc, self.pool_id, self.pg_num, self.pg_num_target), ev_progress=progress, refs=[("pool", self.pool_id)])
def __str__(self): s = '' s += "{} : {:>3} host{}, {} pool{}, {} OSDs. Raw Capacity {}B".format( json.loads(self.mgr.get('health')['json'])['status'], self.num_servers, text_suffix(self.num_servers), self.num_pools, text_suffix(self.num_pools), self.num_osds, MgrModule.to_pretty_iec(self.raw_capacity)) return s
def __init__(self, *args: Any, **kwargs: Any) -> None: MgrModule.__init__(self, *args, **kwargs) self.set_mgr(self)
def __init__(self, *args, **kwargs): MgrModule.__init__(self, *args, **kwargs) self.set_mgr(self)