示例#1
0
        internal static void FixIPAddress(AmServerName nodeName, DatabaseAvailabilityGroup dag, IEnumerable <AmServerName> startedMailboxServers, ITaskOutputHelper output)
        {
            output.WriteProgressSimple(Strings.DagTaskFixingUpIpResources);
            MultiValuedProperty <IPAddress> databaseAvailabilityGroupIpv4Addresses = dag.DatabaseAvailabilityGroupIpv4Addresses;

            IPAddress[] array = new IPAddress[0];
            if (databaseAvailabilityGroupIpv4Addresses.Count > 0)
            {
                array = databaseAvailabilityGroupIpv4Addresses.ToArray();
            }
            string[] value = (from addr in array
                              select addr.ToString()).ToArray <string>();
            output.AppendLogMessage("Got the following IP addresses for the DAG (blank means DHCP):{0}", new object[]
            {
                string.Join(",", value)
            });
            using (AmCluster amCluster = AmCluster.OpenByNames(startedMailboxServers))
            {
                if (amCluster.CnoName != string.Empty)
                {
                    using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                    {
                        using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
                        {
                            LocalizedString value2 = AmClusterResourceHelper.FixUpIpAddressesForNetName(output, amCluster, (AmClusterGroup)amClusterGroup, (AmClusterResource)amClusterResource, array);
                            output.WriteProgressSimple(Strings.DagTaskFixedUpIpResources(value2));
                            DagTaskHelper.LogCnoState(output, dag.Name, amClusterResource);
                        }
                    }
                }
            }
        }
示例#2
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     this.LogCommandLineParameters();
     this.m_removeNode     = false;
     this.m_destroyCluster = false;
     this.ResolveParameters();
     DagTaskHelper.VerifyDagAndServersAreWithinScopes <DatabaseAvailabilityGroup>(this, this.m_dag, true);
     this.m_output.WriteProgress(Strings.ProgressStatusInProgress, Strings.DagTaskRemoveDagServerRunningChecks(this.m_mailboxServerName, this.m_dagName), 0);
     this.CheckDatabasesAreNotReplicated();
     if (!this.m_configurationOnly)
     {
         DagTaskHelper.CheckServerDoesNotBelongToDifferentDag(new Task.TaskErrorLoggingDelegate(this.m_output.WriteError), base.DataSession, this.m_mailboxServer, this.m_dagName);
         this.CheckFswSettings();
         this.CheckClusterStateForDagServerRemoval();
         if (!this.m_configurationOnly)
         {
             using (IAmClusterGroup amClusterGroup = this.m_clusDag.FindCoreClusterGroup())
             {
                 AmServerName ownerNode = amClusterGroup.OwnerNode;
                 this.m_output.AppendLogMessage("Checking if msexchangerepl is running on {0}.", new object[]
                 {
                     ownerNode.NetbiosName
                 });
                 DatabaseTasksHelper.CheckReplayServiceRunningOnNode(ownerNode, new Task.TaskErrorLoggingDelegate(base.WriteError));
                 if (this.m_clusDag.CnoName != string.Empty)
                 {
                     using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
                     {
                         DagTaskHelper.LogCnoState(this.m_output, this.m_dagName, amClusterResource);
                     }
                 }
             }
         }
     }
     if (DagTaskHelper.FindServerAdObjectIdInDag(this.m_dag, this.m_mailboxAmServerName) == null)
     {
         StringBuilder stringBuilder = new StringBuilder(string.Format("{0}. srvToRemove={1} dagSvrs=(", this.m_dagName, this.m_mailboxAmServerName.NetbiosName));
         bool          flag          = false;
         foreach (ADObjectId adobjectId in this.m_dag.Servers)
         {
             if (flag)
             {
                 stringBuilder.Append(",");
             }
             else
             {
                 flag = true;
             }
             stringBuilder.Append(adobjectId.Name);
         }
         stringBuilder.Append(")");
         this.m_output.WriteErrorSimple(new DagTaskServerIsNotInDagException(this.m_mailboxServerName, stringBuilder.ToString()));
     }
     base.InternalValidate();
     TaskLogger.LogExit();
 }
 // Token: 0x060008AE RID: 2222 RVA: 0x00029798 File Offset: 0x00027998
 internal static void RevertToMnsQuorum(ILogTraceHelper output, IAmCluster cluster)
 {
     using (IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup())
     {
         string text;
         uint   maxLogSize;
         string quorumResourceInformation = cluster.GetQuorumResourceInformation(out text, out maxLogSize);
         if (string.IsNullOrEmpty(quorumResourceInformation))
         {
             output.AppendLogMessage("RevertToMnsQuorum: It's already using MNS!", new object[0]);
             using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("File Share Witness"))
             {
                 if (amClusterResource != null)
                 {
                     output.AppendLogMessage("Even though the quorum is set to MNS, there is a FSW resource present named '{0}', which will be deleted shortly.", new object[]
                     {
                         amClusterResource.Name
                     });
                     amClusterResource.DeleteResource();
                     output.AppendLogMessage("The resource has been deleted!", new object[0]);
                 }
                 goto IL_13D;
             }
         }
         using (AmClusterResource amClusterResource2 = cluster.OpenResource(quorumResourceInformation))
         {
             output.AppendLogMessage("Setting cluster quorum to MNS", new object[0]);
             if (cluster.CnoName == string.Empty)
             {
                 cluster.ClearQuorumResource();
             }
             else
             {
                 using (IAmClusterResource amClusterResource3 = amClusterGroup.FindResourceByTypeName("Network Name"))
                 {
                     output.AppendLogMessage("Setting cluster quorum resource to the netname resource (i.e. MNS quorum).", new object[0]);
                     cluster.SetQuorumResource(amClusterResource3, null, maxLogSize);
                     if (amClusterResource2 != null && amClusterResource2.GetTypeName() == "File Share Witness")
                     {
                         output.AppendLogMessage("Offlining and deleting the old FSW resource '{0}'.", new object[]
                         {
                             quorumResourceInformation
                         });
                         amClusterResource2.OfflineResource();
                         amClusterResource2.DeleteResource();
                     }
                 }
             }
         }
         IL_13D :;
     }
 }
 // Token: 0x060008B4 RID: 2228 RVA: 0x00029BAC File Offset: 0x00027DAC
 internal static void FollowBestPractices(ITaskOutputHelper output, IAmCluster cluster)
 {
     if (string.Empty != cluster.CnoName)
     {
         using (IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup())
         {
             using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
             {
                 output.AppendLogMessage("Setting the DNS TTL to 300", new object[0]);
                 amClusterResource.SetPrivateProperty <int>("HostRecordTTL", 300);
             }
         }
     }
 }
