Browse Source

zones: extend scan to ensure every zone has a ceph monitor

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/9/head
Alejandro Mery 1 year ago
parent
commit
cea8362fe6
  1. 19
      pkg/zones/ceph_scan.go

19
pkg/zones/ceph_scan.go

@ -53,7 +53,7 @@ func (err CephMissingMonitorError) Error() string {
func (err *CephMissingMonitorError) writeNames(w *strings.Builder) { func (err *CephMissingMonitorError) writeNames(w *strings.Builder) {
if len(err.Names) > 0 { if len(err.Names) > 0 {
_, _ = w.WriteString(" mon_host:") _, _ = w.WriteString(" mon_initial_members:")
for i, name := range err.Names { for i, name := range err.Names {
if i != 0 { if i != 0 {
_, _ = w.WriteRune(',') _, _ = w.WriteRune(',')
@ -64,12 +64,14 @@ func (err *CephMissingMonitorError) writeNames(w *strings.Builder) {
} }
func (err *CephMissingMonitorError) writeAddrs(w *strings.Builder) { func (err *CephMissingMonitorError) writeAddrs(w *strings.Builder) {
_, _ = w.WriteString(" mon_initial_members:") if len(err.Addrs) > 0 {
for i, addr := range err.Addrs { _, _ = w.WriteString(" mon_host:")
if i != 0 { for i, addr := range err.Addrs {
_, _ = w.WriteRune(',') if i != 0 {
_, _ = w.WriteRune(',')
}
_, _ = w.WriteString(addr.String())
} }
_, _ = w.WriteString(addr.String())
} }
} }
@ -172,5 +174,10 @@ func (m *Zones) scanCephMonitors(_ *ScanOptions) error {
} }
} }
// make sure every zone has one
m.ForEachZone(func(z *Zone) bool {
_ = z.GetCephMonitors()
return false
})
return nil return nil
} }

Loading…
Cancel
Save