61a7c8ca99
Signed-off-by: Alejandro Mery <amery@jpi.io>
31 lines
560 B
Go
31 lines
560 B
Go
package zones
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"darvaza.org/core"
|
|
"github.com/gofrs/uuid/v5"
|
|
|
|
"git.jpi.io/amery/jpictl/pkg/ceph"
|
|
)
|
|
|
|
// GetCephFSID returns our Ceph's FSID
|
|
func (m *Zones) GetCephFSID() (uuid.UUID, error) {
|
|
if core.IsZero(m.CephFSID) {
|
|
// TODO: generate one
|
|
return uuid.Nil, nil
|
|
}
|
|
return m.CephFSID, nil
|
|
}
|
|
|
|
// GetCephConfig reads the ceph.conf file
|
|
func (m *Zones) GetCephConfig() (*ceph.Config, error) {
|
|
data, err := m.ReadFile("ceph.conf")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
r := bytes.NewReader(data)
|
|
return ceph.NewConfigFromReader(r)
|
|
}
|