public void ReportHealthyCopy(AmServerName specificServer, string adSiteName)
 {
     DatabaseValidationResult.Tracer.TraceDebug <AmServerName>((long)this.GetHashCode(), "ReportHealthy: {0}", specificServer);
     this.HealthyCopiesCount++;
     if (specificServer.Equals(this.m_targetServerName))
     {
         this.IsTargetCopyHealthy = true;
     }
     if (this.ActiveCopyStatus != null && specificServer.Equals(this.ActiveCopyStatus.ActiveServer))
     {
         this.IsActiveCopyHealthy = true;
     }
     else
     {
         this.HealthyPassiveCopiesCount++;
         this.TotalPassiveCopiesCount++;
     }
     if (this.HealthyCopiesCount < this.m_numHealthyCopiesMin || this.HealthyPassiveCopiesCount < this.m_numHealthyPassiveCopiesMin)
     {
         this.IsValidationSuccessful = false;
     }
     else
     {
         this.IsValidationSuccessful = true;
     }
     if (!string.IsNullOrEmpty(adSiteName))
     {
         this.IncrementHealthyCountInSite(adSiteName, true);
     }
 }
Exemple #2
0
 public void ChangeActiveServerForThirdParty(string newActiveServerName, TimeSpan lockTimeout)
 {
     using (AmDatabaseOperationLock.Lock(base.DatabaseGuid, AmDbLockReason.Move, new TimeSpan?(lockTimeout)))
     {
         if (!base.State.IsAdminDismounted)
         {
             throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedBecauseNotDismounted);
         }
         AmServerName activeServer = base.State.ActiveServer;
         AmServerName amServerName = new AmServerName(newActiveServerName);
         if (activeServer.Equals(amServerName))
         {
             throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedBecauseAlreadyActive(activeServer.ToString()));
         }
         IAmBcsErrorLogger     errorLogger           = new AmBcsSingleCopyFailureLogger();
         AmBcsServerChecks     checks                = AmBcsServerChecks.DebugOptionDisabled | AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted | AmBcsServerChecks.AutoActivationAllowed;
         LocalizedString       empty                 = LocalizedString.Empty;
         AmBcsServerValidation amBcsServerValidation = new AmBcsServerValidation(amServerName, activeServer, base.Database, base.Config, errorLogger, null);
         if (!amBcsServerValidation.RunChecks(checks, ref empty))
         {
             AmTrace.Error("ChangeActiveServerForThirdParty: DB {0}: ValidateServer() returned error: {1}", new object[]
             {
                 base.DatabaseName,
                 empty
             });
             throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedServerValidation(base.DatabaseName, newActiveServerName, empty));
         }
         base.WriteStateMountSkipped(amServerName);
         this.UpdateAdProperties(true, activeServer);
         ReplayCrimsonEvents.TPRChangeActiveServerSucceeded.Log <string, Guid, AmServerName, AmServerName>(base.DatabaseName, base.DatabaseGuid, activeServer, amServerName);
     }
 }
        // Token: 0x0600133D RID: 4925 RVA: 0x0004D334 File Offset: 0x0004B534
        public IEnumerable <CopyStatusClientCachedEntry> GetCopyStatusesByDatabase(Guid dbGuid, IEnumerable <AmServerName> servers, CopyStatusClientLookupFlags flags)
        {
            if (servers == null)
            {
                return(new List <CopyStatusClientCachedEntry>());
            }
            List <CopyStatusClientCachedEntry> list = null;

            if (!this.IsReadThroughNeeded(flags))
            {
                list = this.m_statusTable.GetCopyStatusCachedEntriesByDatabase(dbGuid);
            }
            if (list == null)
            {
                list = new List <CopyStatusClientCachedEntry>(servers.Count <AmServerName>());
            }
            using (IEnumerator <AmServerName> enumerator = servers.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AmServerName server = enumerator.Current;
                    if (!list.Any((CopyStatusClientCachedEntry status) => server.Equals(status.ServerContacted)))
                    {
                        list.Add(this.GetCopyStatusCachedEntry(dbGuid, server, flags));
                    }
                }
            }
            return((from status in list
                    where servers.Contains(status.ServerContacted)
                    select status).ToList <CopyStatusClientCachedEntry>());
        }
Exemple #4
0
 // Token: 0x0600195A RID: 6490 RVA: 0x000694E4 File Offset: 0x000676E4
 private int IsTargetServer(AmServerName server, AmServerName targetServer)
 {
     if (!server.Equals(targetServer))
     {
         return(0);
     }
     return(1);
 }
 public void ReportFailedCopy(AmServerName specificServer, string adSiteName)
 {
     DatabaseValidationResult.Tracer.TraceDebug <AmServerName>((long)this.GetHashCode(), "ReportFailed: {0}", specificServer);
     if (this.ActiveCopyStatus == null || !specificServer.Equals(this.ActiveCopyStatus.ActiveServer))
     {
         this.TotalPassiveCopiesCount++;
     }
     if (!string.IsNullOrEmpty(adSiteName))
     {
         this.IncrementHealthyCountInSite(adSiteName, false);
     }
 }
        // Token: 0x0600082D RID: 2093 RVA: 0x00027DB4 File Offset: 0x00025FB4
        private static System.Management.ManagementScope GetManagementScope(AmServerName machineName)
        {
            ManagementPath    path              = new ManagementPath(string.Format("\\\\{0}\\root\\cimv2", machineName.Fqdn));
            AmServerName      amServerName      = new AmServerName(Environment.MachineName);
            ConnectionOptions connectionOptions = new ConnectionOptions();

            if (!amServerName.Equals(machineName))
            {
                connectionOptions.Authority = string.Format("Kerberos:host/{0}", machineName.Fqdn);
            }
            return(new System.Management.ManagementScope(path, connectionOptions));
        }
