Exemple #1
0
def show_pgs(cluster_json, pgs_id, memlog=False):
    # Get pgs information
    pgs_unit_set = util.get_deployed_pgs_info(cluster_json['data']['cluster_name'], [pgs_id], memlog)
    if pgs_unit_set == None:
        warn(red("PGS '%d' doesn't exist." % pgs_id))
        return None

    print yellow(PG_PGS_HEADER)
    print_pgs_with_pg(cluster_json, int(pgs_unit_set[0]['pg_id']), pgs_unit_set)
    print yellow(PG_PGS_PARTITION)
    print ''
Exemple #2
0
def show_pgs_list(cluster_name, pg_id, print_header, cluster_json=None, memlog=False):
    # Check cluster
    if cluster_json == None:
        cluster_json = cm.cluster_info(cluster_name)
        if cluster_json == None:
            return False

    pg = filter(lambda pg: int(pg['pg_id']) == pg_id, cluster_json['data']['pg_list'])
    if len(pg) == 0:
        warn(red("PG '%d' doesn't exist." % pg_id))
        return True
    pg = pg[0]

    # Get pgs info
    pgs_list = util.get_deployed_pgs_info(cluster_name, pg['pg_data']['pgs_ID_List'], memlog)

    # Print
    print yellow(PG_PGS_HEADER)
    print_pgs_with_pg(cluster_json, pg_id, pgs_list)
    print yellow(PG_PGS_PARTITION)
    print ''