Merge pull request #696 from bboreham/692-ipam-status
Document ipam additions to `weave status` Closes #692.
This commit is contained in:
commit
9f85cbc07d
4 files changed
+47
-11
No files matched your search
+8
-8
@@ -456,7 +456,7 @@ func (alloc *Allocator) actorLoop(actionChan <-chan func()) {
|
|||||||
|
|
||||||
func (alloc *Allocator) string() string {
|
func (alloc *Allocator) string() string {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
fmt.Fprintf(&buf, "Allocator subnet %s+%d\n", alloc.subnetStart.String(), alloc.subnetSize)
|
fmt.Fprintf(&buf, "Allocator subnet %s/%d\n", alloc.subnetStart.String(), alloc.prefixLen)
|
||||||
|
|
||||||
if alloc.ring.Empty() {
|
if alloc.ring.Empty() {
|
||||||
fmt.Fprintf(&buf, "Paxos: %s", alloc.paxos.String())
|
fmt.Fprintf(&buf, "Paxos: %s", alloc.paxos.String())
|
||||||
@@ -467,16 +467,16 @@ func (alloc *Allocator) string() string {
|
|||||||
fmt.Fprintf(&buf, " Free IPs: ~%.1f%%, %d local, ~%d remote\n",
|
fmt.Fprintf(&buf, " Free IPs: ~%.1f%%, %d local, ~%d remote\n",
|
||||||
percentFree, localFreeSpace, remoteFreeSpace)
|
percentFree, localFreeSpace, remoteFreeSpace)
|
||||||
|
|
||||||
|
fmt.Fprint(&buf, "Owned Ranges:")
|
||||||
alloc.ring.FprintWithNicknames(&buf, alloc.nicknames)
|
alloc.ring.FprintWithNicknames(&buf, alloc.nicknames)
|
||||||
fmt.Fprintf(&buf, alloc.space.String())
|
|
||||||
if len(alloc.pendingAllocates)+len(alloc.pendingClaims) > 0 {
|
if len(alloc.pendingAllocates)+len(alloc.pendingClaims) > 0 {
|
||||||
fmt.Fprintf(&buf, "\nPending requests for ")
|
fmt.Fprintf(&buf, "\nPending requests for ")
|
||||||
}
|
for _, op := range alloc.pendingAllocates {
|
||||||
for _, op := range alloc.pendingAllocates {
|
fmt.Fprintf(&buf, "%s, ", op.String())
|
||||||
fmt.Fprintf(&buf, "%s, ", op.String())
|
}
|
||||||
}
|
for _, op := range alloc.pendingClaims {
|
||||||
for _, op := range alloc.pendingClaims {
|
fmt.Fprintf(&buf, "%s, ", op.String())
|
||||||
fmt.Fprintf(&buf, "%s, ", op.String())
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf.String()
|
return buf.String()
|
||||||
|
|||||||
+3
-3
@@ -347,20 +347,20 @@ func (r *Ring) ClaimItAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Ring) FprintWithNicknames(w io.Writer, m map[router.PeerName]string) {
|
func (r *Ring) FprintWithNicknames(w io.Writer, m map[router.PeerName]string) {
|
||||||
fmt.Fprintf(w, "Ring [%s, %s)\n", r.Start, r.End)
|
|
||||||
for _, entry := range r.Entries {
|
for _, entry := range r.Entries {
|
||||||
nickname, found := m[entry.Peer]
|
nickname, found := m[entry.Peer]
|
||||||
if found {
|
if found {
|
||||||
nickname = fmt.Sprintf(" (%s)", nickname)
|
nickname = fmt.Sprintf(" (%s)", nickname)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(w, " %s -> %s%s (version: %d, free: %d)\n", entry.Token,
|
fmt.Fprintf(w, "\n %s -> %s%s (v%d)", entry.Token,
|
||||||
entry.Peer, nickname, entry.Version, entry.Free)
|
entry.Peer, nickname, entry.Version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Ring) String() string {
|
func (r *Ring) String() string {
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
|
fmt.Fprintf(&buffer, "Ring [%s, %s)", r.Start, r.End)
|
||||||
r.FprintWithNicknames(&buffer, make(map[router.PeerName]string))
|
r.FprintWithNicknames(&buffer, make(map[router.PeerName]string))
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,3 +115,35 @@ brackets, like this:
|
|||||||
So, in our example, we could equivalently do:
|
So, in our example, we could equivalently do:
|
||||||
|
|
||||||
host1$ weave rmpeer ea:6c:21:09:cf:f0
|
host1$ weave rmpeer ea:6c:21:09:cf:f0
|
||||||
|
|
||||||
|
## <a name="troubleshooting"></a>Troubleshooting
|
||||||
|
|
||||||
|
The command
|
||||||
|
|
||||||
|
weave status
|
||||||
|
|
||||||
|
reports on the current status of the weave router and IP allocator:
|
||||||
|
|
||||||
|
````
|
||||||
|
weave router git-8f675f15c0b5
|
||||||
|
...
|
||||||
|
Allocator subnet 10.2.1.0/24
|
||||||
|
Free IPs: ~98.0%, 62 local, ~189 remote
|
||||||
|
Owned Ranges:
|
||||||
|
10.2.1.1 -> 96:e9:e2:2e:2d:bc (host1) (v3)
|
||||||
|
10.2.1.128 -> ea:84:25:9b:31:2e (host2) (v3)
|
||||||
|
10.2.1.192 -> ea:6c:21:09:cf:f0 (host3) (v9)
|
||||||
|
````
|
||||||
|
|
||||||
|
The first section covers the router; see the [troubleshooting
|
||||||
|
guide](troubleshooting.html#status-report) for full details.
|
||||||
|
|
||||||
|
The 'Allocator' section, which is only present if weave has been
|
||||||
|
started with the `-iprange` option, summarises the overall position and
|
||||||
|
lists which address ranges have been assigned to which peer. Each
|
||||||
|
range begins at the address shown and ends just before the next
|
||||||
|
address, or wraps around at the end of the subnet. The 'v' number
|
||||||
|
denotes how many times that entry has been updated.
|
||||||
|
|
||||||
|
The 'Free IPs' information may be out of date with respect to changes
|
||||||
|
happening elsewhere in the network.
|
||||||
@@ -126,6 +126,10 @@ not currently connected to. Each line contains some information about
|
|||||||
what went wrong the last time; whether it is attempting to connect or
|
what went wrong the last time; whether it is attempting to connect or
|
||||||
is waiting for a while before connecting again.
|
is waiting for a while before connecting again.
|
||||||
|
|
||||||
|
There may also be further sections for
|
||||||
|
[IP allocator](ipam.html#troubleshooting) and
|
||||||
|
[weaveDNS](weavedns.html#troubleshooting).
|
||||||
|
|
||||||
### <a name="list-attached-containers"></a>List attached containers
|
### <a name="list-attached-containers"></a>List attached containers
|
||||||
|
|
||||||
weave ps
|
weave ps
|
||||||
|
|||||||
Reference in new issue
Block a user