Example #1
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            DatabaseAvailabilityGroupNetwork dataObject                = this.DataObject;
            IConfigurationSession            configSession             = this.SetupAdSession();
            DatabaseAvailabilityGroup        databaseAvailabilityGroup = DagTaskHelper.DagIdParameterToDag(this.DatabaseAvailabilityGroup, configSession);

            DagTaskHelper.VerifyDagAndServersAreWithinScopes <DatabaseAvailabilityGroupNetwork>(this, databaseAvailabilityGroup, true);
            if (databaseAvailabilityGroup.IsDagEmpty())
            {
                base.WriteError(new DagNetworkEmptyDagException(databaseAvailabilityGroup.Name), ErrorCategory.InvalidArgument, null);
            }
            DagTaskHelper.PreventTaskWhenAutoNetConfigIsEnabled(databaseAvailabilityGroup, this);
            DagNetworkObjectId identity = new DagNetworkObjectId(databaseAvailabilityGroup.Name, dataObject.Name);

            dataObject.SetIdentity(identity);
            DagNetworkConfigDataProvider     dagNetworkConfigDataProvider     = (DagNetworkConfigDataProvider)base.DataSession;
            DagNetworkConfiguration          dagNetworkConfiguration          = dagNetworkConfigDataProvider.ReadNetConfig(databaseAvailabilityGroup);
            DatabaseAvailabilityGroupNetwork databaseAvailabilityGroupNetwork = dagNetworkConfiguration.FindNetwork(dataObject.Name);

            if (databaseAvailabilityGroupNetwork != null)
            {
                throw new DagNetworkManagementException(ServerStrings.DagNetworkCreateDupName(dataObject.Name));
            }
            DagNetworkValidation.ValidateSwitches(dataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
            if (base.Fields["Subnets"] != null)
            {
                DagNetworkValidation.ValidateSubnets(this.Subnets, dagNetworkConfiguration, this.Name, null, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                dataObject.ReplaceSubnets(this.Subnets);
            }
            TaskLogger.LogExit();
        }
Example #2
0
 private void ResolveParameters()
 {
     this.m_output.WriteProgressSimple(Strings.DagTaskValidatingParameters);
     this.m_dag           = DagTaskHelper.DagIdParameterToDag(this.Identity, this.ConfigurationSession);
     this.m_dagName       = this.m_dag.Name;
     this.m_mailboxServer = (Server)base.GetDataObject <Server>(this.MailboxServer, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(this.MailboxServer.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(this.MailboxServer.ToString())));
     DagTaskHelper.ServerToMailboxServer(new Task.TaskErrorLoggingDelegate(this.m_output.WriteError), this.m_mailboxServer);
     this.m_mailboxAmServerName = new AmServerName(this.m_mailboxServer.Fqdn);
     this.m_mailboxServerName   = this.m_mailboxServer.Name;
     this.m_configurationOnly   = this.ConfigurationOnly;
     this.m_skipDagValidation   = this.SkipDagValidation;
     DagTaskHelper.LogMachineIpAddresses(this.m_output, this.m_dagName);
     DagTaskHelper.LogMachineIpAddresses(this.m_output, this.m_mailboxAmServerName.Fqdn);
 }
Example #3
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     this.m_adSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 146, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Cluster\\DatabaseAvailabilityGroupAction.cs");
     this.m_output    = new HaTaskOutputHelper(this.TaskName, new Microsoft.Exchange.Configuration.Tasks.Task.TaskErrorLoggingDelegate(base.WriteError), new Microsoft.Exchange.Configuration.Tasks.Task.TaskWarningLoggingDelegate(this.WriteWarning), new Microsoft.Exchange.Configuration.Tasks.Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Microsoft.Exchange.Configuration.Tasks.Task.TaskProgressLoggingDelegate(base.WriteProgress), this.GetHashCode());
     this.m_output.CreateTempLogFile();
     this.NeedToUpdateAD      = true;
     this.NeedToUpdateCluster = true;
     if (this.ConfigurationOnly && this.QuorumOnly)
     {
         this.m_output.WriteErrorSimple(new TaskBothConfigurationOnlyAndQuorumOnlySpecifiedException());
     }
     if (this.ConfigurationOnly)
     {
         this.NeedToUpdateCluster = false;
     }
     if (this.QuorumOnly)
     {
         this.NeedToUpdateAD = false;
     }
     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.ResolveServers(this.m_output, this.m_dag, this.m_serversInDag, this.m_startedServers, this.m_stoppedServers);
     if (this.MailboxServer != null)
     {
         this.m_mailboxServer = (Server)base.GetDataObject <Server>(this.MailboxServer, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(this.MailboxServer.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(this.MailboxServer.ToString())));
         if (!this.m_mailboxServer.IsMailboxServer)
         {
             this.m_output.WriteErrorSimple(new OperationOnlyOnMailboxServerException(this.m_mailboxServer.Name));
         }
         if (this.m_mailboxServer.MajorVersion != Server.CurrentExchangeMajorVersion)
         {
             this.m_output.WriteErrorSimple(new DagTaskErrorServerWrongVersion(this.m_mailboxServer.Name));
         }
     }
     if (this.ActiveDirectorySite != null)
     {
         IConfigurationSession configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 225, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Cluster\\DatabaseAvailabilityGroupAction.cs");
         configurationSession.UseConfigNC      = false;
         configurationSession.UseGlobalCatalog = true;
         ADSite adsite = (ADSite)base.GetDataObject <ADSite>(this.ActiveDirectorySite, configurationSession, null, new LocalizedString?(Strings.ErrorSiteNotFound(this.ActiveDirectorySite.ToString())), new LocalizedString?(Strings.ErrorSiteNotUnique(this.ActiveDirectorySite.ToString())));
     }
     base.InternalValidate();
     TaskLogger.LogExit();
 }
Example #4
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();
 }