// Token: 0x060000AB RID: 171 RVA: 0x00004F20 File Offset: 0x00003120 protected override void RunInternal() { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(this.m_nodeName.NetbiosName); if (iadserver == null) { throw new ServerNotFoundException(this.m_nodeName.NetbiosName); } IADDatabase[] array = iadtoplogyConfigurationSession.GetAllDatabases(iadserver).ToArray <IADDatabase>(); if (array.Length <= 0) { AmTrace.Info("Server '{0}' does not have any databases that needs to be marked as dismounted", new object[] { this.m_nodeName }); return; } AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, this.m_reasonCode, AmDbActionCategory.SyncState); foreach (IADDatabase db in array) { AmDbClusterDatabaseSyncOperation operation = new AmDbClusterDatabaseSyncOperation(db, actionCode); this.m_clusDbSyncRequests++; base.EnqueueDatabaseOperation(operation); } base.StartDatabaseOperations(); }
public static List <string> GetServersWithServerRoleInSite(string serverName, ServerRole serverRole) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = null; if (!string.IsNullOrEmpty(serverName)) { if (!SharedHelper.StringIEquals(serverName, "localhost")) { goto IL_2F; } } try { iadserver = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName); goto IL_5A; } catch (LocalServerNotFoundException) { goto IL_5A; } IL_2F: string nodeNameFromFqdn = MachineName.GetNodeNameFromFqdn(serverName); iadserver = iadtoplogyConfigurationSession.FindServerByName(nodeNameFromFqdn); string arg = "FindServerByName"; if (iadserver == null) { ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string, string>(0L, "GetServersWithServerRoleInSite: {0} didn't find any server for {1}", arg, serverName); } IL_5A: return(ReplayConfiguration.GetServersWithServerRoleInSiteByServer(iadserver, serverRole)); }
public static void TaskConstructAllDatabaseConfigurations(IADDatabaseAvailabilityGroup dag, IADServer server, out List <ReplayConfiguration> activeConfigurations, out List <ReplayConfiguration> passiveConfigurations) { activeConfigurations = new List <ReplayConfiguration>(20); passiveConfigurations = new List <ReplayConfiguration>(48); ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance(); IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IEnumerable <IADDatabase> allDatabases = iadtoplogyConfigurationSession.GetAllDatabases(server); if (allDatabases != null) { foreach (IADDatabase mdb in allDatabases) { bool flag; Exception ex; ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(dag, mdb, server, noncachingActiveManagerInstance, out flag, out ex); if (replayConfiguration != null) { if (flag) { activeConfigurations.Add(replayConfiguration); } else { passiveConfigurations.Add(replayConfiguration); } } } } }
public static IADDatabaseAvailabilityGroup GetLocalServerDatabaseAvailabilityGroup(out string errorMessage) { IADDatabaseAvailabilityGroup iaddatabaseAvailabilityGroup = null; Exception ex = null; errorMessage = string.Empty; try { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(Dependencies.ManagementClassHelper.LocalMachineName); if (iadserver != null) { iaddatabaseAvailabilityGroup = iadtoplogyConfigurationSession.FindDagByServer(iadserver); if (iaddatabaseAvailabilityGroup == null) { ex = new CouldNotFindDagObjectForServer(iadserver.Name); } } else { ex = new CouldNotFindServerObject(Environment.MachineName); } } catch (ADTransientException ex2) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex2 }); ex = ex2; } catch (ADExternalException ex3) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex3 }); ex = ex3; } catch (ADOperationException ex4) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex4 }); ex = ex4; } if (iaddatabaseAvailabilityGroup == null) { errorMessage = ex.Message; if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ex.ToString(); } } return(iaddatabaseAvailabilityGroup); }
internal ADConfigLookupComponent() { IReplayAdObjectLookup replayAdObjectLookup = Dependencies.ReplayAdObjectLookup; IReplayAdObjectLookup replayAdObjectLookupPartiallyConsistent = Dependencies.ReplayAdObjectLookupPartiallyConsistent; this.AdSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); this.AdSessionPartiallyConsistent = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true); this.ADConfigManager = new MonitoringADConfigManager(replayAdObjectLookup, replayAdObjectLookupPartiallyConsistent, this.AdSession, this.AdSessionPartiallyConsistent); Dependencies.Container.RegisterInstance <IMonitoringADConfigProvider>(this.ADConfigManager); }
// Token: 0x06000087 RID: 135 RVA: 0x000045F4 File Offset: 0x000027F4 protected IADDatabase[] GetDatabases() { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(this.m_nodeName.NetbiosName); if (iadserver == null) { throw new ServerNotFoundException(this.m_nodeName.NetbiosName); } return(iadtoplogyConfigurationSession.GetAllDatabases(iadserver).ToArray <IADDatabase>()); }
private void CleanupStaleEntries(IClusterDB clusdb) { IMonitoringADConfig config = Dependencies.MonitoringADConfigProvider.GetConfig(true); HashSet <Guid> validDatabaseGuids; HashSet <Guid> databasesToBeDeleted = this.GetDatabasesToBeDeleted(config, clusdb, out validDatabaseGuids); Dictionary <Guid, IADServer> validServers; HashSet <Guid> serversToBeDeleted = this.GetServersToBeDeleted(config, clusdb, out validServers); if (databasesToBeDeleted.Count == 0 && serversToBeDeleted.Count == 0) { this.staleDatabases.Clear(); this.staleServers.Clear(); return; } IADToplogyConfigurationSession adSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); this.CleanupDatabases(adSession, clusdb, databasesToBeDeleted, validDatabaseGuids); this.CleanupServers(adSession, clusdb, serversToBeDeleted, validServers); }
// Token: 0x0600241D RID: 9245 RVA: 0x000A8E60 File Offset: 0x000A7060 private IADDatabase LookupDatabase(Guid databaseId) { IADDatabase db = null; Exception ex = this.DoADAction(delegate(object param0, EventArgs param1) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); db = iadtoplogyConfigurationSession.FindDatabaseByGuid(databaseId); }); if (db != null) { return(db); } ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug <Guid, Exception>(0L, "LookupDatabase({0}) failed. Ex={1}", databaseId, ex); if (ex == null) { throw new NoSuchDatabaseException(databaseId); } throw ex; }
// Token: 0x0600002B RID: 43 RVA: 0x000024F0 File Offset: 0x000006F0 public static string ResolveFqdn(string shortNodeName, bool throwException) { string fqdn = null; Exception ex = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); iadtoplogyConfigurationSession.UseConfigNC = false; iadtoplogyConfigurationSession.UseGlobalCatalog = true; IADComputer iadcomputer = iadtoplogyConfigurationSession.FindComputerByHostName(shortNodeName); if (iadcomputer != null && !string.IsNullOrEmpty(iadcomputer.DnsHostName)) { fqdn = iadcomputer.DnsHostName; return; } if (throwException) { throw new AmGetFqdnFailedNotFoundException(shortNodeName); } AmTrace.Error("FQDN resolution of the short name {0} failed. Could not find valid DNS hostname from ADComputer query.", new object[] { shortNodeName }); fqdn = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName); }); if (ex != null) { if (throwException) { throw new AmGetFqdnFailedADErrorException(shortNodeName, ex.Message, ex); } AmTrace.Error("FQDN resolution of the short name {0} failed. Error: {1}", new object[] { shortNodeName, ex.Message }); fqdn = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName); } return(fqdn); }
public static IADDatabaseAvailabilityGroup GetLocalServerDatabaseAvailabilityGroup(IADToplogyConfigurationSession adSession, out Exception exception) { IADDatabaseAvailabilityGroup dag = null; Exception objNotFoundEx = null; exception = null; exception = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { if (adSession == null) { adSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); } if (adSession != null) { IADServer iadserver = adSession.FindServerByName(SharedDependencies.ManagementClassHelper.LocalMachineName); if (iadserver != null) { ADObjectId databaseAvailabilityGroup = iadserver.DatabaseAvailabilityGroup; if (databaseAvailabilityGroup != null) { dag = adSession.ReadADObject <IADDatabaseAvailabilityGroup>(databaseAvailabilityGroup); return; } } else { objNotFoundEx = new CouldNotFindServerObject(Environment.MachineName); } } }); if (objNotFoundEx != null) { exception = objNotFoundEx; } return(dag); }
// Token: 0x06000030 RID: 48 RVA: 0x00002874 File Offset: 0x00000A74 public void PopulateForDag() { Dictionary <string, AmServerNameCache.CacheEntry> dictionary = new Dictionary <string, AmServerNameCache.CacheEntry>(16, MachineName.Comparer); Exception ex = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); Exception ex2; IADDatabaseAvailabilityGroup localServerDatabaseAvailabilityGroup = DirectoryHelper.GetLocalServerDatabaseAvailabilityGroup(iadtoplogyConfigurationSession, out ex2); if (ex2 != null) { AmServerNameCache.Tracer.TraceError <Exception>(0L, "PopulateForDag failed to get DAG: {0}", ex2); return; } if (localServerDatabaseAvailabilityGroup != null) { iadtoplogyConfigurationSession.UseConfigNC = false; iadtoplogyConfigurationSession.UseGlobalCatalog = true; MultiValuedProperty <ADObjectId> servers = localServerDatabaseAvailabilityGroup.Servers; if (servers != null) { foreach (ADObjectId adobjectId in servers) { IADComputer iadcomputer = iadtoplogyConfigurationSession.FindComputerByHostName(adobjectId.Name); if (iadcomputer != null && !string.IsNullOrEmpty(iadcomputer.DnsHostName)) { AmServerNameCache.CacheEntry cacheEntry = new AmServerNameCache.CacheEntry(); cacheEntry.ExpiryTime = ExDateTime.Now + this.TimeToLive; cacheEntry.Fqdn = iadcomputer.DnsHostName; } else { AmServerNameCache.Tracer.TraceError <ADObjectId>(0L, "PopulateForDag could not map server {0}", adobjectId); } } } } }); if (ex != null) { AmServerNameCache.Tracer.TraceError <Exception>(0L, "PopulateForDag did not replace cache because: {0}", ex); return; } if (dictionary != null) { AmServerNameCache.Tracer.TraceDebug(0L, "PopulateForDag replaced the cache"); try { this.m_rwLock.EnterWriteLock(); this.m_cache = dictionary; } finally { try { this.m_rwLock.ExitWriteLock(); } catch (SynchronizationLockException) { } } } }
// Token: 0x060013B9 RID: 5049 RVA: 0x000502BC File Offset: 0x0004E4BC public void Initialize() { if (Interlocked.CompareExchange(ref this.m_fInitialized, 1, 0) == 1) { return; } this.ADConfig = MonitoringADConfig.GetConfig(new AmServerName(this.m_serverName, true), Dependencies.ReplayAdObjectLookup, Dependencies.ReplayAdObjectLookupPartiallyConsistent, ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true), ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true), null); ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance(); AmMultiNodeCopyStatusFetcher amMultiNodeCopyStatusFetcher = new AmMultiNodeCopyStatusFetcher(this.ADConfig.AmServerNames, this.ADConfig.DatabaseMap, RpcGetDatabaseCopyStatusFlags2.None, noncachingActiveManagerInstance, false); Dictionary <Guid, Dictionary <AmServerName, CopyStatusClientCachedEntry> > status = amMultiNodeCopyStatusFetcher.GetStatus(); CopyStatusClientLookupTable copyStatusClientLookupTable = new CopyStatusClientLookupTable(); copyStatusClientLookupTable.UpdateCopyStatusCachedEntries(status); this.CopyStatusLookup = new CopyStatusClientLookup(copyStatusClientLookupTable, null, noncachingActiveManagerInstance); }
// Token: 0x06000058 RID: 88 RVA: 0x00002D55 File Offset: 0x00000F55 internal AmStartupAutoMounter() { this.m_adSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); this.m_reasonCode = AmDbActionReason.Startup; }