Exemplo n.º 1
0
def _parseinfo(volinfo):
    tree = utils.checkxmlcorrupt(volinfo)
    volumes = []
    for el in tree.findall('volInfo/volumes/volume'):
        try:
            volumes.append(_parse_a_vol(el))
        except (ParseError, AttributeError, ValueError) as e:
            raise GlusterCliBadXml(str(e))

    return volumes
Exemplo n.º 2
0
def _parsepoollist(peerinfo):
    tree = utils.checkxmlcorrupt(peerinfo)
    peers = []
    for el in tree.findall('peerStatus/peer'):
        try:
            peers.append(_parse_a_peer(el))
        except (ParseError, AttributeError, ValueError) as e:
            raise GlusterCliBadXml(str(e))

    return peers
Exemplo n.º 3
0
def _parseinfo(snapinfo):
    tree = utils.checkxmlcorrupt(snapinfo)
    snapshots = []
    for el in tree.findall("snapInfo/snapshots/snapshot"):
        try:
            snapshots.append(_parse_a_vol(el))
        except (ParseError, AttributeError, ValueError) as e:
            raise GlusterCliBadXml(str(e))

    return snapshots
Exemplo n.º 4
0
def _parsepoollist(peerinfo):
    tree = utils.checkxmlcorrupt(peerinfo)
    peers = []
    for el in tree.findall('peerStatus/peer'):
        try:
            peers.append(_parse_a_peer(el))
        except (ParseError, AttributeError, ValueError) as e:
            raise GlusterCliBadXml(str(e))

    return peers
Exemplo n.º 5
0
def _parseCreateOutput(createResponse):
    #    matchObj = re.match( r'snapshot create: ([a-zA-Z]+): Snap ([0-9a-zA-Z_\-\.]+)', createResponse, re.M|re.I)
    tree = utils.checkxmlcorrupt(createResponse)
    # el = tree.find('snapshot/name').text
    if tree.find("opErrno").text == "0":
        return tree.find("snapCreate/snapshot/name").text
    else:
        raise GlusterCliFailure("Snapshot not created %s" % tree.find("opErrstr").text)

    raise GlusterCliFailure("Snapshot creation failed!: %s" % createResponse)