pg_map.dump_pool_stats(&f);
});
return f.get();
+ } else if (what == "pg_ready") {
+ PyEval_RestoreThread(tstate);
+ server.dump_pg_ready(&f);
+ return f.get();
} else if (what == "osd_stats") {
cluster_state.with_pgmap(
[&f, &tstate](const PGMap &pg_map) {
osd_map, osd_map_tree, osd_map_crush, config, mon_map, fs_map,
osd_metadata, pg_summary, io_rate, pg_dump, df, osd_stats,
health, mon_status, devices, device <devid>, pg_stats,
- pool_stats.
+ pool_stats, pg_ready.
Note:
All these structures have their own JSON representations: experiment
def which_osds(self):
return self. _which_osds
- def pg_update(self, raw_pg_stats, log):
- # type: (Dict, Any) -> None
+ def pg_update(self, raw_pg_stats, pg_ready, log):
+ # type: (Dict, bool, Any) -> None
# FIXME: O(pg_num) in python
# FIXME: far more fields getting pythonized than we really care about
# Sanity check to see if there are any missing PGs and to assign
pg_to_state[pg_str]['stat_sum']['num_bytes_recovered']
else:
missing_pgs.append(pg)
- if pg_dump.get('pg_ready', False):
+ if pg_ready:
for pg in missing_pgs:
self._pgs.remove(pg)
which_osds=[osd_id],
start_epoch=self.get_osdmap().get_epoch()
)
- r_ev.pg_update(self.get("pg_stats"), self.log)
+ r_ev.pg_update(self.get("pg_stats"), self.get("pg_ready"), self.log)
self._events[r_ev.id] = r_ev
def _osdmap_changed(self, old_osdmap, new_osdmap):
self._osdmap_changed(old_osdmap, self._latest_osdmap)
elif notify_type == "pg_summary":
data = self.get("pg_stats")
+ ready = self.get("pg_ready")
for ev_id in list(self._events):
ev = self._events[ev_id]
if isinstance(ev, PgRecoveryEvent):
- ev.pg_update(data, self.log)
+ ev.pg_update(data, ready, self.log)
self.maybe_complete(ev)
def maybe_complete(self, event):
def test_pg_update(self):
# Test for a completed event when the pg states show active+clear
- pg_dump = {
+ pg_stats = {
"pg_stats":[
{
"state": "active+clean",
]
}
- self.test_event.pg_update(pg_dump, mock.Mock())
+ self.test_event.pg_update(pg_stats, True, mock.Mock())
assert self.test_event._progress == 1.0
class OSDMap: