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 {
|
if len(alloc.seed) != 0 {
|
||||||
alloc.infof("Initialising with supplied IPAM seed")
|
alloc.infof("Initialising with supplied IPAM seed")
|
||||||
alloc.createRing(alloc.seed)
|
alloc.createRing(alloc.seed)
|
||||||
} else {
|
} else if alloc.paxos.IsElector() {
|
||||||
alloc.infof("Initialising via deferred consensus")
|
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 {
|
type Status struct {
|
||||||
|
Elector bool
|
||||||
KnownNodes int
|
KnownNodes int
|
||||||
Quorum uint
|
Quorum uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStatus(node *Node) *Status {
|
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 {
|
if node, ok := allocator.paxos.(*paxos.Node); ok {
|
||||||
paxosStatus = paxos.NewStatus(node)
|
paxosStatus = paxos.NewStatus(node)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
paxosStatus = &paxos.Status{Elector: false}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,11 @@ var statusTemplate = defTemplate("status", `\
|
|||||||
Status: ready
|
Status: ready
|
||||||
{{end}}\
|
{{end}}\
|
||||||
{{else if .IPAM.Paxos}}\
|
{{else if .IPAM.Paxos}}\
|
||||||
|
{{if .IPAM.Paxos.Elector}}\
|
||||||
Status: awaiting consensus (quorum: {{.IPAM.Paxos.Quorum}}, known: {{.IPAM.Paxos.KnownNodes}})
|
Status: awaiting consensus (quorum: {{.IPAM.Paxos.Quorum}}, known: {{.IPAM.Paxos.KnownNodes}})
|
||||||
|
{{else}}\
|
||||||
|
Status: awaiting consensus (observer)
|
||||||
|
{{end}}\
|
||||||
{{else}}\
|
{{else}}\
|
||||||
Status: idle
|
Status: idle
|
||||||
{{end}}\
|
{{end}}\
|
||||||
|
|||||||
Reference in new issue
Block a user