def show_all(cluster_name, memlog): # Check cluster cluster_json = cm.cluster_info(cluster_name) if cluster_json == None: return print '' if show_gw_list(cluster_name) == False: prompt("Press <Enter> to continue...") print '' pgs_list = util.get_all_pgs_info(cluster_name, memlog) print yellow(PG_PGS_HEADER) for pg in sorted(cluster_json['data']['pg_list'], key=lambda x: int(x['pg_id'])): print_pgs_with_pg(cluster_json, int(pg['pg_id']), filter(lambda pgs: pgs['pgs_id'] in pg['pg_data']['pgs_ID_List'], pgs_list)) print yellow(PG_PARTITION[:-1] + PGS_PARTITION) print ''
def menu_check_memlog_option(cluster_name): opt_memlog = config.get_cluster_opt(cluster_name)('smr')('use_memlog').v() pgs_readers = [] pgs_list = util.get_all_pgs_info(cluster_name, True) unmatched_list = filter(lambda pgs : pgs['memlog'] != opt_memlog, pgs_list) # Print print yellow(CHECK_MEMLOG_HEADER) if len(unmatched_list) != 0: print(red(CHECK_MEMLOG_FORMAT % (opt_memlog, len(unmatched_list)))) else: print(yellow(CHECK_MEMLOG_FORMAT % (opt_memlog, len(unmatched_list)))) print(yellow(CHECK_MEMLOG_PARTITION + '\n')) if len(unmatched_list) > 0: print yellow(PGS_HEADER) for pgs in unmatched_list: bold, color_function, abnormal = pgs_view_style(pgs) if pgs['memlog'] != opt_memlog: print color_function(PGS_FORMAT % pgs, bold) print yellow(PGS_PARTITION + '\n')