diff --git a/controller/volume_controller.go b/controller/volume_controller.go index 88ec38ae4d..ece1111b8c 100644 --- a/controller/volume_controller.go +++ b/controller/volume_controller.go @@ -1690,6 +1690,7 @@ func (c *VolumeController) openVolumeDependentResources(v *longhorn.Volume, e *l } replicaAddressMap := map[string]string{} + anyRunningReplica := false for _, r := range rs { // Ignore unscheduled replicas if r.Spec.NodeID == "" { @@ -1707,10 +1708,12 @@ func (c *VolumeController) openVolumeDependentResources(v *longhorn.Volume, e *l if r.Status.CurrentState == longhorn.InstanceStateError { continue } - // wait for all potentially healthy replicas become running - if r.Status.CurrentState != longhorn.InstanceStateRunning { - log.WithField("replica", r.Name).Debug("Replica is not running yet, just skip this round reconcile.") - return nil + // wait at least one replica is running + if r.Status.CurrentState == longhorn.InstanceStateRunning { + anyRunningReplica = true + } else { + log.WithField("replica", r.Name).Debug("Replica is not running yet, just continue to check next.") + continue } if r.Status.IP == "" { log.WithField("replica", r.Name).Warn("Replica is running but IP is empty") @@ -1726,6 +1729,9 @@ func (c *VolumeController) openVolumeDependentResources(v *longhorn.Volume, e *l } replicaAddressMap[r.Name] = imutil.GetURL(r.Status.StorageIP, r.Status.Port) } + if !anyRunningReplica { + return nil + } if len(replicaAddressMap) == 0 { return fmt.Errorf("no healthy or scheduled replica for starting") }