private void MoveDatabasesBackToServer()
        {
            Exception ex = null;

            try
            {
                int            mountDialOverride        = (int)this.MountDialOverride;
                AmDbActionCode actionCode               = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move);
                List <AmDatabaseMoveResult> moveResults = AmRpcClientHelper.ServerMoveAllDatabases(null, this.m_targetServer.Fqdn, 0, 16, mountDialOverride, false, (int)this.GetSkipFlags(), (int)actionCode, this.MoveComment, out this.m_lastServerContacted);
                this.m_output.WriteProgress(Strings.ProgressStatusCompleted, this.GetRpcDoneProgressString(), 100);
                this.WriteMoveBackResults(moveResults);
            }
            catch (AmReplayServiceDownException ex2)
            {
                ex = new InvalidOperationException(Strings.ErrorActiveManagerIsNotReachable(ex2.ServerName, ex2.RpcErrorMessage));
            }
            catch (AmServerException ex3)
            {
                ex = ex3;
            }
            catch (AmServerTransientException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                TaskLogger.Trace("MoveActiveMdb.MoveDatabasesBackToServer raised exception while moving databases: {0}", new object[]
                {
                    ex
                });
                this.m_output.WriteError(ex, ErrorCategory.InvalidOperation, this.m_targetServer.Identity);
            }
        }
        internal static List <AmDatabaseMoveResult> PerformSystemFailover(string componentName, string comment, string fromServerFqdn)
        {
            AmDbActionCode amDbActionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.ManagedAvailability, AmDbActionCategory.Move);
            string         text;

            return(AmRpcClientHelper.ServerMoveAllDatabases(fromServerFqdn, null, 0, 16, -1, true, 0, amDbActionCode.IntValue, comment, componentName, out text));
        }
 private void MoveAllDatabasesFromSourceServer()
 {
     try
     {
         this.PopulateDatabaseCache();
         int            mountDialOverride        = (int)this.MountDialOverride;
         bool           tryOtherHealthyServers   = !this.TargetServerSpecified;
         AmDbActionCode actionCode               = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move);
         List <AmDatabaseMoveResult> moveResults = AmRpcClientHelper.ServerMoveAllDatabases(this.m_sourceServer.Fqdn, this.TargetServerSpecified ? this.m_targetServer.Fqdn : null, 0, 16, mountDialOverride, tryOtherHealthyServers, (int)this.GetSkipFlags(), (int)actionCode, this.MoveComment, out this.m_lastServerContacted);
         this.m_output.WriteProgress(Strings.ProgressStatusCompleted, this.GetRpcDoneProgressString(), 100);
         this.WriteAllMoveResults(moveResults);
     }
     catch (AmReplayServiceDownException ex)
     {
         TaskLogger.Trace("MoveMdbMaster.MoveAllDatabasesFromSourceServer raised exception while moving databases: {0}", new object[]
         {
             ex
         });
         this.m_output.WriteError(new InvalidOperationException(Strings.ErrorActiveManagerIsNotReachable(ex.ServerName, ex.RpcErrorMessage)), ErrorCategory.InvalidOperation, this.m_sourceServer.Identity);
     }
     catch (AmServerException ex2)
     {
         TaskLogger.Trace("MoveMdbMaster.MoveAllDatabasesFromSourceServer raised exception while moving databases: {0}", new object[]
         {
             ex2
         });
         this.m_output.WriteError(ex2, ErrorCategory.InvalidOperation, this.m_sourceServer.Identity);
     }
     catch (AmServerTransientException ex3)
     {
         TaskLogger.Trace("MoveMdbMaster.MoveAllDatabasesFromSourceServer raised exception while moving databases: {0}", new object[]
         {
             ex3
         });
         this.m_output.WriteError(ex3, ErrorCategory.InvalidOperation, this.m_sourceServer.Identity);
     }
 }