@ -59,6 +59,15 @@ func (m *Env) writeEnvZone(w io.Writer, z *Zone) {
// ZONE{zoneID}_GW
gateways , _ := z . GatewayIDs ( )
m . writeEnvVarInts ( w , gateways , "ZONE%v_%s" , zoneID , "GW" )
// Ceph
monitors := z . GetCephMonitors ( )
// MON{zoneID}_NAME
m . writeEnvVar ( w , genEnvZoneCephMonNames ( monitors ) , "MON%v_%s" , zoneID , "NAME" )
// MON{zoneID}_IP
m . writeEnvVar ( w , genEnvZoneCephMonIPs ( monitors ) , "MON%v_%s" , zoneID , "IP" )
// MON{zoneID}_ID
m . writeEnvVar ( w , genEnvZoneCephMonIDs ( monitors ) , "MON%v_%s" , zoneID , "ID" )
}
func ( m * Env ) writeEnvVarInts ( w io . Writer , value [ ] int , name string , args ... any ) {
@ -111,3 +120,44 @@ func genEnvZoneNodes(z *Zone) string {
}
return ""
}
func genEnvZoneCephMonNames ( m Machines ) string {
var buf strings . Builder
m . ForEachMachine ( func ( p * Machine ) bool {
if buf . Len ( ) > 0 {
_ , _ = buf . WriteRune ( ' ' )
}
_ , _ = buf . WriteString ( p . Name )
return false
} )
return buf . String ( )
}
func genEnvZoneCephMonIPs ( m Machines ) string {
var buf strings . Builder
m . ForEachMachine ( func ( p * Machine ) bool {
addr , _ := RingOneAddress ( p . Zone ( ) , p . ID )
if buf . Len ( ) > 0 {
_ , _ = buf . WriteRune ( ' ' )
}
_ , _ = buf . WriteString ( addr . String ( ) )
return false
} )
return buf . String ( )
}
func genEnvZoneCephMonIDs ( m Machines ) string {
var buf strings . Builder
m . ForEachMachine ( func ( p * Machine ) bool {
if buf . Len ( ) > 0 {
_ , _ = buf . WriteRune ( ' ' )
}
_ , _ = fmt . Fprintf ( & buf , "%v" , p . ID )
return false
} )
return buf . String ( )
}