diff --git a/ipam/allocator.go b/ipam/allocator.go index 93c81f21..20c78bd5 100644 --- a/ipam/allocator.go +++ b/ipam/allocator.go @@ -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") } } diff --git a/ipam/paxos/paxos.go b/ipam/paxos/paxos.go index 6d157060..fe10775b 100644 --- a/ipam/paxos/paxos.go +++ b/ipam/paxos/paxos.go @@ -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} } diff --git a/ipam/status.go b/ipam/status.go index c826b9b1..a65de527 100644 --- a/ipam/status.go +++ b/ipam/status.go @@ -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} } } diff --git a/prog/weaver/http.go b/prog/weaver/http.go index 57945539..cf9254ac 100644 --- a/prog/weaver/http.go +++ b/prog/weaver/http.go @@ -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}}\