diff --git a/service/controller.go b/service/controller.go index 3c84b53a..170b1145 100644 --- a/service/controller.go +++ b/service/controller.go @@ -2616,7 +2616,7 @@ func (s *service) getZoneFromZoneLabelKey(ctx context.Context, zoneLabelKey stri func (s *service) systemProbeAll(ctx context.Context) error { // probe all arrays Log.Infoln("Probing all associated arrays") - errMap := new(sync.Map) + errMap := make(map[string]error) zoneName := "" usingZones := s.opts.zoneLabelKey != "" && s.isNodeMode() @@ -2629,9 +2629,6 @@ func (s *service) systemProbeAll(ctx context.Context) error { Log.Infof("probing zoneLabel '%s', zone value: '%s'", s.opts.zoneLabelKey, zoneName) } - var wg sync.WaitGroup - errChan := make(chan error, len(s.opts.arrays)) - newCtx, cancel := createProbeContextWithDeadline(ctx) defer cancel() @@ -2641,42 +2638,25 @@ func (s *service) systemProbeAll(ctx context.Context) error { // Driver node containers should not probe arrays that exist outside their assigned zone // Driver controller container should probe all arrays Log.Infof("array %s zone %s does not match %s, not pinging this array\n", array.SystemID, array.AvailabilityZone.Name, zoneName) - errChan <- fmt.Errorf("array %s zone %s does not match %s, not pinging this array", array.SystemID, array.AvailabilityZone.Name, zoneName) + errMap[array.SystemID] = fmt.Errorf("array %s zone %s does not match %s, not pinging this array", array.SystemID, array.AvailabilityZone.Name, zoneName) continue } - wg.Add(1) - - go func(array *ArrayConnectionData) { - defer wg.Done() - - err := s.systemProbe(newCtx, array) - systemID := array.SystemID - if err != nil { - errMap.Store(systemID, err) - Log.Errorf("array %s probe failed: %v", array.SystemID, err) - errChan <- err - } else { - Log.Infof("array %s probed successfully", systemID) - } - }(array) - } - - go func() { - wg.Wait() - close(errChan) - }() - - var errs []error - for err := range errChan { - errs = append(errs, err) + err := s.systemProbe(newCtx, array) + systemID := array.SystemID + if err != nil { + errMap[systemID] = err + Log.Errorf("array %s probe failed: %v", array.SystemID, err) + } else { + Log.Infof("array %s probed successfully", systemID) + } } - Log.Printf("[SystemProbeAll] Number of failed probes: %d", len(errs)) + Log.Printf("[SystemProbeAll] Number of failed probes: %d", len(errMap)) - if len(errs) == len(s.opts.arrays) { + if len(errMap) == len(s.opts.arrays) { return status.Error(codes.FailedPrecondition, - fmt.Sprintf("All arrays are not working. Could not proceed further: %v", errs)) + fmt.Sprintf("All arrays are not working. Could not proceed further: %v", errMap)) } return nil @@ -2684,9 +2664,6 @@ func (s *service) systemProbeAll(ctx context.Context) error { // systemProbe will probe the given array func (s *service) systemProbe(ctx context.Context, array *ArrayConnectionData) error { - s.probeMutex.Lock() - defer s.probeMutex.Unlock() - // Check that we have the details needed to login to the Gateway if array.Endpoint == "" { return status.Error(codes.FailedPrecondition, diff --git a/service/service.go b/service/service.go index b10a7830..4b5148cf 100644 --- a/service/service.go +++ b/service/service.go @@ -208,8 +208,6 @@ type service struct { // maps the first 24 bits of a volume ID to the volume's systemID volumePrefixToSystems map[string][]string connectedSystemNameToID map[string]string - - probeMutex sync.Mutex } type Config struct {