Exemple #1
0
        internal static bool WriteStateSyncMountStatus(AmConfig amConfig, AmDbStateInfo stateInfo, Guid databaseGuid, AmServerName activeServer, MountStatus mountStatus)
        {
            bool flag = false;

            if (mountStatus == MountStatus.Mounted)
            {
                stateInfo.UpdateActiveServerAndIncrementFailoverSequenceNumber(activeServer);
                stateInfo.LastMountedServer         = activeServer;
                stateInfo.IsAdminDismounted         = false;
                stateInfo.MountStatus               = mountStatus;
                stateInfo.IsAutomaticActionsAllowed = true;
                stateInfo.LastMountedTime           = DateTime.UtcNow;
                flag = true;
            }
            else if (stateInfo.IsEntryExist)
            {
                stateInfo.MountStatus = mountStatus;
                if (stateInfo.IsMountSucceededAtleastOnce)
                {
                    stateInfo.UpdateActiveServerAndIncrementFailoverSequenceNumber(activeServer);
                    stateInfo.LastMountedServer = activeServer;
                }
                flag = true;
            }
            if (flag && AmDbAction.WriteState(amConfig, stateInfo, false))
            {
                AmDatabaseStateTracker databaseStateTracker = AmSystemManager.Instance.DatabaseStateTracker;
                if (databaseStateTracker != null)
                {
                    databaseStateTracker.UpdateActive(databaseGuid, activeServer);
                }
            }
            return(flag);
        }
Exemple #2
0
 internal bool WriteState(bool isBestEffort)
 {
     return(AmDbAction.WriteState(this.Config, this.State, isBestEffort));
 }