Esempio n. 1
0
        public static bool MovePrimaryActiveManagerRole(string CurrentPrimaryName)
        {
            AmServerName serverName = new AmServerName(CurrentPrimaryName);
            bool         result;

            using (IAmCluster amCluster = ClusterFactory.Instance.OpenByName(serverName))
            {
                using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                {
                    string text;
                    result = amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", new TimeSpan(0, 3, 0), out text);
                }
            }
            return(result);
        }
Esempio n. 2
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);
     }
 }
Esempio n. 3
0
        // Token: 0x060001A2 RID: 418 RVA: 0x0000A078 File Offset: 0x00008278
        internal static bool AttemptServerSwitchoverOnShutdown()
        {
            AmTrace.Entering("ActiveManagerCore.AttemptServerSwitchoverOnShutdown", new object[0]);
            ExDateTime utcNow = ExDateTime.UtcNow;

            ReplayEventLogConstants.Tuple_PreShutdownStart.LogEvent(null, new object[0]);
            Exception ex     = null;
            bool      result = false;

            try
            {
                AmConfig config = AmSystemManager.Instance.Config;
                if (config.IsPamOrSam)
                {
                    string fqdn = config.DagConfig.CurrentPAM.Fqdn;
                    AmTrace.Debug("{0} Trying to mount all the databases on other servers", new object[]
                    {
                        ExDateTime.Now
                    });
                    AmRpcClientHelper.ServerSwitchOver(fqdn, AmServerName.LocalComputerName.Fqdn);
                    if (config.IsPAM)
                    {
                        AmTrace.Debug("{0} Trying to move PAM off this node", new object[]
                        {
                            ExDateTime.Now
                        });
                        using (IAmCluster amCluster = ClusterFactory.Instance.Open())
                        {
                            using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                            {
                                TimeSpan ts       = ExDateTime.UtcNow.Subtract(utcNow);
                                TimeSpan timeSpan = TimeSpan.FromSeconds(115.0).Subtract(ts);
                                if (!(timeSpan <= TimeSpan.Zero))
                                {
                                    if (amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", timeSpan, out fqdn))
                                    {
                                        ReplayEventLogConstants.Tuple_SuccMovePAM.LogEvent(null, new object[]
                                        {
                                            Environment.MachineName,
                                            fqdn
                                        });
                                        AmTrace.Debug("{0} Moved PAM to another node", new object[]
                                        {
                                            ExDateTime.Now
                                        });
                                        goto IL_197;
                                    }
                                }
                                ReplayEventLogConstants.Tuple_FailedMovePAM.LogEvent(null, new object[]
                                {
                                    Environment.MachineName
                                });
                                IL_197 :;
                            }
                        }
                    }
                    result = true;
                    ReplayEventLogConstants.Tuple_PreShutdownOK.LogEvent(null, new object[0]);
                }
            }
            catch (ClusterException ex2)
            {
                ex = ex2;
            }
            catch (AmRpcException ex3)
            {
                ex = ex3;
            }
            catch (AmServerTransientException ex4)
            {
                ex = ex4;
            }
            catch (AmServerException ex5)
            {
                ex = ex5;
            }
            finally
            {
                if (ex != null)
                {
                    ReplayEventLogConstants.Tuple_PreShutdownFailed.LogEvent(null, new object[]
                    {
                        ex.Message
                    });
                }
                AmTrace.Leaving("ActiveManagerCore.AttemptServerSwitchoverOnShutdown", new object[0]);
            }
            return(result);
        }