// Token: 0x06001962 RID: 6498 RVA: 0x00069DC8 File Offset: 0x00067FC8 private Exception ExecuteAssignSpare(AutoReseedWorkflowState state) { Exception ex = null; try { bool flag = true; MountedFolderPath mountedFolderPath; if (!MountedFolderPath.IsNullOrEmpty(this.m_volumeForMissingMountPoint)) { this.LogBeginExecute(state); flag = false; string name = base.Context.Database.Name; DatabaseSpareInfo dbInfo = new DatabaseSpareInfo(name, new MountedFolderPath(Path.Combine(base.Context.Dag.AutoDagDatabasesRootFolderPath.PathName, name))); ExchangeVolume exchangeVolume = base.Context.VolumeManager.FixupMountPointForDatabase(dbInfo, this.m_volumeForMissingMountPoint); this.UpdateVolumeInfoCopyState(base.Context.Database.Guid); ReplayCrimsonEvents.AutoReseedWorkflowDbMountPointMissing.Log <string, Guid, string, string, MountedFolderPath, MountedFolderPath>(name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason, exchangeVolume.ExchangeVolumeMountPoint, exchangeVolume.VolumeName); } else if (this.IsVolumeRecentlyAssigned(this.m_targetDbSet, out mountedFolderPath)) { flag = false; base.TraceDebug("Skipping assigning a new volume since a volume was recently assigned. ReseedRecoveryActionRetryCount: {0}", new object[] { state.ReseedRecoveryActionRetryCount }); state.AssignedVolumeName = mountedFolderPath.Path; } if (flag) { this.LogBeginExecute(state); DatabaseSpareInfo[] dbInfos = (from status in this.m_targetDbSet select new DatabaseSpareInfo(status.CopyStatus.DBName, new MountedFolderPath(Path.Combine(base.Context.Dag.AutoDagDatabasesRootFolderPath.PathName, status.CopyStatus.DBName)))).ToArray <DatabaseSpareInfo>(); ExchangeVolume exchangeVolume2 = base.Context.VolumeManager.AssignSpare(dbInfos); base.TraceDebug("Assigned spare volume: {0}", new object[] { exchangeVolume2.VolumeName.Path }); foreach (CopyStatusClientCachedEntry copyStatusClientCachedEntry in this.m_targetDbSet) { this.UpdateVolumeInfoCopyState(copyStatusClientCachedEntry.DbGuid); } ReplayCrimsonEvents.AutoReseedWorkflowDbFailedAssignSpareSucceeded.Log <string, Guid, string, string, MountedFolderPath, MountedFolderPath>(base.Context.Database.Name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason, exchangeVolume2.ExchangeVolumeMountPoint, exchangeVolume2.VolumeName); state.AssignedVolumeName = exchangeVolume2.VolumeName.Path; } else { base.TraceDebug("Re-using previously assigned volume: {0}", new object[] { state.AssignedVolumeName }); } state.UpdateReseedRecoveryAction(ReseedState.InPlaceReseed); } catch (DatabaseVolumeInfoException ex2) { ex = ex2; } this.LogExecuteCompleted(state, ex); return(ex); }
private ExchangeVolume ParseVolume(JToken token) { ExchangeVolume vol = new ExchangeVolume(); JProperty[] props = token.Children <JProperty>().ToArray(); if (props.Length == 3) { vol.PriceSymbol = props[0].Name; vol.PriceAmount = (decimal)props[0].Value; vol.QuantitySymbol = props[1].Name; vol.QuantityAmount = (decimal)props[1].Value; vol.Timestamp = CryptoUtility.UnixTimeStampToDateTimeMilliseconds((long)props[2].Value); } return(vol); }
private void Run() { DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "DiskReclaimer: Entering Run()..."); IMonitoringADConfig config = this.m_adConfigProvider.GetConfig(true); if (config.ServerRole == MonitoringServerRole.Standalone) { DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "DiskReclaimer: Skipping running DiskReclaimerManager because local server is not a member of a DAG."); return; } if (!config.Dag.AutoDagDiskReclaimerEnabled) { DiskReclaimerManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "DiskReclaimer: Skipping running DiskReclaimerManager because the local DAG '{0}' has AutoDagDiskReclaimerEnabled set to disabled.", config.Dag.Name); return; } if (DiskReclaimerManager.ShouldSkipDueToServerNotConfigured(config.TargetMiniServer)) { DiskReclaimerManager.Tracer.TraceDebug <AmServerName>((long)this.GetHashCode(), "DiskReclaimer: Skipping running DiskReclaimerManager because the local server '{0}' is not yet fully configured in the AD.", config.TargetServerName); return; } this.m_volumeManager.Refresh(config); if (MountPointUtil.IsConfigureMountPointsEnabled()) { bool flag = false; DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "DiskReclaimer: Regkey ConfigureMountPointsPostReInstall is set. Starting mountpoint configuration on all Exchange volumes."); ReplayCrimsonEvents.DiskReclaimerPostInstallConfigStarted.LogPeriodic <string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, "ConfigureMountPointsPostReInstall"); this.ConfigureVolumesPostReInstall(config, out flag); this.m_volumeManager.Refresh(config); if (flag) { DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "DiskReclaimer: Database copies might be missing in AD. ConfigureMountPointsPostReInstall will not be disabled to allow DiskReclaimer to run again."); return; } this.UpdateVolumeForNeverMountedActives(config); ReplayCrimsonEvents.DiskReclaimerPostInstallConfigCompleted.LogPeriodic <string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, "ConfigureMountPointsPostReInstall"); DiskReclaimerManager.m_lastVolumeScanTime = DateTime.MinValue; Exception ex; if ((ex = MountPointUtil.DisableConfigureMountPoints()) != null) { DiskReclaimerManager.Tracer.TraceError <Exception>((long)this.GetHashCode(), "DiskReclaimer: Failed to reset regkey ConfigureMountPointsPostReInstall after configuring mountpoints. Error: {0}", ex); ReplayCrimsonEvents.DiskReclaimerError.LogPeriodic <Exception>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, ex); } } this.m_volumeManager.DetermineMisconfiguredVolumes(config); if (!this.IsSafeToLookForQuarantinedDisks()) { DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "DiskReclaimer: Skip scanning for quarantined volumes..."); return; } DiskReclaimerManager.m_lastVolumeScanTime = DateTime.UtcNow; ReplayCrimsonEvents.DiskReclaimerInitiated.Log(); List <ExchangeVolume>[] array = this.m_volumeManager.DetermineVolumeSpareStatuses(); List <ExchangeVolume> list = array[4]; if (list == null || list.Count == 0) { DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "Run(): No volumes that need to be reclaimed found. Exiting."); } else { DiskReclaimerManager.Tracer.TraceDebug <int>((long)this.GetHashCode(), "DiskReclaimer: Found {0} volumes that can potentially be reclaimed.", list.Count); DatabaseHealthValidationRunner databaseHealthValidationRunner = new DatabaseHealthValidationRunner(config.TargetServerName.NetbiosName); databaseHealthValidationRunner.Initialize(); List <string> list2 = new List <string>(); foreach (IHealthValidationResultMinimal healthValidationResultMinimal in databaseHealthValidationRunner.RunDatabaseRedundancyChecksForCopyRemoval(true, null, true, true, -1)) { if (!healthValidationResultMinimal.IsValidationSuccessful) { list2.Add(healthValidationResultMinimal.ErrorMessageWithoutFullStatus); } } if (list2.Count == 0) { DiskReclaimerManager.Tracer.TraceDebug((long)this.GetHashCode(), "DiskReclaimer: Passed copy removal redundancy check for this server. Trying to reclaim one quarantined volume..."); IEnumerable <IADDatabase> enumerable = config.DatabaseMap[config.TargetServerName]; IEnumerable <CopyStatusClientCachedEntry> copyStatusesByServer = this.m_statusLookup.GetCopyStatusesByServer(config.TargetServerName, enumerable, CopyStatusClientLookupFlags.None); using (List <ExchangeVolume> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { ExchangeVolume exchangeVolume = enumerator2.Current; ExchangeVolumeDbStatusInfo filesInformationFromVolume = this.m_volumeManager.GetFilesInformationFromVolume(exchangeVolume, enumerable, copyStatusesByServer); bool flag2; Exception ex2; if (this.m_volumeManager.TryReclaimVolume(exchangeVolume, filesInformationFromVolume, out flag2, out ex2)) { DiskReclaimerManager.Tracer.TraceDebug <MountedFolderPath, MountedFolderPath>((long)this.GetHashCode(), "DiskReclaimer: Successfully reclaimed volume '{0}' mounted at '{1}' as a spare.", exchangeVolume.VolumeName, exchangeVolume.ExchangeVolumeMountPoint); ReplayCrimsonEvents.DiskReclaimerSucceeded.Log <string, string>(exchangeVolume.VolumeName.Path, exchangeVolume.ExchangeVolumeMountPoint.Path); this.m_volumeManager.DetermineVolumeSpareStatuses(); break; } if (flag2) { DiskReclaimerManager.Tracer.TraceError <MountedFolderPath, MountedFolderPath, Exception>((long)this.GetHashCode(), "DiskReclaimer: Failed to reclaim volume '{0}' mounted at '{1}' as a spare. However, formatting the volume apparently succeeded. Error: {2}", exchangeVolume.VolumeName, exchangeVolume.ExchangeVolumeMountPoint, ex2); ReplayCrimsonEvents.DiskReclaimerSparingFailed.Log <string, string, bool, string>(exchangeVolume.VolumeName.Path, exchangeVolume.ExchangeVolumeMountPoint.Path, flag2, ex2.Message); this.m_volumeManager.DetermineVolumeSpareStatuses(); break; } DiskReclaimerManager.Tracer.TraceError <MountedFolderPath, MountedFolderPath, Exception>((long)this.GetHashCode(), "DiskReclaimer: Failed to format and reclaim volume '{0}' mounted at '{1}' as a spare. Error: {2}", exchangeVolume.VolumeName, exchangeVolume.ExchangeVolumeMountPoint, ex2); ReplayCrimsonEvents.DiskReclaimerSparingFailed.Log <string, string, bool, string>(exchangeVolume.VolumeName.Path, exchangeVolume.ExchangeVolumeMountPoint.Path, flag2, ex2.Message); } goto IL_477; } } string text = string.Join("\n\n", list2); DiskReclaimerManager.Tracer.TraceError <string>((long)this.GetHashCode(), "DiskReclaimer: Skip sparing. One or more databases on this server failed copy removal redundancy check. Reason: {0}", text); ReplayCrimsonEvents.DiskReclaimerRedundancyPrereqFailed.LogPeriodic <string>(text.GetHashCode(), DiagCore.DefaultEventSuppressionInterval, text); } IL_477: this.RunBitlockerMaintenance(config); }