zones: introduce Zones.CephFSID and Zones.GetCephFSID()
the accessor doesn't generate one if needed yet Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -8,6 +8,7 @@ require (
|
||||
darvaza.org/sidecar v0.0.2
|
||||
darvaza.org/slog v0.5.3
|
||||
github.com/burntSushi/toml v0.3.1
|
||||
github.com/gofrs/uuid/v5 v5.0.0
|
||||
github.com/hack-pad/hackpadfs v0.2.1
|
||||
github.com/mgechev/revive v1.3.3
|
||||
github.com/spf13/cobra v1.7.0
|
||||
|
||||
@@ -26,6 +26,8 @@ github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBD
|
||||
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
||||
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M=
|
||||
github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
|
||||
github.com/hack-pad/hackpadfs v0.2.1 h1:FelFhIhv26gyjujoA/yeFO+6YGlqzmc9la/6iKMIxMw=
|
||||
github.com/hack-pad/hackpadfs v0.2.1/go.mod h1:khQBuCEwGXWakkmq8ZiFUvUZz84ZkJ2KNwKvChs4OrU=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package zones
|
||||
|
||||
import (
|
||||
"darvaza.org/core"
|
||||
"github.com/gofrs/uuid/v5"
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"sort"
|
||||
|
||||
"darvaza.org/resolver"
|
||||
"github.com/gofrs/uuid/v5"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -135,15 +136,21 @@ func (z *Zone) GatewayIDs() ([]int, int) {
|
||||
return out, len(out)
|
||||
}
|
||||
|
||||
// revive:disable:line-length-limit
|
||||
|
||||
// Zones represents all zones in a cluster
|
||||
type Zones struct {
|
||||
dir fs.FS
|
||||
resolver resolver.Resolver
|
||||
domain string
|
||||
|
||||
CephFSID uuid.UUID `toml:"ceph_fsid,omitempty" json:"ceph_fsid,omitempty" yaml:"ceph_fsid,omitempty"`
|
||||
|
||||
Zones []*Zone `toml:"zones"`
|
||||
}
|
||||
|
||||
// revive:enable:line-length-limit
|
||||
|
||||
// ForEachMachine calls a function for each Machine in the cluster
|
||||
// until instructed to terminate the loop
|
||||
func (m *Zones) ForEachMachine(fn func(*Machine) bool) {
|
||||
|
||||
Reference in New Issue
Block a user