From: Jos Collin Date: Thu, 28 Mar 2019 10:13:49 +0000 (+0530) Subject: qa/tasks: Compare two FSStatuses X-Git-Tag: v15.1.0~2331^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f46fec8c1d218c30f241c30124902fa965dafc37;p=ceph.git qa/tasks: Compare two FSStatuses Compare two FSStatuses to detect MDS failover Fixes: http://tracker.ceph.com/issues/17309 Signed-off-by: Jos Collin --- diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index a388c769f61f..3f028dfb7a13 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -140,6 +140,28 @@ class FSStatus(object): log.warn(json.dumps(list(self.get_all()), indent=2)) # dump for debugging raise RuntimeError("MDS id '{0}' not found in map".format(name)) + def get_mds_gid(self, gid): + """ + Get the info for the given MDS gid. + """ + for info in self.get_all(): + if info['gid'] == gid: + return info + return None + + def hadfailover(self, status): + """ + Compares two statuses for mds failovers. + Returns True if there is a failover. + """ + for fs in status.map['filesystems']: + for info in fs['mdsmap']['info'].values(): + oldinfo = self.get_mds_gid(info['gid']) + if oldinfo is None or oldinfo['incarnation'] != info['incarnation']: + return True + #all matching + return False + class CephCluster(object): @property def admin_remote(self):