ceph: zones.Zones.WriteCephConfig() and ceph.Config.WriteTo() [WIP]

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-09-04 19:45:04 +00:00
parent 1150fbb7ef
commit 7035facf7b
2 changed files with 20 additions and 0 deletions
+8
View File
@@ -1,6 +1,7 @@
package ceph
import (
"bytes"
"io"
"net/netip"
@@ -14,6 +15,13 @@ type Config struct {
Global GlobalConfig `ini:"global"`
}
// WriteTo writes a Wireguard [Config] onto the provided [io.Writer]
func (*Config) WriteTo(w io.Writer) (int64, error) {
var buf bytes.Buffer
return buf.WriteTo(w)
}
// GlobalConfig represents the [global] section of a ceph.conf file
type GlobalConfig struct {
FSID uuid.UUID `ini:"fsid"`
+12
View File
@@ -18,6 +18,18 @@ func (m *Zones) GetCephConfig() (*ceph.Config, error) {
return ceph.NewConfigFromReader(r)
}
// WriteCephConfig writes the ceph.conf file
func (m *Zones) WriteCephConfig(cfg *ceph.Config) error {
f, err := m.CreateTruncFile("ceph.conf")
if err != nil {
return err
}
defer f.Close()
_, err = cfg.WriteTo(f)
return err
}
// GetCephMonitors returns the set of Ceph monitors on
// the zone
func (z *Zone) GetCephMonitors() Machines {