Esempio n. 1
0
        // Token: 0x060007AC RID: 1964 RVA: 0x00024EE0 File Offset: 0x000230E0
        public static List <AmDatabaseMoveResult> Move(AmDbMoveArguments moveArgs)
        {
            List <AmDatabaseMoveResult> result;

            using (BatchDatabaseOperation batchDatabaseOperation = new BatchDatabaseOperation())
            {
                IADConfig adconfig = Dependencies.ADConfig;
                IEnumerable <IADDatabase> databasesOnServer = adconfig.GetDatabasesOnServer(moveArgs.TargetServer);
                AmConfig config = AmSystemManager.Instance.Config;
                foreach (IADDatabase iaddatabase in databasesOnServer)
                {
                    IADDatabaseCopy databaseCopy = iaddatabase.GetDatabaseCopy(moveArgs.TargetServer.NetbiosName);
                    if (databaseCopy != null && iaddatabase.ReplicationType == ReplicationType.Remote && databaseCopy.ActivationPreference == 1 && !MoveBackToServer.IsAlreadyOnTarget(iaddatabase, moveArgs.TargetServer, config))
                    {
                        batchDatabaseOperation.AddOperation(new AmDbMoveOperation(iaddatabase, moveArgs.ActionCode)
                        {
                            Arguments = moveArgs
                        });
                    }
                }
                batchDatabaseOperation.DispatchOperations();
                batchDatabaseOperation.WaitForComplete();
                List <AmDbOperation>        completedOperationList = batchDatabaseOperation.GetCompletedOperationList();
                List <AmDatabaseMoveResult> list = new List <AmDatabaseMoveResult>(completedOperationList.Count);
                foreach (AmDbOperation amDbOperation in completedOperationList)
                {
                    if (amDbOperation.DetailedStatus != null)
                    {
                        list.Add(amDbOperation.ConvertDetailedStatusToRpcMoveResult(amDbOperation.DetailedStatus));
                    }
                }
                result = list;
            }
            return(result);
        }
        // Token: 0x0600008B RID: 139 RVA: 0x000046B4 File Offset: 0x000028B4
        private void MoveDatabasesNormally(AmDbActionCode actionCode, IADDatabase[] dbList)
        {
            AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable;
            LocalizedString      reason             = LocalizedString.Empty;

            foreach (IADDatabase iaddatabase in dbList)
            {
                if (iaddatabase.ReplicationType == ReplicationType.Remote && this.IsActiveOnServer(iaddatabase, this.m_nodeName, out reason))
                {
                    dbNodeAttemptTable.ClearFailedTime(iaddatabase.Guid);
                    AmDbMoveOperation amDbMoveOperation = new AmDbMoveOperation(iaddatabase, actionCode);
                    amDbMoveOperation.Arguments.SourceServer = this.m_nodeName;
                    AmDbMoveArguments arguments = amDbMoveOperation.Arguments;
                    this.PrepareMoveArguments(ref arguments);
                    amDbMoveOperation.Arguments = arguments;
                    this.m_moveRequests++;
                    base.EnqueueDatabaseOperation(amDbMoveOperation);
                }
                else
                {
                    if (iaddatabase.ReplicationType != ReplicationType.Remote)
                    {
                        reason = ReplayStrings.AmDbMoveOperationNotSupportedException(iaddatabase.Name);
                    }
                    AmDbSkippedMoveOperation operation = new AmDbSkippedMoveOperation(iaddatabase, reason);
                    this.m_moveRequests++;
                    base.EnqueueDatabaseOperation(operation);
                }
            }
            base.StartDatabaseOperations();
        }
Esempio n. 3
0
        // Token: 0x060001A8 RID: 424 RVA: 0x0000A59C File Offset: 0x0000879C
        internal void MoveDatabase(Guid mdbGuid, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, ref AmDatabaseMoveResult databaseMoveResult)
        {
            AmTrace.Debug("Task: MoveDatabase({0},{1},{2},{3},{4},{5},{6},{7},'{8}') called", new object[]
            {
                mdbGuid,
                mountFlags,
                dismountFlags,
                mountDialOverride,
                fromServer,
                targetServer,
                tryOtherHealthyServers,
                actionCode,
                moveComment
            });
            ActiveManagerCore.ValidatePamOrStandalone("MoveDatabase");
            ThirdPartyManager.PreventOperationWhenTPREnabled("MoveDatabase");
            IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough);

            if (iaddatabase == null)
            {
                throw new AmDatabaseNotFoundException(mdbGuid);
            }
            AmDbMoveOperation    amDbMoveOperation    = new AmDbMoveOperation(iaddatabase, actionCode);
            AmDbMoveArguments    arguments            = amDbMoveOperation.Arguments;
            AmDbCompletionReason amDbCompletionReason = AmDbCompletionReason.None;

            arguments.MountFlags             = mountFlags;
            arguments.DismountFlags          = dismountFlags;
            arguments.MountDialOverride      = mountDialOverride;
            arguments.SourceServer           = fromServer;
            arguments.TargetServer           = targetServer;
            arguments.TryOtherHealthyServers = tryOtherHealthyServers;
            arguments.SkipValidationChecks   = skipValidationChecks;
            arguments.MoveComment            = moveComment;
            amDbMoveOperation.Arguments      = arguments;
            amDbMoveOperation.Enqueue();
            try
            {
                amDbCompletionReason = amDbMoveOperation.Wait();
            }
            finally
            {
                if (amDbMoveOperation.DetailedStatus != null)
                {
                    databaseMoveResult = amDbMoveOperation.ConvertDetailedStatusToRpcMoveResult(amDbMoveOperation.DetailedStatus);
                }
            }
            AmTrace.Debug("MoveDatabase({0}) completed (reason={1})", new object[]
            {
                mdbGuid,
                amDbCompletionReason
            });
        }
