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); } }
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); }