Signed-off-by: Alessandro Boch <aboch@docker.com>
| ... | ... |
@@ -3,6 +3,7 @@ package ipam |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"net" |
| 6 |
+ "sort" |
|
| 6 | 7 |
"sync" |
| 7 | 8 |
|
| 8 | 9 |
log "github.com/Sirupsen/logrus" |
| ... | ... |
@@ -554,13 +555,18 @@ func (a *Allocator) getAddress(nw *net.IPNet, bitmask *bitseq.Handle, prefAddres |
| 554 | 554 |
func (a *Allocator) DumpDatabase() string {
|
| 555 | 555 |
a.Lock() |
| 556 | 556 |
aspaces := make(map[string]*addrSpace, len(a.addrSpaces)) |
| 557 |
+ orderedAS := make([]string, 0, len(a.addrSpaces)) |
|
| 557 | 558 |
for as, aSpace := range a.addrSpaces {
|
| 559 |
+ orderedAS = append(orderedAS, as) |
|
| 558 | 560 |
aspaces[as] = aSpace |
| 559 | 561 |
} |
| 560 | 562 |
a.Unlock() |
| 561 | 563 |
|
| 564 |
+ sort.Strings(orderedAS) |
|
| 565 |
+ |
|
| 562 | 566 |
var s string |
| 563 |
- for as, aSpace := range aspaces {
|
|
| 567 |
+ for _, as := range orderedAS {
|
|
| 568 |
+ aSpace := aspaces[as] |
|
| 564 | 569 |
s = fmt.Sprintf("\n\n%s Config", as)
|
| 565 | 570 |
aSpace.Lock() |
| 566 | 571 |
for k, config := range aSpace.subnets {
|