private AmServerName GetPrimaryActiveManager(DatabaseAvailabilityGroup dag) { Exception ex = null; AmServerName result = null; try { result = DagTaskHelper.GetPrimaryActiveManagerNode(dag); } catch (AmFailedToDeterminePAM amFailedToDeterminePAM) { ex = amFailedToDeterminePAM; } catch (AmServerException ex2) { ex = ex2; } catch (AmServerTransientException ex3) { ex = ex3; } if (ex != null) { base.WriteError(new PAMCouldNotBeDeterminedException(dag.Name, ex.Message, ex), ErrorCategory.ConnectionError, dag); return(null); } return(result); }
private void UpdatePam(DatabaseAvailabilityGroup dag) { try { AmServerName primaryActiveManagerNode = DagTaskHelper.GetPrimaryActiveManagerNode(dag); if (primaryActiveManagerNode != null) { dag.PrimaryActiveManager = DagTaskHelper.FindServerAdObjectIdInDag(dag, primaryActiveManagerNode); } } catch (RpcException ex) { this.WriteWarning(Strings.PAMRPCError(ex.Message)); } catch (AmFailedToDeterminePAM amFailedToDeterminePAM) { this.WriteWarning(Strings.PAMOtherError(amFailedToDeterminePAM.Message)); } catch (AmServerException ex2) { this.WriteWarning(Strings.PAMOtherError(ex2.Message)); } catch (AmServerTransientException ex3) { this.WriteWarning(Strings.PAMOtherError(ex3.Message)); } }