|
|
|
@ -102,6 +102,7 @@ func (m *Cluster) initRegions(_ *ScanOptions) error {
|
|
|
|
|
|
|
|
|
|
m.sortRegions() |
|
|
|
|
m.scanRegionID() |
|
|
|
|
m.computeZonesRegion() |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -277,6 +278,35 @@ func (m *Cluster) scanRegionID() {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Cluster) computeZonesRegion() { |
|
|
|
|
fn := func(r *Region, z *Zone) { |
|
|
|
|
if z.region != nil { |
|
|
|
|
m.error(nil). |
|
|
|
|
WithField("zone", z.Name). |
|
|
|
|
WithField("region", []string{ |
|
|
|
|
z.region.Name, |
|
|
|
|
r.Name, |
|
|
|
|
}). |
|
|
|
|
Print("zone in two regions") |
|
|
|
|
} else { |
|
|
|
|
z.region = r |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
m.ForEachRegion(func(r *Region) bool { |
|
|
|
|
var term bool |
|
|
|
|
|
|
|
|
|
if r.IsPrimary() { |
|
|
|
|
r.ForEachZone(func(z *Zone) bool { |
|
|
|
|
fn(r, z) |
|
|
|
|
return term |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return term |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Cluster) getRegion(name string) (*Region, bool) { |
|
|
|
|
for i := range m.Regions { |
|
|
|
|
r := &m.Regions[i] |
|
|
|
|