1
0
Fork 0
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:
Jana Radhakrishnan 2016-04-18 14:32:23 -07:00
commit 6522930d90

View file

@ -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 {