mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1123 from aboch/ft
Make o/p of ipam DumpDatabase() consistent
This commit is contained in:
commit
6522930d90
1 changed files with 7 additions and 1 deletions
|
@ -3,6 +3,7 @@ package ipam
|
|||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
@ -554,13 +555,18 @@ func (a *Allocator) getAddress(nw *net.IPNet, bitmask *bitseq.Handle, prefAddres
|
|||
func (a *Allocator) DumpDatabase() string {
|
||||
a.Lock()
|
||||
aspaces := make(map[string]*addrSpace, len(a.addrSpaces))
|
||||
orderedAS := make([]string, 0, len(a.addrSpaces))
|
||||
for as, aSpace := range a.addrSpaces {
|
||||
orderedAS = append(orderedAS, as)
|
||||
aspaces[as] = aSpace
|
||||
}
|
||||
a.Unlock()
|
||||
|
||||
sort.Strings(orderedAS)
|
||||
|
||||
var s string
|
||||
for as, aSpace := range aspaces {
|
||||
for _, as := range orderedAS {
|
||||
aSpace := aspaces[as]
|
||||
s = fmt.Sprintf("\n\n%s Config", as)
|
||||
aSpace.Lock()
|
||||
for k, config := range aSpace.subnets {
|
||||
|
|
Loading…
Reference in a new issue