def getClusterConfiguration(client):
    scconfOutput = getCommandOutput('/usr/cluster/bin/scconf -pv', client)
    
    clusterName = parseClusterName(scconfOutput)
    
    logger.debug("Found Solaris cluster '%s'" % clusterName)
    cluster = Cluster(clusterName)
    
    nodesByName = parseClusterNodeList(scconfOutput)
    
    thisNodeName = solaris_networking.getHostname(client)
    if thisNodeName and nodesByName.get(thisNodeName) is not None:
        cluster.thisNode = nodesByName.get(thisNodeName)
        logger.debug("Discovering cluster via node '%s'" % thisNodeName)
    else:
        matcher = re.match(r"([\w-]+)\.", thisNodeName)
        if matcher:
            testName = matcher.group(1)
            if nodesByName.get(testName) is not None:
                thisNodeName = testName
                cluster.thisNode = nodesByName.get(thisNodeName)
                logger.debug("Discovering cluster via node '%s'" % thisNodeName)
        else:
            logger.warn("Failed to find node configuration for this host")
    
    for node in nodesByName.values():
        parseTransportAdaptersForNode(node, scconfOutput)
    
    cluster.nodesByName = nodesByName
    
    cluster.quorumDevices = parseQuorumDevices(scconfOutput)
    
    return cluster
示例#2
0
def getClusterConfiguration(client):
    scconfOutput = getCommandOutput('/usr/cluster/bin/scconf -pv', client)

    clusterName = parseClusterName(scconfOutput)

    logger.debug("Found Solaris cluster '%s'" % clusterName)
    cluster = Cluster(clusterName)

    nodesByName = parseClusterNodeList(scconfOutput)

    thisNodeName = solaris_networking.getHostname(client)
    if thisNodeName and nodesByName.get(thisNodeName) is not None:
        cluster.thisNode = nodesByName.get(thisNodeName)
        logger.debug("Discovering cluster via node '%s'" % thisNodeName)
    else:
        matcher = re.match(r"([\w-]+)\.", thisNodeName)
        if matcher:
            testName = matcher.group(1)
            if nodesByName.get(testName) is not None:
                thisNodeName = testName
                cluster.thisNode = nodesByName.get(thisNodeName)
                logger.debug("Discovering cluster via node '%s'" %
                             thisNodeName)
        else:
            logger.warn("Failed to find node configuration for this host")

    for node in nodesByName.values():
        parseTransportAdaptersForNode(node, scconfOutput)

    cluster.nodesByName = nodesByName

    cluster.quorumDevices = parseQuorumDevices(scconfOutput)

    return cluster
示例#3
0
def discoverLdomTopology(shell, ldmCli):
    '''
    Main method to discover LDOMs topology
    '''

    domainsByName = getBindings(shell, ldmCli)

    _controlDomains = filter(ldom.isControlDomain, domainsByName.values())
    if not _controlDomains: raise ValueError("Control domain not found")
    controlDomain = _controlDomains[0]

    guestDomains = filter(lambda d: not ldom.isControlDomain(d), domainsByName.values())

    logger.debug("Found %s bound guest domains" % len(guestDomains))

    topology = ldom.LdomTopology()
    topology.controlDomain = controlDomain
    topology.guestDomains = guestDomains
    topology.numberOfThreads = getLdomServerVirtualCPUCount(shell)
    logger.debug("Found %s virtual CPUs" % topology.numberOfThreads)
    topology.memorySize = getLdomServerMemorySize(shell)
    logger.debug("Found %sM total memorys" % topology.memorySize)
    hostname = solaris_networking.getHostname(shell)
    if not hostname: raise ValueError("Failed to discover hostname of control domain")
    controlDomain._hostname = hostname
    hostmodel = getHostModel(shell)
    if not hostmodel:
        logger.warn("Failed to discover model of control domain")
    else:
        controlDomain.model = hostmodel
    networking = discoverNetworking(shell)
    topology.networking = networking

    try:
        interfaceNamesBySwitchId = getVirtualSwitchInterfaceNames(shell)
        updateSwitchesWithInterfaces(controlDomain, interfaceNamesBySwitchId)
    except:
        logger.warn("Cannot find swith id with interface")

    hostKey = _findHostKeyForControlDomain(networking)
    if hostKey:
        controlDomain._hostKey = hostKey
    else:
        logger.warn("Cannot find host key for control domain")

    for guestDomain in guestDomains:
        hostKey = _findHostKeyForGuestDomain(guestDomain)
        if hostKey:
            guestDomain._hostKey = hostKey
        else:
            logger.warn("Cannot find host key for domain '%s'" % guestDomain.getName())

    try:
        cpus = discoverCpus(shell)
        topology.cpus = cpus
    except:
        logger.warnException('Failed to discover CPUs')

    return topology
示例#4
0
def discoverLdomTopology(shell, ldmCli):
    '''
    Main method to discover LDOMs topology
    '''

    domainsByName = getBindings(shell, ldmCli)

    _controlDomains = filter(ldom.isControlDomain, domainsByName.values())
    if not _controlDomains: raise ValueError("Control domain not found")
    controlDomain = _controlDomains[0]

    guestDomains = filter(lambda d: not ldom.isControlDomain(d),
                          domainsByName.values())

    logger.debug("Found %s bound guest domains" % len(guestDomains))

    topology = ldom.LdomTopology()
    topology.controlDomain = controlDomain
    topology.guestDomains = guestDomains
    topology.numberOfThreads = getLdomServerVirtualCPUCount(shell)
    logger.debug("Found %s virtual CPUs" % topology.numberOfThreads)
    topology.memorySize = getLdomServerMemorySize(shell)
    logger.debug("Found %sM total memorys" % topology.memorySize)
    hostname = solaris_networking.getHostname(shell)
    if not hostname:
        raise ValueError("Failed to discover hostname of control domain")
    controlDomain._hostname = hostname
    hostmodel = getHostModel(shell)
    if not hostmodel:
        logger.warn("Failed to discover model of control domain")
    else:
        controlDomain.model = hostmodel
    networking = discoverNetworking(shell)
    topology.networking = networking

    try:
        interfaceNamesBySwitchId = getVirtualSwitchInterfaceNames(shell)
        updateSwitchesWithInterfaces(controlDomain, interfaceNamesBySwitchId)
    except:
        logger.warn("Cannot find swith id with interface")

    hostKey = _findHostKeyForControlDomain(networking)
    if hostKey:
        controlDomain._hostKey = hostKey
    else:
        logger.warn("Cannot find host key for control domain")

    for guestDomain in guestDomains:
        hostKey = _findHostKeyForGuestDomain(guestDomain)
        if hostKey:
            guestDomain._hostKey = hostKey
        else:
            logger.warn("Cannot find host key for domain '%s'" %
                        guestDomain.getName())

    try:
        cpus = discoverCpus(shell)
        topology.cpus = cpus
    except:
        logger.warnException('Failed to discover CPUs')

    return topology