def vollist(): """ Volumes List :returns: List of Volumes, raises GlusterCmdException((rc, out, err)) on error """ cmd = ["list"] return parse_volume_list(volume_execute_xml(cmd))
def status(volname): """ Rebalance Status :param volname: Volume Name :returns: Rebalance Status, raises GlusterCmdException((rc, out, err)) on error """ cmd = ["rebalance", volname, "status"] return parse_rebalance_status(volume_execute_xml(cmd))
def optget(volname, opt="all"): """ Get Volume Options :param volname: Volume Name :param opt: Option Name :returns: List of Volume Options, raises GlusterCmdException((rc, out, err)) on error """ cmd = ["get", volname, opt] return parse_volume_options(volume_execute_xml(cmd))
def info(volname=None): """ Get Gluster Volume Info :param volname: Volume Name :returns: Returns Volume Info, raises GlusterCmdException((rc, out, err)) on error """ cmd = ["info"] if volname is not None: cmd += [volname] return parse_volume_info(volume_execute_xml(cmd))
def status_detail(volname=None): """ Get Gluster Volume Status :param volname: Volume Name :returns: Returns Volume Status, raises GlusterCmdException((rc, out, err)) on error """ cmd = ["status"] if volname is not None: cmd += [volname, "detail"] else: cmd += ["all", "detail"] return parse_volume_status(volume_execute_xml(cmd), info(volname))
def remove_status(volname, bricks, replica=None): """ Remove Bricks status :param volname: Volume Name :param bricks: List of Bricks :param replica: Replica Count :returns: Remove Bricks Status, raises GlusterCmdException((rc, out, err)) on error """ cmd = ["remove-brick", volname] if replica is not None: cmd += ["replica", "{0}".format(replica)] cmd += bricks cmd += ["status"] return parse_remove_brick_status(volume_execute_xml(cmd))
def profile_info(volname, opt, peek=False): """ Get Profile info :param volname: Volume Name :param opt: Operation type of info, like peek, incremental, cumulative, clear :param peek: Use peek or not, default is False :return: Return profile info, raises GlusterCmdException((rc, out, err)) on error """ if opt.lower() not in INFO_OPS: raise GlusterCmdException( (-1, "", "Invalid Info Operation Type, use peek, " "incremental, cumulative, clear")) cmd = ["profile", volname, "info", opt.lower()] if opt.lower() == INFO_OPS[1] and peek: cmd += ["peek"] return parse_volume_profile_info(volume_execute_xml(cmd), opt)