Exemplo n.º 1
0
        /// <summary>
        /// Get the info of specified broker node
        /// </summary>
        /// <param name="brokerNodes">List of broker nodes</param>
        /// <param name="brokerNodeName">Name of the broker node</param>
        /// <returns>Broker node info</returns>
        private static BrokerNodeItem GetBrokerNode(List <BrokerNodeItem> brokerNodes, string brokerNodeName)
        {
            BrokerNodeItem result = null;

            foreach (BrokerNodeItem brokerNodeItem in brokerNodes)
            {
                if (0 == String.Compare(brokerNodeItem.Name, brokerNodeName, StringComparison.InvariantCultureIgnoreCase))
                {
                    result = brokerNodeItem;
                    break;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// update the available broker EPRs.
        /// </summary>
        private void UpdateAvaliableBrokers(
            List <BrokerNodeItem> brokerNodesInCluster,
            List <string> brokerNodesWithFailover,
            Dictionary <string, ResourceGroupInfo> resourceGroups)
        {
            List <NodeInfo> onlineNonHABrokers    = new List <NodeInfo>();
            List <NodeInfo> onlineHABrokers       = new List <NodeInfo>();
            List <NodeInfo> offlineBrokers        = new List <NodeInfo>();
            String          brokerListInfoMessage = String.Empty;

#if HPCPACK
            // Loop through the broker nodes
            foreach (BrokerNodeItem brokerNode in brokerNodesInCluster)
            {
                // Add those that are reachable, online and not failover BNs to the NonHA BN list
                if (brokerNode != null && brokerNode.Reachable)
                {
                    if (!brokerNodesWithFailover.Contains(brokerNode.Name))
                    {
                        if (brokerNode.State == NodeState.Online)
                        {
                            onlineNonHABrokers.Add(GenerateNodeInfo(brokerNode.Name, brokerNode.DomainName));
                        }
                        else
                        {
                            // Note: We need to authenticate offline broker node also to
                            // enable SoaDiagSvc on offline broker nodes.
                            offlineBrokers.Add(GenerateNodeInfo(brokerNode.Name, brokerNode.DomainName));
                        }
                    }
                }
            }
#endif

            // Loop through the broker launcher resource groups hosted on failover BNs
            foreach (ResourceGroupInfo resourceGroupInfo in resourceGroups.Values)
            {
                BrokerNodeItem hostBrokerNode = GetBrokerNode(brokerNodesInCluster, resourceGroupInfo.HostName);

                // It is possible for a resource group's BN to be removed from the compute cluster but not yet
                // removed from its failover cluster. If this occurs, move on to next resourceGroup
                if (hostBrokerNode == null)
                {
                    continue;
                }

                // If the resource group is available and its host is available and online, add its network name to the HA BN EPRs
                if (resourceGroupInfo.Available && hostBrokerNode.Reachable)
                {
                    // Note: Resource group's NetworkName is not FQDN. The broker node is
                    // in the same domain as the HA broker resource group.
                    // http://technet.microsoft.com/en-us/library/cc771404.aspx#BKMK_Account_Infrastructure
                    // All servers in the cluster must be in the same Active Directory domain.
                    if (hostBrokerNode.State == NodeState.Online)
                    {
                        onlineHABrokers.Add(GenerateNodeInfo(resourceGroupInfo.NetworkName, hostBrokerNode.DomainName));
                    }
                    else
                    {
                        // Note: We need to authenticate offline broker node also to
                        // enable SoaDiagSvc on offline broker nodes.
                        offlineBrokers.Add(GenerateNodeInfo(resourceGroupInfo.NetworkName, hostBrokerNode.DomainName));
                    }
                }
            }

            StringBuilder sbHA      = new StringBuilder();
            StringBuilder sbNonHA   = new StringBuilder();
            StringBuilder sbOffline = new StringBuilder();

            lock (this.availableBrokers)
            {
                this.availableBrokers.Clear();

                for (int i = 0; i < onlineHABrokers.Count; i++)
                {
                    sbHA.AppendLine(onlineHABrokers[i].Name);
                    this.availableBrokers.Add(onlineHABrokers[i].Name);
                }

                for (int i = 0; i < onlineNonHABrokers.Count; i++)
                {
                    sbNonHA.AppendLine(onlineNonHABrokers[i].Name);
                    this.availableBrokers.Add(onlineNonHABrokers[i].Name);
                }

                foreach (NodeInfo info in offlineBrokers)
                {
                    sbOffline.AppendLine(info.Name);
                    this.availableBrokers.Add(info.Name);
                }

                this.availableBrokers.Sort(StringComparer.InvariantCultureIgnoreCase);

                // Update HpcSession performance counter - ActiveBrokerNodeCount
                if (this.activeBrokerNodeCount != null)
                {
                    this.activeBrokerNodeCount.RawValue = this.availableBrokers.Count - offlineBrokers.Count;
                }
            }

            brokerListInfoMessage = String.Format(
                "Available broker node eprs: HA - {0}, NonHA - {1}, OffLine - {2}",
                sbHA.ToString(),
                sbNonHA.ToString(),
                sbOffline.ToString());

            // Inform admin of broker node list if it changed
            if (0 != String.Compare(this.lastBrokerListInfoMessage, brokerListInfoMessage, StringComparison.InvariantCultureIgnoreCase))
            {
                TraceHelper.TraceEvent(TraceEventType.Verbose, brokerListInfoMessage);
                this.lastBrokerListInfoMessage = brokerListInfoMessage;
            }

            // Save the updated EPR lists
            lock (this.brokerEPRsLock)
            {
                this.availableHABrokerNodes    = onlineHABrokers;
                this.availableNonHABrokerNodes = onlineNonHABrokers;
            }
        }