예제 #1
0
        // Token: 0x06000675 RID: 1653 RVA: 0x00017E78 File Offset: 0x00016078
        bool IWritableAD.SetDatabaseLegacyDnAndOwningServer(Guid mdbGuid, AmServerName lastMountedServerName, AmServerName masterServerName, bool isForceUpdate)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 43, "SetDatabaseLegacyDnAndOwningServer", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Shared\\WritableADHelper.cs");
            Database database = topologyConfigurationSession.FindDatabaseByGuid <Database>(mdbGuid);

            if (database == null)
            {
                AmTrace.Error("Failed to find Db using dbGuid {0}", new object[]
                {
                    mdbGuid
                });
                return(false);
            }
            MiniServer miniServer = topologyConfigurationSession.FindMiniServerByName(masterServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer);

            if (miniServer == null)
            {
                AmTrace.Error("Failed to find Server using {0}", new object[]
                {
                    masterServerName
                });
                return(false);
            }
            if (isForceUpdate || !database.Server.Equals(miniServer.Id))
            {
                MiniServer sourceServer = null;
                if (!AmServerName.IsNullOrEmpty(lastMountedServerName))
                {
                    sourceServer = topologyConfigurationSession.FindMiniServerByName(lastMountedServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer);
                }
                AmTrace.Debug("SetDatabaseLegacyDnAndOwningServer. Database '{0}', legdn='{1}'. Setting owning server: '{2}'.", new object[]
                {
                    database.Name,
                    database.ExchangeLegacyDN,
                    miniServer.Id
                });
                database.Server = miniServer.Id;
                WritableADHelper.SaveDatabasePropertiesOnMultipleServerSites(topologyConfigurationSession, database, sourceServer, miniServer, true);
                return(true);
            }
            AmTrace.Debug("Skipped to update legacy dn and owning server for database '{0}' since they are up to date. (owningserver={1})", new object[]
            {
                database.Name,
                database.Server
            });
            return(false);
        }
예제 #2
0
        // Token: 0x06000676 RID: 1654 RVA: 0x00017FA4 File Offset: 0x000161A4
        void IWritableAD.ResetAllowFileRestoreDsFlag(Guid mdbGuid, AmServerName lastMountedServerName, AmServerName masterServerName)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 108, "ResetAllowFileRestoreDsFlag", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Shared\\WritableADHelper.cs");
            Database database = topologyConfigurationSession.FindDatabaseByGuid <Database>(mdbGuid);

            if (database == null)
            {
                AmTrace.Error("Failed to find Db using dbGuid {0}", new object[]
                {
                    mdbGuid
                });
                return;
            }
            if (!database.AllowFileRestore)
            {
                AmTrace.Debug("Skipped to update legacy AllowFileRestore database '{0}'.)", new object[]
                {
                    database.Name
                });
                return;
            }
            MiniServer miniServer = topologyConfigurationSession.FindMiniServerByName(masterServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer);

            if (miniServer == null)
            {
                AmTrace.Error("Failed to find Server using {0}", new object[]
                {
                    masterServerName
                });
                return;
            }
            MiniServer sourceServer = null;

            if (!AmServerName.IsNullOrEmpty(lastMountedServerName))
            {
                sourceServer = topologyConfigurationSession.FindMiniServerByName(lastMountedServerName.NetbiosName, WritableADHelper.s_propertiesNeededFromServer);
            }
            AmTrace.Debug("Reset AllowFileRestore. Database '{0}', legdn='{1}'. Setting owning server: '{2}'.", new object[]
            {
                database.Name,
                database.ExchangeLegacyDN,
                miniServer.Id
            });
            database.AllowFileRestore = false;
            WritableADHelper.SaveDatabasePropertiesOnMultipleServerSites(topologyConfigurationSession, database, sourceServer, miniServer, true);
        }