Esempio n. 4
0
        private void HandleMountTimeout(AmServerName serverThatFailedToMount, AmMountTimeoutException timeoutException)
        {
            ReplayCrimsonEvents.MountTimeout.Log <string, Guid, string, string>(base.DatabaseName, base.DatabaseGuid, serverThatFailedToMount.Fqdn, timeoutException.Message);
            AmDbActionCode    actionCode        = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.TimeoutFailure, AmDbActionCategory.Move);
            AmDbMoveOperation amDbMoveOperation = new AmDbMoveOperation(base.Database, actionCode);
            AmDbMoveArguments arguments         = amDbMoveOperation.Arguments;

            arguments.MountDialOverride = DatabaseMountDialOverride.None;
            arguments.MoveComment       = timeoutException.Message;
            arguments.SourceServer      = serverThatFailedToMount;
            amDbMoveOperation.Arguments = arguments;
            amDbMoveOperation.Enqueue();
        }
Esempio n. 5
0
        // Token: 0x060001AA RID: 426 RVA: 0x0000A74C File Offset: 0x0000894C
        internal List <AmDatabaseMoveResult> ServerMoveAllDatabases(AmServerName sourceServer, AmServerName targetServer, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, string componentName)
        {
            AmTrace.Debug("ServerMoveAllDatabases() called: sourceServer='{0}', targetServer='{1}', mountFlags='{2}', dismountFlags='{3}', mountDialOverride='{4}', tryOtherHealthyServers='{5}', skipValidationChecks='{6}', actionCode='{7}', MoveComment='{8}' Component='{9}'", new object[]
            {
                sourceServer,
                targetServer,
                mountFlags,
                dismountFlags,
                mountDialOverride,
                tryOtherHealthyServers,
                skipValidationChecks,
                actionCode,
                moveComment,
                componentName
            });
            ActiveManagerCore.ValidatePamOrStandalone("ServerMoveAllDatabases");
            ThirdPartyManager.PreventOperationWhenTPREnabled("ServerMoveAllDatabases");
            AmDbMoveArguments amDbMoveArguments = new AmDbMoveArguments(actionCode);

            amDbMoveArguments.SourceServer           = sourceServer;
            amDbMoveArguments.TargetServer           = targetServer;
            amDbMoveArguments.MountFlags             = mountFlags;
            amDbMoveArguments.DismountFlags          = dismountFlags;
            amDbMoveArguments.MountDialOverride      = mountDialOverride;
            amDbMoveArguments.TryOtherHealthyServers = tryOtherHealthyServers;
            amDbMoveArguments.SkipValidationChecks   = skipValidationChecks;
            amDbMoveArguments.MoveComment            = moveComment;
            amDbMoveArguments.ComponentName          = componentName;
            if (string.IsNullOrEmpty(sourceServer.Fqdn))
            {
                return(MoveBackToServer.Move(amDbMoveArguments));
            }
            AmEvtMoveAllDatabasesBase amEvtMoveAllDatabasesBase;

            if (actionCode.IsAutomaticManagedAvailabilityFailover)
            {
                amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnComponentRequest(sourceServer);
            }
            else
            {
                amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnAdminRequest(sourceServer);
            }
            amEvtMoveAllDatabasesBase.MoveArgs = amDbMoveArguments;
            amEvtMoveAllDatabasesBase.Notify();
            amEvtMoveAllDatabasesBase.WaitForSwitchoverComplete();
            AmTrace.Debug("ServerMoveAllDatabases({0}) completed", new object[]
            {
                sourceServer
            });
            return(amEvtMoveAllDatabasesBase.GetMoveResultsForOperationsRun());
        }
 protected override void PrepareMoveArguments(ref AmDbMoveArguments moveArgs)
 {
     moveArgs.MountDialOverride = DatabaseMountDialOverride.Lossless;
 }
Esempio n. 7
0
 // Token: 0x060000A7 RID: 167 RVA: 0x00004EC5 File Offset: 0x000030C5
 protected override void PrepareMoveArguments(ref AmDbMoveArguments moveArgs)
 {
     moveArgs = this.Arguments;
 }
Esempio n. 8
0
 // Token: 0x060000A1 RID: 161 RVA: 0x00004DD4 File Offset: 0x00002FD4
 internal AmSystemSwitchoverOnComponentMove(AmDbMoveArguments args) : base(args.SourceServer)
 {
     this.Arguments = args;
 }
 // Token: 0x0600008A RID: 138
 protected abstract void PrepareMoveArguments(ref AmDbMoveArguments moveArgs);