Better log and status messages for Paxos observer
This commit is contained in:
1 parent
0c59de40e7
commit
c12a52d20e
4 files changed
+11
-2
No files matched your search
+3
-1
@@ -887,8 +887,10 @@ func (alloc *Allocator) loadPersistedData() {
|
||||
if len(alloc.seed) != 0 {
|
||||
alloc.infof("Initialising with supplied IPAM seed")
|
||||
alloc.createRing(alloc.seed)
|
||||
} else {
|
||||
} else if alloc.paxos.IsElector() {
|
||||
alloc.infof("Initialising via deferred consensus")
|
||||
} else {
|
||||
alloc.infof("Initialising as observer - awaiting IPAM data from another peer")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -262,10 +262,11 @@ func (node *Node) IsElector() bool {
|
||||
}
|
||||
|
||||
type Status struct {
|
||||
Elector bool
|
||||
KnownNodes int
|
||||
Quorum uint
|
||||
}
|
||||
|
||||
func NewStatus(node *Node) *Status {
|
||||
return &Status{len(node.knows), node.quorum}
|
||||
return &Status{true, len(node.knows), node.quorum}
|
||||
}
|
||||
@@ -41,6 +41,8 @@ func NewStatus(allocator *Allocator, defaultSubnet address.CIDR) *Status {
|
||||
if node, ok := allocator.paxos.(*paxos.Node); ok {
|
||||
paxosStatus = paxos.NewStatus(node)
|
||||
}
|
||||
} else {
|
||||
paxosStatus = &paxos.Status{Elector: false}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,11 @@ var statusTemplate = defTemplate("status", `\
|
||||
Status: ready
|
||||
{{end}}\
|
||||
{{else if .IPAM.Paxos}}\
|
||||
{{if .IPAM.Paxos.Elector}}\
|
||||
Status: awaiting consensus (quorum: {{.IPAM.Paxos.Quorum}}, known: {{.IPAM.Paxos.KnownNodes}})
|
||||
{{else}}\
|
||||
Status: awaiting consensus (observer)
|
||||
{{end}}\
|
||||
{{else}}\
|
||||
Status: idle
|
||||
{{end}}\
|
||||
|
||||
Reference in new issue
Block a user