protected override void InternalProcessRecord() { this.m_output.WriteProgressIncrementalSimple(Strings.ProgressForceQuorum, 10); if (!this.m_isQuorumPresent && !this.ForceQuorumIfNecessary()) { this.m_output.WriteErrorSimple(new DagTaskQuorumNotAchievedException(this.m_dag.Name)); } this.m_output.WriteProgressIncrementalSimple(Strings.ProgressChangeFsw, 20); DatabaseAvailabilityGroupAction.EvictStoppedNodes(this.m_dag, this.m_stoppedServers.Values, this.m_output); this.ProcessFileShareWitness(); IEnumerable <AmServerName> amServerNamesFromServers = RestoreDatabaseAvailabilityGroup.GetAmServerNamesFromServers(this.m_startedServers.Values); using (AmCluster amCluster = AmCluster.OpenByNames(amServerNamesFromServers)) { bool shouldBeFsw = DagTaskHelper.ShouldBeFileShareWitness(this.m_output, this.m_dag, amCluster, false); DagTaskHelper.ChangeQuorumToMnsOrFswAsAppropriate(this.m_output, this, this.m_dag, amCluster, this.m_afsw, this.m_afsw, shouldBeFsw, !this.UsePrimaryWitnessServer); this.DeleteLastLogGenerationTimeStamps(amCluster, this.m_stoppedServers.Values, this.m_output); } this.m_output.WriteProgressIncrementalSimple(Strings.ProgressTaskComplete, 100); base.InternalProcessRecord(); }
protected override void InternalProcessRecord() { Dictionary <AmServerName, Server> dictionary = new Dictionary <AmServerName, Server>(16); if (this.m_mailboxServer != null) { AmServerName serverName = new AmServerName(this.m_mailboxServer.Fqdn); if (!this.m_serversInDag.Keys.Any((AmServerName serverInDag) => serverInDag.Equals(serverName))) { this.m_output.WriteErrorSimple(new DagTaskServerIsNotInDagException(serverName.Fqdn, this.m_dag.Name)); } dictionary.Add(serverName, this.m_mailboxServer); if (base.NeedToUpdateAD) { if (!this.m_stoppedServers.ContainsKey(serverName)) { this.m_stoppedServers.Add(serverName, this.m_mailboxServer); this.m_output.AppendLogMessage("{0} added to stopped list", new object[] { serverName.NetbiosName }); } if (this.m_startedServers.ContainsKey(serverName)) { this.m_startedServers.Remove(serverName); this.m_output.AppendLogMessage("{0} removed from started list", new object[] { serverName.NetbiosName }); } } } else { dictionary = DatabaseAvailabilityGroupAction.GetServersInSite(this.m_output, this.m_serversInDag.Values, base.ActiveDirectorySite); if (base.NeedToUpdateAD) { foreach (AmServerName amServerName in dictionary.Keys) { if (!this.m_stoppedServers.ContainsKey(amServerName)) { this.m_output.AppendLogMessage("add {0} to stopped list", new object[] { amServerName.NetbiosName }); this.m_stoppedServers.Add(amServerName, this.m_serversInDag[amServerName]); } if (this.m_startedServers.ContainsKey(amServerName)) { this.m_output.AppendLogMessage("Remove {0} from started list", new object[] { amServerName.NetbiosName }); this.m_startedServers.Remove(amServerName); } } } } if (base.NeedToUpdateAD) { this.m_dag.StoppedMailboxServers = DatabaseAvailabilityGroupAction.ServerListToFqdnList(this.m_stoppedServers.Keys); this.m_dag.StartedMailboxServers = DatabaseAvailabilityGroupAction.ServerListToFqdnList(this.m_startedServers.Keys); this.m_adSession.Save(this.m_dag); this.m_output.AppendLogMessage("updated the started servers list in AD:", new object[0]); foreach (AmServerName amServerName2 in this.m_startedServers.Keys) { this.m_output.AppendLogMessage("\t{0}", new object[] { amServerName2.NetbiosName }); } this.m_output.AppendLogMessage("updated the stopped servers list in AD:", new object[0]); foreach (AmServerName amServerName3 in this.m_stoppedServers.Keys) { this.m_output.AppendLogMessage("\t{0}", new object[] { amServerName3.NetbiosName }); } base.ForceADReplication(); } if (base.NeedToUpdateCluster) { if (DatabaseAvailabilityGroupAction.IsClusterUp(this.m_dag, this.m_output)) { DatabaseAvailabilityGroupAction.EvictStoppedNodes(this.m_dag, dictionary.Values, this.m_output); } else { DatabaseAvailabilityGroupAction.ForceCleanupStoppedNodes(this.m_dag, dictionary.Values, TimeSpan.FromSeconds(15.0), this.m_output); } TimeSpan timeout = TimeSpan.FromSeconds(1.0); foreach (AmServerName amServerName4 in dictionary.Keys) { this.m_output.AppendLogMessage("notify replayservice on {0} with consensus state 0", new object[] { amServerName4.NetbiosName }); AmRpcClientHelper.RpcchSetAutomountConsensusStateBestEffort(amServerName4.Fqdn, 0, timeout); } } base.InternalProcessRecord(); }