Ejemplo n.º 1
0
        internal bool ForceADReplication()
        {
            Server server = this.m_adSession.FindLocalServer();

            if (server == null)
            {
                return(false);
            }
            ADObjectId localServerSite = server.ServerSite;

            ADObjectId[] array = (from s in DatabaseAvailabilityGroupAction.GetSitesForDag(this.m_dag)
                                  where s != null && !s.Equals(localServerSite)
                                  select s).Distinct <ADObjectId>().ToArray <ADObjectId>();
            if (array != null && array.Length > 0)
            {
                this.m_output.AppendLogMessage("forcing AD replication to site {0}", new object[]
                {
                    array[0].Name
                });
                DagTaskHelper.ForceReplication(this.m_adSession, this.m_dag, array, this.m_dag.Name, new Microsoft.Exchange.Configuration.Tasks.Task.TaskWarningLoggingDelegate(this.WriteWarning), new Microsoft.Exchange.Configuration.Tasks.Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                this.m_output.AppendLogMessage("forcing replication succeeded", new object[0]);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
 protected override void InternalValidate()
 {
     this.m_output = new HaTaskOutputHelper("restore-databaseavailabilitygroup", new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskProgressLoggingDelegate(base.WriteProgress), this.GetHashCode());
     this.m_output.CreateTempLogFile();
     this.LogCommandLineParameters();
     this.m_output.WriteProgressIncrementalSimple(Strings.ProgressValidation, 5);
     this.m_dag = DagTaskHelper.DagIdParameterToDag(this.Identity, base.DataSession);
     DagTaskHelper.VerifyDagAndServersAreWithinScopes <DatabaseAvailabilityGroup>(this, this.m_dag, true);
     if (this.m_dag.DatacenterActivationMode != DatacenterActivationModeOption.DagOnly)
     {
         this.m_output.WriteErrorSimple(new TaskCanOnlyRunOnDacException(this.m_dag.Name));
     }
     DatabaseAvailabilityGroupAction.ResolveServersBasedOnStoppedList(this.m_output, this.m_dag, this.m_servers, this.m_startedServers, this.m_stoppedServers);
     if (this.ActiveDirectorySite != null)
     {
         List <ADObjectId> sitesForDag = DatabaseAvailabilityGroupAction.GetSitesForDag(this.m_dag);
         ADObjectId        adobjectId  = null;
         foreach (ADObjectId adobjectId2 in sitesForDag)
         {
             if (DatabaseAvailabilityGroupAction.SiteEquals(adobjectId2, this.ActiveDirectorySite))
             {
                 adobjectId = adobjectId2;
             }
         }
         if (adobjectId == null)
         {
             this.m_output.WriteErrorSimple(new InvalidAdSiteException(this.ActiveDirectorySite.ToString()));
         }
     }
     this.m_isQuorumPresent = this.CheckClussvcRunningOnStartedServers();
     if (this.UsePrimaryWitnessServer)
     {
         if (this.m_dag.WitnessServer == null)
         {
             this.m_output.WriteErrorSimple(new RestoreNeedsWitnessServerException(this.m_dag.Name));
         }
     }
     else if (this.m_dag.AlternateWitnessServer == null && this.AlternateWitnessServer == null)
     {
         this.m_output.WriteErrorSimple(new RestoreNeedsAlternateWitnessServerException(this.m_dag.Name));
     }
     base.InternalValidate();
 }