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. 11
      pkg/zones/ceph_scan.go

11
pkg/zones/ceph_scan.go

@ -53,7 +53,7 @@ func (err CephMissingMonitorError) Error() string {
func (err *CephMissingMonitorError) writeNames(w *strings.Builder) {
if len(err.Names) > 0 {
_, _ = w.WriteString(" mon_host:")
_, _ = w.WriteString(" mon_initial_members:")
for i, name := range err.Names {
if i != 0 {
_, _ = w.WriteRune(',')
@ -64,7 +64,8 @@ func (err *CephMissingMonitorError) writeNames(w *strings.Builder) {
}
func (err *CephMissingMonitorError) writeAddrs(w *strings.Builder) {
_, _ = w.WriteString(" mon_initial_members:")
if len(err.Addrs) > 0 {
_, _ = w.WriteString(" mon_host:")
for i, addr := range err.Addrs {
if i != 0 {
_, _ = w.WriteRune(',')
@ -72,6 +73,7 @@ func (err *CephMissingMonitorError) writeAddrs(w *strings.Builder) {
_, _ = w.WriteString(addr.String())
}
}
}
// AsError returns nil if the instance is actually OK
func (err *CephMissingMonitorError) AsError() error {
@ -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
}

Loading…
Cancel
Save