示例#1
0
 private void InitState(ManagedServiceState state)
 {
     _logger.LogTrace($"Initiating {state} state");
     if (state != ManagedServiceState.Normal && state != ManagedServiceState.Failover)
     {
         _logger.LogError("Wrong state was requested to initiate");
         return;
     }
     if (state == ManagedServiceState.Normal)
     {
         _masterFile.UpdateIPAddressResourceRecord(GetRecordFqdn(), _options.Value.TargetFailover, _options.Value.TargetNormal);
     }
     if (state == ManagedServiceState.Failover)
     {
         _masterFile.UpdateIPAddressResourceRecord(GetRecordFqdn(), _options.Value.TargetNormal, _options.Value.TargetFailover);
     }
     _masterFile.IncreaseSoaSerialNumber(_options.Value.Domain);
     ServiceState = state;
     _logger.LogInformation($"Switched to {state} state");
 }