Пример #1
0
def discoverCluster(client, protocolName, framework, resultsVector):
    cluster = getClusterConfiguration(client)

    getClusterVersion(cluster, client)

    getQuorumStatus(cluster, client)

    #resolve node names to ips in order to create weak hosts
    #if we cannot get ones we cannot report them in 8.0
    validNodesByName = {}
    validNodesByName[cluster.thisNode.name] = cluster.thisNode
    for node in cluster.nodesByName.values():
        if node.name != cluster.thisNode.name:
            ip = solaris_networking.resolveHostnameToIp(node.name, client)
            if ip:
                node.ip = ip
                validNodesByName[node.name] = node
                logger.debug("Resolved node name '%s' to IP '%s'" %
                             (node.name, ip))
            else:
                logger.warn("Could not resolve node name '%s' to IP" %
                            node.name)
    cluster.nodesByName = validNodesByName

    getNodesStatus(cluster, client)

    #get interfaces of this node
    netstatRecordsByName = solaris_networking.getInterfacesViaNetstat(client)

    #MACs for transport adapters of  this node can be taken directly from netstat
    for adapter in cluster.thisNode.transportAdaptersByName.values():
        netstatRecord = netstatRecordsByName.get(adapter.name)
        adapter.mac = netstatRecord and netstatRecord.mac
        if adapter.mac is None:
            logger.warn(
                "Could not find the MAC address for transport adapter '%s' in netstat output"
                % adapter.name)

    # using arp to resolve private IP of transport adapters to MACs
    for node in cluster.nodesByName.values():
        if node.status == Node.STATUS_ONLINE and node.name != cluster.thisNode.name:
            for adapter in node.transportAdaptersByName.values():
                if adapter.ip:
                    mac = solaris_networking.resolveIpToMacViaArp(
                        adapter.ip, client)
                    if mac:
                        adapter.mac = mac
                    else:
                        logger.warn(
                            "Could not resolve private IP for transport adapter '%s' to MAC"
                            % adapter.name)

    getClusterResources(cluster, client)

    getResourceGroupsStatus(cluster, client)

    getTransportPaths(cluster, client)

    createClusterTopology(cluster, framework, resultsVector)
Пример #2
0
def discoverCluster(client, protocolName, framework, resultsVector):
    cluster = getClusterConfiguration(client)
    
    getClusterVersion(cluster, client)
    
    getQuorumStatus(cluster, client)
    
    #resolve node names to ips in order to create weak hosts
    #if we cannot get ones we cannot report them in 8.0
    validNodesByName = {}
    validNodesByName[cluster.thisNode.name] = cluster.thisNode
    for node in cluster.nodesByName.values():
        if node.name != cluster.thisNode.name:
            ip = solaris_networking.resolveHostnameToIp(node.name, client)
            if ip:
                node.ip = ip
                validNodesByName[node.name] = node
                logger.debug("Resolved node name '%s' to IP '%s'" % (node.name, ip))
            else: 
                logger.warn("Could not resolve node name '%s' to IP" % node.name)
    cluster.nodesByName = validNodesByName
    
    getNodesStatus(cluster, client)

    #get interfaces of this node
    netstatRecordsByName = solaris_networking.getInterfacesViaNetstat(client)
    
    #MACs for transport adapters of  this node can be taken directly from netstat
    for adapter in cluster.thisNode.transportAdaptersByName.values():
        netstatRecord = netstatRecordsByName.get(adapter.name)
        adapter.mac = netstatRecord and netstatRecord.mac
        if adapter.mac is None:
            logger.warn("Could not find the MAC address for transport adapter '%s' in netstat output" % adapter.name)
    
    # using arp to resolve private IP of transport adapters to MACs
    for node in cluster.nodesByName.values():
        if node.status == Node.STATUS_ONLINE and node.name != cluster.thisNode.name:
            for adapter in node.transportAdaptersByName.values():
                if adapter.ip:
                    mac = solaris_networking.resolveIpToMacViaArp(adapter.ip, client)
                    if mac:
                        adapter.mac = mac
                    else:
                        logger.warn("Could not resolve private IP for transport adapter '%s' to MAC" % adapter.name) 
    
    getClusterResources(cluster, client)
    
    getResourceGroupsStatus(cluster, client)
    
    getTransportPaths(cluster, client)
    
    createClusterTopology(cluster, framework, resultsVector)
Пример #3
0
def handleNetworkResources(cluster, client):
    for resource in cluster.resourcesByName.values():
        if re.match(r"SUNW.LogicalHostname", resource.type) or re.match(r"SUNW.SharedAddress", resource.type):
            hostnameList = resource.attributes.get('HostnameList')
            group = cluster.resourceGroupsByName.get(resource.groupName)
            if hostnameList and group:
                for hostname in hostnameList:
                    try:
                        ip = solaris_networking.resolveHostnameToIp(hostname, client)
                        if ip:
                            group.groupIps.add(ip)
                        else:
                            logger.warn("Failed resolving hostname '%s' to IP" % hostname)
                    except:
                        logger.warn("Failed resolving hostname '%s' to IP" % hostname)
Пример #4
0
def handleNetworkResources(cluster, client):
    for resource in cluster.resourcesByName.values():
        if re.match(r"SUNW.LogicalHostname", resource.type) or re.match(
                r"SUNW.SharedAddress", resource.type):
            hostnameList = resource.attributes.get('HostnameList')
            group = cluster.resourceGroupsByName.get(resource.groupName)
            if hostnameList and group:
                for hostname in hostnameList:
                    try:
                        ip = solaris_networking.resolveHostnameToIp(
                            hostname, client)
                        if ip:
                            group.groupIps.add(ip)
                        else:
                            logger.warn(
                                "Failed resolving hostname '%s' to IP" %
                                hostname)
                    except:
                        logger.warn("Failed resolving hostname '%s' to IP" %
                                    hostname)