From 21e1caba6df9d591ebff54939d020ce0a3e57efe Mon Sep 17 00:00:00 2001 From: "Kamoltat (Junior) Sirivadhna" Date: Mon, 3 Jun 2019 15:23:45 -0400 Subject: [PATCH] mgr: Look at PG state when PG epoch >= OSDMap epoch add an if statement to only allow PGs to only look at it's PG state when it's epoch is greater than or equal to the OSDMap's epoch. Signed-off-by: Kamoltat (Junior) Sirivadhna --- src/pybind/mgr/progress/module.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/progress/module.py b/src/pybind/mgr/progress/module.py index 702517495be..f71e769f197 100644 --- a/src/pybind/mgr/progress/module.py +++ b/src/pybind/mgr/progress/module.py @@ -142,7 +142,7 @@ class PgRecoveryEvent(Event): def evacuating_osds(self): return self. _evacuate_osds - def pg_update(self, pg_dump, log): + def pg_update(self, pg_dump, log,latest_osd_map_epoch): # 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']]) @@ -180,6 +180,9 @@ class PgRecoveryEvent(Event): # The PG is gone! Probably a pool was deleted. Drop it. 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(latest_osd_map_epoch): + continue state = info['state'] @@ -360,7 +363,7 @@ class Module(MgrModule): which_pgs=affected_pgs, evacuate_osds=[osd_id] ) - ev.pg_update(self.get("pg_dump"), self.log) + ev.pg_update(self.get("pg_dump"), self.log,self._latest_osdmap.get_epoch()) self._events[ev.id] = ev def _osd_in(self, osd_id): @@ -408,7 +411,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) + ev.pg_update(data, self.log,self._latest_osdmap.get_epoch()) self.maybe_complete(ev) def maybe_complete(self, event):