示例#5
0
        public IAmClusterResource CreateUniqueResource(ILogTraceHelper logger, string resPrefix, string resType, ref int nextIndex)
        {
            int                num    = nextIndex;
            string             text   = null;
            IAmClusterResource result = null;

            logger = (logger ?? NullLogTraceHelper.GetNullLogger());
            if (resPrefix == null)
            {
                resPrefix = resType;
            }
            try
            {
IL_1A:
                text = string.Format("{0} {1} ({2})", resPrefix, num, this.Name);
                logger.AppendLogMessage("CreateUniqueResource() Trying to create a resource named '{0}'.", new object[]
                {
                    text
                });
                result = this.CreateResource(text, resType);
                num++;
                nextIndex = num;
                logger.AppendLogMessage("CreateUniqueResource() Created a resource named '{0}'.", new object[]
                {
                    text
                });
            }
            catch (ClusResourceAlreadyExistsException)
            {
                logger.AppendLogMessage("CreateUniqueResource() Resource '{0}' already exists. Trying again.", new object[]
                {
                    text
                });
                num++;
                goto IL_1A;
            }
            return(result);
        }
示例#6
0
 private void RemoveNodeFromCluster()
 {
     this.m_output.WriteProgressSimple(Strings.DagTaskRemovedNodeToCluster(this.m_mailboxServerName));
     using (IAmClusterNode amClusterNode = this.m_clusDag.OpenNode(this.m_mailboxAmServerName))
     {
         bool   flag             = false;
         string empty            = string.Empty;
         string remoteServerName = "<unknown>";
         try
         {
             using (IAmClusterGroup amClusterGroup = this.m_clusDag.FindCoreClusterGroup())
             {
                 AmServerName ownerNode = amClusterGroup.OwnerNode;
                 remoteServerName = ownerNode.Fqdn;
                 ReplayRpcClientWrapper.RunEvictNodeFromCluster(ownerNode, this.m_mailboxAmServerName, out empty);
             }
         }
         catch (DagTaskOperationFailedException ex)
         {
             AmClusterEvictWithoutCleanupException ex2;
             if (ex.TryGetTypedInnerException(out ex2))
             {
                 this.m_output.WriteWarning(ex2.LocalizedString);
             }
             else
             {
                 DagTaskHelper.LogRemoteVerboseLog(this.m_output, remoteServerName, empty);
                 this.m_output.WriteErrorSimple(ex);
             }
         }
         catch (LocalizedException error)
         {
             DagTaskHelper.LogRemoteVerboseLog(this.m_output, remoteServerName, empty);
             this.m_output.WriteErrorSimple(error);
         }
         DagTaskHelper.LogRemoteVerboseLog(this.m_output, remoteServerName, empty);
         if (flag)
         {
             this.m_output.WriteWarning(Strings.DagTaskRemoveNodeCleanupFailed(amClusterNode.Name.Fqdn));
         }
     }
     this.m_output.WriteProgressSimple(Strings.DagTaskRemovedNodeToCluster(this.m_mailboxServerName));
     if (this.m_clusDag.CnoName != string.Empty)
     {
         this.m_output.WriteProgressSimple(Strings.DagTaskFixingUpIpResources);
         List <AmServerName>        source     = this.m_clusDag.EnumerateNodeNames().ToList <AmServerName>();
         IEnumerable <AmServerName> enumerable = from name in source
                                                 where name != this.m_mailboxAmServerName
                                                 select name;
         IEnumerable <string> source2 = from serverName in enumerable
                                        select serverName.NetbiosName;
         this.m_output.AppendLogMessage("Refreshing the cluster using the names [{0}].", new object[]
         {
             string.Join(", ", source2.ToArray <string>())
         });
         this.m_clusDag.Dispose();
         MultiValuedProperty <IPAddress> databaseAvailabilityGroupIpv4Addresses = this.m_dag.DatabaseAvailabilityGroupIpv4Addresses;
         IPAddress[] array = new IPAddress[0];
         if (databaseAvailabilityGroupIpv4Addresses.Count > 0)
         {
             array = databaseAvailabilityGroupIpv4Addresses.ToArray();
         }
         string[] value = (from addr in array
                           select addr.ToString()).ToArray <string>();
         this.m_output.AppendLogMessage("Got the following IP addresses for the DAG (blank means DHCP): {0}", new object[]
         {
             string.Join(",", value)
         });
         this.m_clusDag = AmCluster.OpenByNames(enumerable);
         using (IAmClusterGroup amClusterGroup2 = this.m_clusDag.FindCoreClusterGroup())
         {
             using (IAmClusterResource amClusterResource = amClusterGroup2.FindResourceByTypeName("Network Name"))
             {
                 this.m_output.AppendLogMessage("Cluster group net name = '{0}'.", new object[]
                 {
                     amClusterResource.Name
                 });
                 LocalizedString value2 = AmClusterResourceHelper.FixUpIpAddressesForNetName(this.m_output, this.m_clusDag, (AmClusterGroup)amClusterGroup2, (AmClusterResource)amClusterResource, array);
                 this.m_output.WriteProgressSimple(Strings.DagTaskFixedUpIpResources(value2));
             }
         }
     }
 }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            bool flag = false;

            if ((base.Fields["ReplicationPort"] != null || base.Fields["NetworkCompression"] != null || base.Fields["NetworkEncryption"] != null || base.Fields["ManualDagNetworkConfiguration"] != null || base.Fields["DiscoverNetworks"] != null) && !this.m_dag.IsDagEmpty())
            {
                flag = true;
                this.m_IsObjectChanged = true;
            }
            if (this.DataObject.AllowCrossSiteRpcClientAccess != this.AllowCrossSiteRpcClientAccess)
            {
                if (base.Fields["AllowCrossSiteRpcClientAccess"] != null)
                {
                    this.DataObject.AllowCrossSiteRpcClientAccess = this.AllowCrossSiteRpcClientAccess;
                    this.m_IsObjectChanged = true;
                }
                else
                {
                    this.AllowCrossSiteRpcClientAccess = this.DataObject.AllowCrossSiteRpcClientAccess;
                }
            }
            if (this.m_fsw != null)
            {
                this.m_dag.SetWitnessServer(this.m_fsw.FileShareWitnessShare, this.m_fsw.WitnessDirectory);
                this.m_IsObjectChanged = true;
            }
            if (this.m_afsw != null)
            {
                this.m_dag.SetAlternateWitnessServer(this.m_afsw.FileShareWitnessShare, this.m_afsw.WitnessDirectory);
                this.m_IsObjectChanged = true;
            }
            else if (this.AlternateWitnessServer == null && this.m_alternateWitnessServerParameterSpecified)
            {
                this.m_dag.SetAlternateWitnessServer(null, null);
            }
            base.InternalProcessRecord();
            if (flag && !this.m_dag.IsDagEmpty())
            {
                SetDagNetworkConfigRequest setDagNetworkConfigRequest = new SetDagNetworkConfigRequest();
                if (base.Fields["ReplicationPort"] != null)
                {
                    setDagNetworkConfigRequest.ReplicationPort = this.ReplicationPort;
                }
                setDagNetworkConfigRequest.NetworkCompression            = this.m_dag.NetworkCompression;
                setDagNetworkConfigRequest.NetworkEncryption             = this.m_dag.NetworkEncryption;
                setDagNetworkConfigRequest.ManualDagNetworkConfiguration = this.m_dag.ManualDagNetworkConfiguration;
                if (base.Fields["DiscoverNetworks"] != null)
                {
                    setDagNetworkConfigRequest.DiscoverNetworks = true;
                }
                DagNetworkRpc.SetDagNetworkConfig(this.m_dag, setDagNetworkConfigRequest);
            }
            if (!this.m_dag.IsDagEmpty())
            {
                using (AmCluster amCluster = AmCluster.OpenDagClus(this.m_dag))
                {
                    if (amCluster.CnoName != string.Empty)
                    {
                        using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                        {
                            using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
                            {
                                IPAddress[] dagIpAddressesFromAd = this.GetDagIpAddressesFromAd(this.m_output, this.m_dag);
                                AmClusterResourceHelper.FixUpIpAddressesForNetName(this.m_output, amCluster, (AmClusterGroup)amClusterGroup, (AmClusterResource)amClusterResource, dagIpAddressesFromAd);
                                DagTaskHelper.LogCnoState(this.m_output, this.m_dag.Name, amClusterResource);
                            }
                        }
                    }
                }
                this.UpdateFileShareWitness();
                DagTaskHelper.NotifyServersOfConfigChange(this.m_allServers.Keys);
            }
            TaskLogger.LogExit();
        }
        // Token: 0x060008AC RID: 2220 RVA: 0x00029304 File Offset: 0x00027504
        internal static void CreateFileShareWitnessQuorum(ITaskOutputHelper output, IAmCluster cluster, string fswShare)
        {
            output = (output ?? NullTaskOutputHelper.GetNullLogger());
            IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup();

            if (amClusterGroup == null)
            {
                Thread.Sleep(10000);
                amClusterGroup = cluster.FindCoreClusterGroup();
                if (amClusterGroup == null)
                {
                    throw new FailedToGetClusterCoreGroupException();
                }
            }
            using (amClusterGroup)
            {
                IEnumerable <AmClusterResource> source = amClusterGroup.EnumerateResourcesOfType("File Share Witness");
                IAmClusterResource amClusterResource   = source.ElementAtOrDefault(0);
                try
                {
                    bool flag = false;
                    if (amClusterResource == null)
                    {
                        output.AppendLogMessage("CreateFileShareWitnessQuorum: Could not find an existing FSW resource. A new one will be created.", new object[0]);
                        flag = true;
                    }
                    else if (amClusterResource.GetState() == AmResourceState.Failed)
                    {
                        output.AppendLogMessage("CreateFileShareWitnessQuorum: The existing FSW resource is in a Failed state. It should be deleted and recreated.", new object[0]);
                        flag = true;
                    }
                    else
                    {
                        string privateProperty = amClusterResource.GetPrivateProperty <string>("SharePath");
                        if (!SharedHelper.StringIEquals(privateProperty, fswShare))
                        {
                            output.AppendLogMessage("CreateFileShareWitnessQuorum: There is already a FSW, but the current share path ({0}) is not what's desired ({1}). Will try to fix it.", new object[]
                            {
                                privateProperty,
                                fswShare
                            });
                            List <string> list = new List <string>(4);
                            foreach (IAmClusterNode amClusterNode in cluster.EnumerateNodes())
                            {
                                using (amClusterNode)
                                {
                                    if (!AmClusterNode.IsNodeUp(amClusterNode.State))
                                    {
                                        list.Add(amClusterNode.Name.NetbiosName);
                                    }
                                }
                            }
                            if (list.Count > 0)
                            {
                                output.WriteErrorSimple(new DagTaskSetDagNeedsAllNodesUpToChangeQuorumException(string.Join(",", list.ToArray())));
                            }
                            DagHelper.SetFswSharePath(output, cluster, amClusterResource, fswShare);
                        }
                    }
                    AmResourceState state;
                    if (!flag && amClusterResource != null)
                    {
                        try
                        {
                            state = amClusterResource.GetState();
                            if (state != AmResourceState.Online)
                            {
                                output.AppendLogMessage("The FSW is not online (it is {0}). Attempting to bring online.", new object[]
                                {
                                    state
                                });
                                amClusterResource.OnlineResource();
                            }
                            state = amClusterResource.GetState();
                            output.AppendLogMessage("The fsw resource is now in state {0}.", new object[]
                            {
                                state
                            });
                            if (state != AmResourceState.Online)
                            {
                                flag = true;
                            }
                        }
                        catch (ClusterException ex)
                        {
                            output.AppendLogMessage("Bringing the FSW resource online failed, so it will be deleted and recreated. For the record, the error was {0}", new object[]
                            {
                                ex
                            });
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        if (amClusterResource != null)
                        {
                            amClusterResource.Dispose();
                            amClusterResource = null;
                        }
                        output.AppendLogMessage("CreateFileShareWitnessQuorum: Calling RevertToMnsQuorum to clean everything up first.", new object[0]);
                        DagHelper.RevertToMnsQuorum(output, cluster);
                        string text = string.Format("File Share Witness ({0})", fswShare);
                        output.AppendLogMessage("Creating a new file share witness resource named '{0}'.", new object[]
                        {
                            text
                        });
                        amClusterResource = amClusterGroup.CreateResource(text, "File Share Witness");
                        DagHelper.SetFswSharePath(output, cluster, amClusterResource, fswShare);
                    }
                    output.AppendLogMessage("The FSW resource is now in state {0}.", new object[]
                    {
                        amClusterResource.GetState()
                    });
                    string text2;
                    uint   maxLogSize;
                    string quorumResourceInformation = cluster.GetQuorumResourceInformation(out text2, out maxLogSize);
                    output.AppendLogMessage("The current quorum resource is '{0}'. About to set it to the FSW.", new object[]
                    {
                        quorumResourceInformation
                    });
                    state = amClusterResource.GetState();
                    if (state != AmResourceState.Online)
                    {
                        output.WriteErrorSimple(new DagTaskFileShareWitnessResourceIsStillNotOnlineException(fswShare, state.ToString()));
                    }
                    cluster.SetQuorumResource(amClusterResource, null, maxLogSize);
                    quorumResourceInformation = cluster.GetQuorumResourceInformation(out text2, out maxLogSize);
                    output.AppendLogMessage("The quorum resource is now '{0}'.", new object[]
                    {
                        quorumResourceInformation
                    });
                    output.AppendLogMessage("Bringing the quorum resource online...", new object[0]);
                    amClusterResource.OnlineResource();
                }
                finally
                {
                    if (amClusterResource != null)
                    {
                        amClusterResource.Dispose();
                        amClusterResource = null;
                    }
                }
            }
        }
 // Token: 0x060008AD RID: 2221 RVA: 0x000296B0 File Offset: 0x000278B0
 private static void SetFswSharePath(ITaskOutputHelper output, IAmCluster cluster, IAmClusterResource fsw, string fswShare)
 {
     try
     {
         fsw.OfflineResource();
         fsw.SetPrivateProperty <string>("SharePath", fswShare);
         fsw.OnlineResource();
     }
     catch (ClusterException ex)
     {
         Win32Exception ex2 = null;
         if (ex.TryGetTypedInnerException(out ex2))
         {
             output.AppendLogMessage("SetFswSharePath() caught an AmClusterApiException with errorcode={0} and NativeErrorCode={1}. ex = {2}", new object[]
             {
                 ex2.ErrorCode,
                 ex2.NativeErrorCode,
                 ex2
             });
             if (ex2.NativeErrorCode == 5)
             {
                 string text = cluster.CnoName;
                 if (text == string.Empty)
                 {
                     using (IAmClusterGroup amClusterGroup = cluster.FindCoreClusterGroup())
                     {
                         if (amClusterGroup != null && amClusterGroup.OwnerNode != null)
                         {
                             text = amClusterGroup.OwnerNode.NetbiosName;
                         }
                     }
                 }
                 output.WriteErrorSimple(new DagTaskFswNeedsCnoPermissionException(fswShare, text));
             }
         }
         throw;
     }
 }
示例#10
0
        private List <string> JoinStartedNodes(IEnumerable <Server> serversToStart)
        {
            if (serversToStart == null)
            {
                throw new ArgumentNullException("serversToStart");
            }
            List <string> list = new List <string>(1);

            using (AmCluster amCluster = AmCluster.OpenDagClus(this.m_dag))
            {
                using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                {
                    try
                    {
                        using (DumpClusterTopology dumpClusterTopology = new DumpClusterTopology(amCluster, this.m_output))
                        {
                            dumpClusterTopology.Dump();
                        }
                    }
                    catch (ClusterException ex)
                    {
                        this.m_output.AppendLogMessage("DumpClusterTopology( {0} ) failed with exception = {1}. This is OK.", new object[]
                        {
                            this.m_dag.Name,
                            ex.Message
                        });
                        this.m_output.AppendLogMessage("Ignoring previous error, as it is acceptable if the cluster does not exist yet.", new object[0]);
                    }
                    AmServerName ownerNode = amClusterGroup.OwnerNode;
                    DatabaseTasksHelper.CheckReplayServiceRunningOnNode(ownerNode, new Task.TaskErrorLoggingDelegate(base.WriteError));
                    if (amCluster.CnoName != string.Empty)
                    {
                        using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
                        {
                            DagTaskHelper.LogCnoState(this.m_output, this.m_dag.Name, amClusterResource);
                        }
                    }
                    foreach (Server server in serversToStart)
                    {
                        bool         flag         = false;
                        AmServerName amServerName = new AmServerName(server);
                        try
                        {
                            if (amCluster.IsEvictedBasedOnMemberShip(amServerName))
                            {
                                this.m_output.WriteProgressSimple(Strings.ProgressJoinNode(amServerName.NetbiosName));
                                this.m_output.AppendLogMessage("ForceCleanup the Node {0}", new object[]
                                {
                                    server.Name
                                });
                                DatabaseAvailabilityGroupAction.ForceCleanupOneNodeLocally(this.m_dag.Name, server, TimeSpan.FromSeconds(15.0), this.m_output);
                                this.m_output.AppendLogMessage("Join the node {0} to the cluster", new object[]
                                {
                                    server.Name
                                });
                                DatabaseAvailabilityGroupAction.JoinOneNode(ownerNode, amServerName, this.m_output);
                                flag = true;
                            }
                            else
                            {
                                this.m_output.AppendLogMessage("{0} is not evicted", new object[]
                                {
                                    amServerName
                                });
                            }
                            if (!AmCluster.IsRunning(amServerName))
                            {
                                try
                                {
                                    this.m_output.AppendLogMessage("{0} cluster service is not running, try to start the service", new object[]
                                    {
                                        server.Name
                                    });
                                    this.m_output.WriteProgressSimple(Strings.ProgressStartClussvc(amServerName.NetbiosName));
                                    DatabaseAvailabilityGroupAction.TryStartClussvcOnNode(amServerName, this.m_output);
                                }
                                catch (InvalidOperationException)
                                {
                                    this.m_output.AppendLogMessage("Got an invalidOperationException, most likely the node {0} is force cleanedup", new object[]
                                    {
                                        amServerName
                                    });
                                    if (flag)
                                    {
                                        this.m_output.AppendLogMessage("STRANGE! we joined {0} but cannot start the service!", new object[]
                                        {
                                            amServerName
                                        });
                                        throw;
                                    }
                                    this.m_output.WriteProgressSimple(Strings.ProgressJoinNode(amServerName.NetbiosName));
                                    DatabaseAvailabilityGroupAction.JoinForceCleanupNode(ownerNode, amServerName, this.m_output);
                                    flag = true;
                                }
                            }
                            if (flag)
                            {
                                ICollection <AmServerName> startedMailboxServers = from server1 in this.m_dag.StartedMailboxServers
                                                                                   select new AmServerName(server1);
                                DatabaseAvailabilityGroupAction.FixIPAddress(new AmServerName(server.Fqdn), this.m_dag, startedMailboxServers, this.m_output);
                            }
                        }
                        catch (LocalizedException ex2)
                        {
                            this.m_output.WriteWarning(Strings.FailedToJoinNode(server.Name, this.m_dag.Name, ex2.Message));
                            list.Add(server.Name);
                        }
                        catch (InvalidOperationException ex3)
                        {
                            this.m_output.WriteWarning(Strings.FailedToJoinNode(server.Name, this.m_dag.Name, ex3.Message));
                            list.Add(server.Name);
                        }
                    }
                }
            }
            return(list);
        }