def main():
    args = _get_args()

    filters = {
        "name": args.name,
        "status": args.status,
        "type": args.type,
        "volumewithbrick": args.volumewithbrick
    }

    try:
        gfvols = volumes.search(filters)
    except volumes.GlusterVolumeInfoFailed:
        msg = 'Error fetching gluster volumes details\n'
        sys.stderr.write(utils.color_txt(msg,
                                         'RED'))
        exit(1)

    if args.json:
        sys.stdout.write(json.dumps(gfvols))
        exit(0)

    if not gfvols:
        exit(0)

    _display(gfvols, args)
示例#2
0
def main():
    args = _get_args()

    filters = {
        "name": args.name,
        "status": args.status,
        "type": args.type,
        "volumewithbrick": args.volumewithbrick
    }

    try:
        gvols = volumes.search(filters)
    except volumes.GlusterVolumeInfoFailed:
        msg = 'Error fetching gluster volumes details\n'
        sys.stderr.write(utils.color_txt(msg,
                                         'RED'))
        exit(1)

    if args.onek:
        args.block_size = 'K'

    if args.block_size != '':
        args.human_readable = False
        args.human_readable_1000 = False

    args.hr_block_size = 1000 if args.human_readable_1000 else 1024
    args.block_size_number = _get_block_size(args)

    if args.inodes:
        args.fields = "volume,type,num_bricks,status,itotal,\
        iused,iavail,ipcent"

    _display(gvols, args)