Esempio n. 1
0
def create_gluster_cluster(nodelist):
    failedNodes = []
    if nodelist:
        rootNode = nodelist[0]['management_ip']
        for node in nodelist[1:]:
            rc = salt_wrapper.peer(rootNode, node['management_ip'])
            if rc is False:
                log.critical("Peer Probe Failed for node %s" % node)
                failedNodes.append(node)
    return failedNodes
Esempio n. 2
0
def add_gluster_host(hostlist, newNode):
    if hostlist:
        host = random.choice(hostlist)

        rc = salt_wrapper.peer(host, newNode)
        if rc is True:
            return rc
        #
        # random host is not able to peer probe
        # Now try to iterate through the list of hosts
        # in the cluster to peer probe until
        # the peer probe is successful
        #

        # No need to send it to host which we already tried
        hostlist.remove(host)
        for host in hostlist:
            rc = salt_wrapper.peer(host, newNode)
            if rc is True:
                return rc
        return rc
    else:
        return True