Exemple #7
0
        public bool MoveGroupToReplayEnabledNode(IsReplayRunning isReplayRunning, string resourceType, TimeSpan timeout, out string finalDestinationNode)
        {
            finalDestinationNode = null;
            if (resourceType == string.Empty)
            {
                return(this.MoveGroupToReplayEnabledNode(isReplayRunning, timeout, out finalDestinationNode));
            }
            IEnumerable <AmClusterResource> enumerable = this.EnumerateResourcesOfType(resourceType);
            AmClusterResource amClusterResource        = enumerable.ElementAtOrDefault(0);

            if (amClusterResource != null)
            {
                try
                {
                    AmServerName ownerNode = this.OwnerNode;
                    foreach (string text in amClusterResource.EnumeratePossibleOwnerNames())
                    {
                        AmServerName amServerName = new AmServerName(text);
                        if (!ownerNode.Equals(amServerName) && isReplayRunning(amServerName.Fqdn))
                        {
                            try
                            {
                                AmClusterGroup.MoveClusterGroupWithTimeout(ownerNode, amServerName, timeout);
                                if (this.OwnerNode.Equals(amServerName))
                                {
                                    finalDestinationNode = amServerName.Fqdn;
                                    return(true);
                                }
                            }
                            catch (ClusterException arg)
                            {
                                ExTraceGlobals.ClusterTracer.TraceError <string, string, ClusterException>((long)this.GetHashCode(), "MoveGroupToReplayEnabledNode: MoveGroup ({0}) to node {1} failed with exception: {2}.", this.Name, text, arg);
                            }
                        }
                    }
                    return(false);
                }
                finally
                {
                    foreach (AmClusterResource amClusterResource2 in enumerable)
                    {
                        amClusterResource2.Dispose();
                    }
                }
            }
            return(this.MoveGroupToReplayEnabledNode(isReplayRunning, timeout, out finalDestinationNode));
        }
        private void FilterActiveDatabases(ActiveManager activeManager, IEnumerable <Database> databases)
        {
            AmServerName amServerName = new AmServerName(this.server);

            foreach (Database database in databases)
            {
                if (this.IncludePassive)
                {
                    this.databases.Add(database);
                }
                else
                {
                    DatabaseLocationInfo serverForDatabase = activeManager.GetServerForDatabase(database.Guid);
                    AmServerName         dst = new AmServerName(serverForDatabase.ServerFqdn);
                    if (amServerName.Equals(dst))
                    {
                        this.databases.Add(database);
                    }
                }
            }
        }
Exemple #9
0
 private void MovePamIfNeeded()
 {
     try
     {
         using (IAmClusterGroup amClusterGroup = this.m_clusDag.FindCoreClusterGroup())
         {
             AmServerName ownerNode = amClusterGroup.OwnerNode;
             this.m_output.AppendLogMessage("The core cluster group '{0}' is currently on machine '{1}'.", new object[]
             {
                 amClusterGroup.Name,
                 ownerNode.NetbiosName
             });
             if (ownerNode.Equals(this.m_mailboxAmServerName))
             {
                 this.m_output.WriteProgressSimple(ReplayStrings.DagTaskMovingPam(this.m_mailboxServerName));
                 string resourceType = (this.m_clusDag.CnoName == string.Empty) ? string.Empty : "Network Name";
                 string newPam;
                 if (!amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), resourceType, TimeSpan.FromMinutes(3.0), out newPam))
                 {
                     this.m_output.WriteWarning(ReplayStrings.DagTaskPamNotMovedSubsequentOperationsMayBeSlowOrUnreliable);
                 }
                 else
                 {
                     this.m_output.WriteProgressSimple(ReplayStrings.DagTaskMovedPam(newPam));
                 }
             }
         }
     }
     catch (LocalizedException ex)
     {
         this.m_output.AppendLogMessage("MoveGroupToReplayEnabledNode encountered the following exception: {0}", new object[]
         {
             ex
         });
         this.m_output.WriteWarning(ReplayStrings.DagTaskPamNotMovedSubsequentOperationsMayBeSlowOrUnreliable);
     }
 }
        private bool IsDatabaseActiveOnSourceServer(Database db, Dictionary <Guid, DatabaseLocationInfo> dbInfoTable)
        {
            AmServerName amServerName = new AmServerName(dbInfoTable[db.Guid].ServerFqdn);

            return(amServerName.Equals(this.m_sourceAmServer));
        }