From: Kamoltat (Junior) Sirivadhna Date: Tue, 4 Jun 2019 15:51:01 +0000 (-0400) Subject: mgr: Look at PG state when PG epoch >= OSDMap epoch X-Git-Tag: v15.1.0~2517^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d37e8a4d84d873b7df264c63077805be8618ad7a;p=ceph-ci.git mgr: Look at PG state when PG epoch >= OSDMap epoch In the PgRecoveryEvent class created a property call self._start_epoch, basically the epoch of the current OSD. Then use that propery in pg_update to only allow the program to look at PG state only when PG epoch >= start_epoch. Signed-off-by: Kamoltat (Junior) Sirivadhna --- diff --git a/src/pybind/mgr/progress/module.py b/src/pybind/mgr/progress/module.py index 8bc541de12b..e992e0f26eb 100644 --- a/src/pybind/mgr/progress/module.py +++ b/src/pybind/mgr/progress/module.py @@ -135,6 +135,8 @@ class PgRecoveryEvent(Event): self._progress = 0.0 + self._start_epoch = _module.get_osdmap().get_epoch() + self.id = str(uuid.uuid4()) self._refresh() @@ -142,7 +144,7 @@ class PgRecoveryEvent(Event): def evacuating_osds(self): return self. _evacuate_osds - def pg_update(self, pg_dump, log, start_epoch): + def pg_update(self, pg_dump, log): # FIXME: O(pg_num) in python # FIXME: far more fields getting pythonized than we really care about pg_to_state = dict([(p['pgid'], p) for p in pg_dump['pg_stats']]) @@ -181,7 +183,7 @@ class PgRecoveryEvent(Event): complete.add(pg) continue # Only checks the state of each PGs when it's epoch >= the OSDMap's epoch - if int(info['reported_epoch']) < int(start_epoch): + if int(info['reported_epoch']) < int(self._start_epoch): continue state = info['state'] @@ -363,7 +365,7 @@ class Module(MgrModule): which_pgs=affected_pgs, evacuate_osds=[osd_id] ) - ev.pg_update(self.get("pg_dump"), self.log, self.get_osdmap().get_epoch()) + ev.pg_update(self.get("pg_dump"), self.log) self._events[ev.id] = ev def _osd_in(self, osd_id): @@ -411,7 +413,7 @@ class Module(MgrModule): data = self.get("pg_dump") for ev_id, ev in self._events.items(): if isinstance(ev, PgRecoveryEvent): - ev.pg_update(data, self.log, self.get_osdmap().get_epoch()) + ev.pg_update(data, self.log) self.maybe_complete(ev) def maybe_complete(self, event):