Someone may try running crushdiff against osdmap and pg dump
collected for an older cluster.
In general it is not guaranteed to work as not tested well, but
still we can do our best to make it work if possible.
One know issue is that for older versions `ceph pg dump` json
output does not have a separate 'pg_map' section, where actual
data is stored. This change makes crushdiff to support this old
format too.
Signed-off-by: Mykola Golub <mykola.golub@clyso.com>
def get_pgmap(pg_dump_file):
with open(pg_dump_file, "r") as f:
- return json.load(f)['pg_map']
+ dump = json.load(f)
+ return dump.get('pg_map', dump)
def get_pg_stats(pgmap):
return {pg['pgid']: pg for pg in pgmap['pg_stats']}