Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
| ... | ... |
@@ -27,7 +27,7 @@ github.com/imdario/mergo 0.2.1 |
| 27 | 27 |
golang.org/x/sync de49d9dcd27d4f764488181bea099dfe6179bcf0 |
| 28 | 28 |
|
| 29 | 29 |
#get libnetwork packages |
| 30 |
-github.com/docker/libnetwork 248fd5ea6a67f8810da322e6e7441e8de96a9045 https://github.com/dmcgowan/libnetwork.git |
|
| 30 |
+github.com/docker/libnetwork 24bb72a8dcfe0b58958414890c8f4138b644b96a |
|
| 31 | 31 |
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 |
| 32 | 32 |
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80 |
| 33 | 33 |
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec |
| ... | ... |
@@ -741,11 +741,12 @@ func (n *network) addDriverWatches() {
|
| 741 | 741 |
return |
| 742 | 742 |
} |
| 743 | 743 |
|
| 744 |
- agent.networkDB.WalkTable(table.name, func(nid, key string, value []byte) bool {
|
|
| 745 |
- if nid == n.ID() {
|
|
| 744 |
+ agent.networkDB.WalkTable(table.name, func(nid, key string, value []byte, deleted bool) bool {
|
|
| 745 |
+ // skip the entries that are mark for deletion, this is safe because this function is |
|
| 746 |
+ // called at initialization time so there is no state to delete |
|
| 747 |
+ if nid == n.ID() && !deleted {
|
|
| 746 | 748 |
d.EventNotify(driverapi.Create, nid, table.name, key, value) |
| 747 | 749 |
} |
| 748 |
- |
|
| 749 | 750 |
return false |
| 750 | 751 |
}) |
| 751 | 752 |
} |
| ... | ... |
@@ -497,7 +497,10 @@ func getFirstAvailable(head *sequence, start uint64) (uint64, uint64, error) {
|
| 497 | 497 |
// Derive the this sequence offsets |
| 498 | 498 |
byteOffset := byteStart - inBlockBytePos |
| 499 | 499 |
bitOffset := inBlockBytePos*8 + bitStart |
| 500 |
- |
|
| 500 |
+ var firstOffset uint64 |
|
| 501 |
+ if current == head {
|
|
| 502 |
+ firstOffset = byteOffset |
|
| 503 |
+ } |
|
| 501 | 504 |
for current != nil {
|
| 502 | 505 |
if current.block != blockMAX {
|
| 503 | 506 |
bytePos, bitPos, err := current.getAvailableBit(bitOffset) |
| ... | ... |
@@ -505,7 +508,8 @@ func getFirstAvailable(head *sequence, start uint64) (uint64, uint64, error) {
|
| 505 | 505 |
} |
| 506 | 506 |
// Moving to next block: Reset bit offset. |
| 507 | 507 |
bitOffset = 0 |
| 508 |
- byteOffset += current.count * blockBytes |
|
| 508 |
+ byteOffset += (current.count * blockBytes) - firstOffset |
|
| 509 |
+ firstOffset = 0 |
|
| 509 | 510 |
current = current.next |
| 510 | 511 |
} |
| 511 | 512 |
return invalidPos, invalidPos, ErrNoBitAvailable |
| 512 | 513 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 0 |
+package common |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "runtime" |
|
| 4 |
+ "strings" |
|
| 5 |
+) |
|
| 6 |
+ |
|
| 7 |
+func callerInfo(i int) string {
|
|
| 8 |
+ ptr, _, _, ok := runtime.Caller(i) |
|
| 9 |
+ fName := "unknown" |
|
| 10 |
+ if ok {
|
|
| 11 |
+ f := runtime.FuncForPC(ptr) |
|
| 12 |
+ if f != nil {
|
|
| 13 |
+ // f.Name() is like: github.com/docker/libnetwork/common.MethodName |
|
| 14 |
+ tmp := strings.Split(f.Name(), ".") |
|
| 15 |
+ if len(tmp) > 0 {
|
|
| 16 |
+ fName = tmp[len(tmp)-1] |
|
| 17 |
+ } |
|
| 18 |
+ } |
|
| 19 |
+ } |
|
| 20 |
+ |
|
| 21 |
+ return fName |
|
| 22 |
+} |
|
| 23 |
+ |
|
| 24 |
+// CallerName returns the name of the function at the specified level |
|
| 25 |
+// level == 0 means current method name |
|
| 26 |
+func CallerName(level int) string {
|
|
| 27 |
+ return callerInfo(2 + level) |
|
| 28 |
+} |
| 0 | 29 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,133 @@ |
| 0 |
+package diagnose |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "fmt" |
|
| 4 |
+ "net" |
|
| 5 |
+ "net/http" |
|
| 6 |
+ "sync" |
|
| 7 |
+ |
|
| 8 |
+ "github.com/sirupsen/logrus" |
|
| 9 |
+) |
|
| 10 |
+ |
|
| 11 |
+// HTTPHandlerFunc TODO |
|
| 12 |
+type HTTPHandlerFunc func(interface{}, http.ResponseWriter, *http.Request)
|
|
| 13 |
+ |
|
| 14 |
+type httpHandlerCustom struct {
|
|
| 15 |
+ ctx interface{}
|
|
| 16 |
+ F func(interface{}, http.ResponseWriter, *http.Request)
|
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+// ServeHTTP TODO |
|
| 20 |
+func (h httpHandlerCustom) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
| 21 |
+ h.F(h.ctx, w, r) |
|
| 22 |
+} |
|
| 23 |
+ |
|
| 24 |
+var diagPaths2Func = map[string]HTTPHandlerFunc{
|
|
| 25 |
+ "/": notImplemented, |
|
| 26 |
+ "/help": help, |
|
| 27 |
+ "/ready": ready, |
|
| 28 |
+} |
|
| 29 |
+ |
|
| 30 |
+// Server when the debug is enabled exposes a |
|
| 31 |
+// This data structure is protected by the Agent mutex so does not require and additional mutex here |
|
| 32 |
+type Server struct {
|
|
| 33 |
+ sk net.Listener |
|
| 34 |
+ port int |
|
| 35 |
+ mux *http.ServeMux |
|
| 36 |
+ registeredHanders []string |
|
| 37 |
+ sync.Mutex |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+// Init TODO |
|
| 41 |
+func (n *Server) Init() {
|
|
| 42 |
+ n.mux = http.NewServeMux() |
|
| 43 |
+ |
|
| 44 |
+ // Register local handlers |
|
| 45 |
+ n.RegisterHandler(n, diagPaths2Func) |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+// RegisterHandler TODO |
|
| 49 |
+func (n *Server) RegisterHandler(ctx interface{}, hdlrs map[string]HTTPHandlerFunc) {
|
|
| 50 |
+ n.Lock() |
|
| 51 |
+ defer n.Unlock() |
|
| 52 |
+ for path, fun := range hdlrs {
|
|
| 53 |
+ n.mux.Handle(path, httpHandlerCustom{ctx, fun})
|
|
| 54 |
+ n.registeredHanders = append(n.registeredHanders, path) |
|
| 55 |
+ } |
|
| 56 |
+} |
|
| 57 |
+ |
|
| 58 |
+// EnableDebug opens a TCP socket to debug the passed network DB |
|
| 59 |
+func (n *Server) EnableDebug(ip string, port int) {
|
|
| 60 |
+ n.Lock() |
|
| 61 |
+ defer n.Unlock() |
|
| 62 |
+ |
|
| 63 |
+ n.port = port |
|
| 64 |
+ logrus.SetLevel(logrus.DebugLevel) |
|
| 65 |
+ |
|
| 66 |
+ if n.sk != nil {
|
|
| 67 |
+ logrus.Infof("The server is already up and running")
|
|
| 68 |
+ return |
|
| 69 |
+ } |
|
| 70 |
+ |
|
| 71 |
+ logrus.Infof("Starting the server listening on %d for commands", port)
|
|
| 72 |
+ |
|
| 73 |
+ // // Create the socket |
|
| 74 |
+ // var err error |
|
| 75 |
+ // n.sk, err = net.Listen("tcp", listeningAddr)
|
|
| 76 |
+ // if err != nil {
|
|
| 77 |
+ // log.Fatal(err) |
|
| 78 |
+ // } |
|
| 79 |
+ // |
|
| 80 |
+ // go func() {
|
|
| 81 |
+ // http.Serve(n.sk, n.mux) |
|
| 82 |
+ // }() |
|
| 83 |
+ http.ListenAndServe(":8000", n.mux)
|
|
| 84 |
+} |
|
| 85 |
+ |
|
| 86 |
+// DisableDebug stop the dubug and closes the tcp socket |
|
| 87 |
+func (n *Server) DisableDebug() {
|
|
| 88 |
+ n.Lock() |
|
| 89 |
+ defer n.Unlock() |
|
| 90 |
+ n.sk.Close() |
|
| 91 |
+ n.sk = nil |
|
| 92 |
+} |
|
| 93 |
+ |
|
| 94 |
+// IsDebugEnable returns true when the debug is enabled |
|
| 95 |
+func (n *Server) IsDebugEnable() bool {
|
|
| 96 |
+ n.Lock() |
|
| 97 |
+ defer n.Unlock() |
|
| 98 |
+ return n.sk != nil |
|
| 99 |
+} |
|
| 100 |
+ |
|
| 101 |
+func notImplemented(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 102 |
+ fmt.Fprintf(w, "URL path: %s no method implemented check /help\n", r.URL.Path) |
|
| 103 |
+} |
|
| 104 |
+ |
|
| 105 |
+func help(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 106 |
+ n, ok := ctx.(*Server) |
|
| 107 |
+ if ok {
|
|
| 108 |
+ for _, path := range n.registeredHanders {
|
|
| 109 |
+ fmt.Fprintf(w, "%s\n", path) |
|
| 110 |
+ } |
|
| 111 |
+ } |
|
| 112 |
+} |
|
| 113 |
+ |
|
| 114 |
+func ready(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 115 |
+ fmt.Fprintf(w, "OK\n") |
|
| 116 |
+} |
|
| 117 |
+ |
|
| 118 |
+// DebugHTTPForm TODO |
|
| 119 |
+func DebugHTTPForm(r *http.Request) {
|
|
| 120 |
+ r.ParseForm() |
|
| 121 |
+ for k, v := range r.Form {
|
|
| 122 |
+ logrus.Debugf("Form[%q] = %q\n", k, v)
|
|
| 123 |
+ } |
|
| 124 |
+} |
|
| 125 |
+ |
|
| 126 |
+// HTTPReplyError TODO |
|
| 127 |
+func HTTPReplyError(w http.ResponseWriter, message, usage string) {
|
|
| 128 |
+ fmt.Fprintf(w, "%s\n", message) |
|
| 129 |
+ if usage != "" {
|
|
| 130 |
+ fmt.Fprintf(w, "Usage: %s\n", usage) |
|
| 131 |
+ } |
|
| 132 |
+} |
| ... | ... |
@@ -120,8 +120,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 120 | 120 |
} |
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 |
- d.peerDbAdd(nid, eid, ep.addr.IP, ep.addr.Mask, ep.mac, |
|
| 124 |
- net.ParseIP(d.advertiseAddress), true) |
|
| 123 |
+ d.peerAdd(nid, eid, ep.addr.IP, ep.addr.Mask, ep.mac, net.ParseIP(d.advertiseAddress), true, false, false, true) |
|
| 125 | 124 |
|
| 126 | 125 |
if err := d.checkEncryption(nid, nil, n.vxlanID(s), true, true); err != nil {
|
| 127 | 126 |
logrus.Warn(err) |
| ... | ... |
@@ -205,7 +204,7 @@ func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key stri |
| 205 | 205 |
return |
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 |
- d.peerAdd(nid, eid, addr.IP, addr.Mask, mac, vtep, true, false, false) |
|
| 208 |
+ d.peerAdd(nid, eid, addr.IP, addr.Mask, mac, vtep, true, false, false, false) |
|
| 209 | 209 |
} |
| 210 | 210 |
|
| 211 | 211 |
// Leave method is invoked when a Sandbox detaches from an endpoint. |
| ... | ... |
@@ -683,10 +683,12 @@ func (n *network) initSandbox(restore bool) error {
|
| 683 | 683 |
return fmt.Errorf("could not get network sandbox (oper %t): %v", restore, err)
|
| 684 | 684 |
} |
| 685 | 685 |
|
| 686 |
+ // this is needed to let the peerAdd configure the sandbox |
|
| 686 | 687 |
n.setSandbox(sbox) |
| 687 | 688 |
|
| 688 | 689 |
if !restore {
|
| 689 |
- n.driver.peerDbUpdateSandbox(n.id) |
|
| 690 |
+ // Initialize the sandbox with all the peers previously received from networkdb |
|
| 691 |
+ n.driver.initSandboxPeerDB(n.id) |
|
| 690 | 692 |
} |
| 691 | 693 |
|
| 692 | 694 |
var nlSock *nl.NetlinkSocket |
| ... | ... |
@@ -765,10 +767,7 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket) {
|
| 765 | 765 |
logrus.Errorf("could not resolve peer %q: %v", ip, err)
|
| 766 | 766 |
continue |
| 767 | 767 |
} |
| 768 |
- |
|
| 769 |
- if err := n.driver.peerAdd(n.id, "dummy", ip, IPmask, mac, vtep, true, l2Miss, l3Miss); err != nil {
|
|
| 770 |
- logrus.Errorf("could not add neighbor entry for missed peer %q: %v", ip, err)
|
|
| 771 |
- } |
|
| 768 |
+ n.driver.peerAdd(n.id, "dummy", ip, IPmask, mac, vtep, true, l2Miss, l3Miss, false) |
|
| 772 | 769 |
} else {
|
| 773 | 770 |
// If the gc_thresh values are lower kernel might knock off the neighor entries. |
| 774 | 771 |
// When we get a L3 miss check if its a valid peer and reprogram the neighbor |
| ... | ... |
@@ -120,15 +120,10 @@ func (d *driver) processEvent(u serf.UserEvent) {
|
| 120 | 120 |
|
| 121 | 121 |
switch action {
|
| 122 | 122 |
case "join": |
| 123 |
- if err := d.peerAdd(nid, eid, net.ParseIP(ipStr), net.IPMask(net.ParseIP(maskStr).To4()), mac, |
|
| 124 |
- net.ParseIP(vtepStr), true, false, false); err != nil {
|
|
| 125 |
- logrus.Errorf("Peer add failed in the driver: %v\n", err)
|
|
| 126 |
- } |
|
| 123 |
+ d.peerAdd(nid, eid, net.ParseIP(ipStr), net.IPMask(net.ParseIP(maskStr).To4()), mac, net.ParseIP(vtepStr), |
|
| 124 |
+ true, false, false, false) |
|
| 127 | 125 |
case "leave": |
| 128 |
- if err := d.peerDelete(nid, eid, net.ParseIP(ipStr), net.IPMask(net.ParseIP(maskStr).To4()), mac, |
|
| 129 |
- net.ParseIP(vtepStr), true); err != nil {
|
|
| 130 |
- logrus.Errorf("Peer delete failed in the driver: %v\n", err)
|
|
| 131 |
- } |
|
| 126 |
+ d.peerDelete(nid, eid, net.ParseIP(ipStr), net.IPMask(net.ParseIP(maskStr).To4()), mac, net.ParseIP(vtepStr), true) |
|
| 132 | 127 |
} |
| 133 | 128 |
} |
| 134 | 129 |
|
| ... | ... |
@@ -3,6 +3,7 @@ package overlay |
| 3 | 3 |
//go:generate protoc -I.:../../Godeps/_workspace/src/github.com/gogo/protobuf --gogo_out=import_path=github.com/docker/libnetwork/drivers/overlay,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto:. overlay.proto |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
+ "context" |
|
| 6 | 7 |
"fmt" |
| 7 | 8 |
"net" |
| 8 | 9 |
"sync" |
| ... | ... |
@@ -50,6 +51,8 @@ type driver struct {
|
| 50 | 50 |
joinOnce sync.Once |
| 51 | 51 |
localJoinOnce sync.Once |
| 52 | 52 |
keys []*key |
| 53 |
+ peerOpCh chan *peerOperation |
|
| 54 |
+ peerOpCancel context.CancelFunc |
|
| 53 | 55 |
sync.Mutex |
| 54 | 56 |
} |
| 55 | 57 |
|
| ... | ... |
@@ -64,10 +67,16 @@ func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
|
| 64 | 64 |
peerDb: peerNetworkMap{
|
| 65 | 65 |
mp: map[string]*peerMap{},
|
| 66 | 66 |
}, |
| 67 |
- secMap: &encrMap{nodes: map[string][]*spi{}},
|
|
| 68 |
- config: config, |
|
| 67 |
+ secMap: &encrMap{nodes: map[string][]*spi{}},
|
|
| 68 |
+ config: config, |
|
| 69 |
+ peerOpCh: make(chan *peerOperation), |
|
| 69 | 70 |
} |
| 70 | 71 |
|
| 72 |
+ // Launch the go routine for processing peer operations |
|
| 73 |
+ ctx, cancel := context.WithCancel(context.Background()) |
|
| 74 |
+ d.peerOpCancel = cancel |
|
| 75 |
+ go d.peerOpRoutine(ctx, d.peerOpCh) |
|
| 76 |
+ |
|
| 71 | 77 |
if data, ok := config[netlabel.GlobalKVClient]; ok {
|
| 72 | 78 |
var err error |
| 73 | 79 |
dsc, ok := data.(discoverapi.DatastoreConfigData) |
| ... | ... |
@@ -161,7 +170,7 @@ func (d *driver) restoreEndpoints() error {
|
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 | 163 |
n.incEndpointCount() |
| 164 |
- d.peerDbAdd(ep.nid, ep.id, ep.addr.IP, ep.addr.Mask, ep.mac, net.ParseIP(d.advertiseAddress), true) |
|
| 164 |
+ d.peerAdd(ep.nid, ep.id, ep.addr.IP, ep.addr.Mask, ep.mac, net.ParseIP(d.advertiseAddress), true, false, false, true) |
|
| 165 | 165 |
} |
| 166 | 166 |
return nil |
| 167 | 167 |
} |
| ... | ... |
@@ -170,6 +179,11 @@ func (d *driver) restoreEndpoints() error {
|
| 170 | 170 |
func Fini(drv driverapi.Driver) {
|
| 171 | 171 |
d := drv.(*driver) |
| 172 | 172 |
|
| 173 |
+ // Notify the peer go routine to return |
|
| 174 |
+ if d.peerOpCancel != nil {
|
|
| 175 |
+ d.peerOpCancel() |
|
| 176 |
+ } |
|
| 177 |
+ |
|
| 173 | 178 |
if d.exitCh != nil {
|
| 174 | 179 |
waitCh := make(chan struct{})
|
| 175 | 180 |
|
| ... | ... |
@@ -1,11 +1,13 @@ |
| 1 | 1 |
package overlay |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "context" |
|
| 4 | 5 |
"fmt" |
| 5 | 6 |
"net" |
| 6 | 7 |
"sync" |
| 7 | 8 |
"syscall" |
| 8 | 9 |
|
| 10 |
+ "github.com/docker/libnetwork/common" |
|
| 9 | 11 |
"github.com/sirupsen/logrus" |
| 10 | 12 |
) |
| 11 | 13 |
|
| ... | ... |
@@ -59,8 +61,6 @@ func (pKey *peerKey) Scan(state fmt.ScanState, verb rune) error {
|
| 59 | 59 |
return nil |
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 |
-var peerDbWg sync.WaitGroup |
|
| 63 |
- |
|
| 64 | 62 |
func (d *driver) peerDbWalk(f func(string, *peerKey, *peerEntry) bool) error {
|
| 65 | 63 |
d.peerDb.Lock() |
| 66 | 64 |
nids := []string{}
|
| ... | ... |
@@ -141,8 +141,6 @@ func (d *driver) peerDbSearch(nid string, peerIP net.IP) (net.HardwareAddr, net. |
| 141 | 141 |
func (d *driver) peerDbAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 142 | 142 |
peerMac net.HardwareAddr, vtep net.IP, isLocal bool) {
|
| 143 | 143 |
|
| 144 |
- peerDbWg.Wait() |
|
| 145 |
- |
|
| 146 | 144 |
d.peerDb.Lock() |
| 147 | 145 |
pMap, ok := d.peerDb.mp[nid] |
| 148 | 146 |
if !ok {
|
| ... | ... |
@@ -173,7 +171,6 @@ func (d *driver) peerDbAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask |
| 173 | 173 |
|
| 174 | 174 |
func (d *driver) peerDbDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 175 | 175 |
peerMac net.HardwareAddr, vtep net.IP) peerEntry {
|
| 176 |
- peerDbWg.Wait() |
|
| 177 | 176 |
|
| 178 | 177 |
d.peerDb.Lock() |
| 179 | 178 |
pMap, ok := d.peerDb.mp[nid] |
| ... | ... |
@@ -206,55 +203,109 @@ func (d *driver) peerDbDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPM |
| 206 | 206 |
return pEntry |
| 207 | 207 |
} |
| 208 | 208 |
|
| 209 |
-func (d *driver) peerDbUpdateSandbox(nid string) {
|
|
| 210 |
- d.peerDb.Lock() |
|
| 211 |
- pMap, ok := d.peerDb.mp[nid] |
|
| 212 |
- if !ok {
|
|
| 213 |
- d.peerDb.Unlock() |
|
| 214 |
- return |
|
| 215 |
- } |
|
| 216 |
- d.peerDb.Unlock() |
|
| 209 |
+// The overlay uses a lazy initialization approach, this means that when a network is created |
|
| 210 |
+// and the driver registered the overlay does not allocate resources till the moment that a |
|
| 211 |
+// sandbox is actually created. |
|
| 212 |
+// At the moment of this call, that happens when a sandbox is initialized, is possible that |
|
| 213 |
+// networkDB has already delivered some events of peers already available on remote nodes, |
|
| 214 |
+// these peers are saved into the peerDB and this function is used to properly configure |
|
| 215 |
+// the network sandbox with all those peers that got previously notified. |
|
| 216 |
+// Note also that this method sends a single message on the channel and the go routine on the |
|
| 217 |
+// other side, will atomically loop on the whole table of peers and will program their state |
|
| 218 |
+// in one single atomic operation. This is fundamental to guarantee consistency, and avoid that |
|
| 219 |
+// new peerAdd or peerDelete gets reordered during the sandbox init. |
|
| 220 |
+func (d *driver) initSandboxPeerDB(nid string) {
|
|
| 221 |
+ d.peerInit(nid) |
|
| 222 |
+} |
|
| 217 | 223 |
|
| 218 |
- peerDbWg.Add(1) |
|
| 224 |
+type peerOperationType int32 |
|
| 219 | 225 |
|
| 220 |
- var peerOps []func() |
|
| 221 |
- pMap.Lock() |
|
| 222 |
- for pKeyStr, pEntry := range pMap.mp {
|
|
| 223 |
- var pKey peerKey |
|
| 224 |
- if _, err := fmt.Sscan(pKeyStr, &pKey); err != nil {
|
|
| 225 |
- logrus.Errorf("peer key scan failed: %v", err)
|
|
| 226 |
- } |
|
| 226 |
+const ( |
|
| 227 |
+ peerOperationINIT peerOperationType = iota |
|
| 228 |
+ peerOperationADD |
|
| 229 |
+ peerOperationDELETE |
|
| 230 |
+) |
|
| 227 | 231 |
|
| 228 |
- if pEntry.isLocal {
|
|
| 229 |
- continue |
|
| 230 |
- } |
|
| 232 |
+type peerOperation struct {
|
|
| 233 |
+ opType peerOperationType |
|
| 234 |
+ networkID string |
|
| 235 |
+ endpointID string |
|
| 236 |
+ peerIP net.IP |
|
| 237 |
+ peerIPMask net.IPMask |
|
| 238 |
+ peerMac net.HardwareAddr |
|
| 239 |
+ vtepIP net.IP |
|
| 240 |
+ updateDB bool |
|
| 241 |
+ l2Miss bool |
|
| 242 |
+ l3Miss bool |
|
| 243 |
+ localPeer bool |
|
| 244 |
+ callerName string |
|
| 245 |
+} |
|
| 231 | 246 |
|
| 232 |
- // Go captures variables by reference. The pEntry could be |
|
| 233 |
- // pointing to the same memory location for every iteration. Make |
|
| 234 |
- // a copy of pEntry before capturing it in the following closure. |
|
| 235 |
- entry := pEntry |
|
| 236 |
- op := func() {
|
|
| 237 |
- if err := d.peerAdd(nid, entry.eid, pKey.peerIP, entry.peerIPMask, |
|
| 238 |
- pKey.peerMac, entry.vtep, |
|
| 239 |
- false, false, false); err != nil {
|
|
| 240 |
- logrus.Errorf("peerdbupdate in sandbox failed for ip %s and mac %s: %v",
|
|
| 241 |
- pKey.peerIP, pKey.peerMac, err) |
|
| 247 |
+func (d *driver) peerOpRoutine(ctx context.Context, ch chan *peerOperation) {
|
|
| 248 |
+ var err error |
|
| 249 |
+ for {
|
|
| 250 |
+ select {
|
|
| 251 |
+ case <-ctx.Done(): |
|
| 252 |
+ return |
|
| 253 |
+ case op := <-ch: |
|
| 254 |
+ switch op.opType {
|
|
| 255 |
+ case peerOperationINIT: |
|
| 256 |
+ err = d.peerInitOp(op.networkID) |
|
| 257 |
+ case peerOperationADD: |
|
| 258 |
+ err = d.peerAddOp(op.networkID, op.endpointID, op.peerIP, op.peerIPMask, op.peerMac, op.vtepIP, op.updateDB, op.l2Miss, op.l3Miss, op.localPeer) |
|
| 259 |
+ case peerOperationDELETE: |
|
| 260 |
+ err = d.peerDeleteOp(op.networkID, op.endpointID, op.peerIP, op.peerIPMask, op.peerMac, op.vtepIP, op.localPeer) |
|
| 261 |
+ } |
|
| 262 |
+ if err != nil {
|
|
| 263 |
+ logrus.Warnf("Peer operation failed:%s op:%v", err, op)
|
|
| 242 | 264 |
} |
| 243 | 265 |
} |
| 244 |
- |
|
| 245 |
- peerOps = append(peerOps, op) |
|
| 246 | 266 |
} |
| 247 |
- pMap.Unlock() |
|
| 267 |
+} |
|
| 248 | 268 |
|
| 249 |
- for _, op := range peerOps {
|
|
| 250 |
- op() |
|
| 269 |
+func (d *driver) peerInit(nid string) {
|
|
| 270 |
+ callerName := common.CallerName(1) |
|
| 271 |
+ d.peerOpCh <- &peerOperation{
|
|
| 272 |
+ opType: peerOperationINIT, |
|
| 273 |
+ networkID: nid, |
|
| 274 |
+ callerName: callerName, |
|
| 251 | 275 |
} |
| 276 |
+} |
|
| 277 |
+ |
|
| 278 |
+func (d *driver) peerInitOp(nid string) error {
|
|
| 279 |
+ return d.peerDbNetworkWalk(nid, func(pKey *peerKey, pEntry *peerEntry) bool {
|
|
| 280 |
+ // Local entries do not need to be added |
|
| 281 |
+ if pEntry.isLocal {
|
|
| 282 |
+ return false |
|
| 283 |
+ } |
|
| 252 | 284 |
|
| 253 |
- peerDbWg.Done() |
|
| 285 |
+ d.peerAddOp(nid, pEntry.eid, pKey.peerIP, pEntry.peerIPMask, pKey.peerMac, pEntry.vtep, false, false, false, false) |
|
| 286 |
+ // return false to loop on all entries |
|
| 287 |
+ return false |
|
| 288 |
+ }) |
|
| 254 | 289 |
} |
| 255 | 290 |
|
| 256 | 291 |
func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 257 |
- peerMac net.HardwareAddr, vtep net.IP, updateDb, l2Miss, l3Miss bool) error {
|
|
| 292 |
+ peerMac net.HardwareAddr, vtep net.IP, updateDb, l2Miss, l3Miss, localPeer bool) {
|
|
| 293 |
+ callerName := common.CallerName(1) |
|
| 294 |
+ d.peerOpCh <- &peerOperation{
|
|
| 295 |
+ opType: peerOperationADD, |
|
| 296 |
+ networkID: nid, |
|
| 297 |
+ endpointID: eid, |
|
| 298 |
+ peerIP: peerIP, |
|
| 299 |
+ peerIPMask: peerIPMask, |
|
| 300 |
+ peerMac: peerMac, |
|
| 301 |
+ vtepIP: vtep, |
|
| 302 |
+ updateDB: updateDb, |
|
| 303 |
+ l2Miss: l2Miss, |
|
| 304 |
+ l3Miss: l3Miss, |
|
| 305 |
+ localPeer: localPeer, |
|
| 306 |
+ callerName: callerName, |
|
| 307 |
+ } |
|
| 308 |
+} |
|
| 309 |
+ |
|
| 310 |
+func (d *driver) peerAddOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
|
| 311 |
+ peerMac net.HardwareAddr, vtep net.IP, updateDb, l2Miss, l3Miss, updateOnlyDB bool) error {
|
|
| 258 | 312 |
|
| 259 | 313 |
if err := validateID(nid, eid); err != nil {
|
| 260 | 314 |
return err |
| ... | ... |
@@ -262,6 +313,9 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 262 | 262 |
|
| 263 | 263 |
if updateDb {
|
| 264 | 264 |
d.peerDbAdd(nid, eid, peerIP, peerIPMask, peerMac, vtep, false) |
| 265 |
+ if updateOnlyDB {
|
|
| 266 |
+ return nil |
|
| 267 |
+ } |
|
| 265 | 268 |
} |
| 266 | 269 |
|
| 267 | 270 |
n := d.network(nid) |
| ... | ... |
@@ -271,6 +325,9 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 271 | 271 |
|
| 272 | 272 |
sbox := n.sandbox() |
| 273 | 273 |
if sbox == nil {
|
| 274 |
+ // We are hitting this case for all the events that are arriving before that the sandbox |
|
| 275 |
+ // is being created. The peer got already added into the database and the sanbox init will |
|
| 276 |
+ // call the peerDbUpdateSandbox that will configure all these peers from the database |
|
| 274 | 277 |
return nil |
| 275 | 278 |
} |
| 276 | 279 |
|
| ... | ... |
@@ -311,6 +368,22 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 311 | 311 |
} |
| 312 | 312 |
|
| 313 | 313 |
func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 314 |
+ peerMac net.HardwareAddr, vtep net.IP, updateDb bool) {
|
|
| 315 |
+ callerName := common.CallerName(1) |
|
| 316 |
+ d.peerOpCh <- &peerOperation{
|
|
| 317 |
+ opType: peerOperationDELETE, |
|
| 318 |
+ networkID: nid, |
|
| 319 |
+ endpointID: eid, |
|
| 320 |
+ peerIP: peerIP, |
|
| 321 |
+ peerIPMask: peerIPMask, |
|
| 322 |
+ peerMac: peerMac, |
|
| 323 |
+ vtepIP: vtep, |
|
| 324 |
+ updateDB: updateDb, |
|
| 325 |
+ callerName: callerName, |
|
| 326 |
+ } |
|
| 327 |
+} |
|
| 328 |
+ |
|
| 329 |
+func (d *driver) peerDeleteOp(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
|
| 314 | 330 |
peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
|
| 315 | 331 |
|
| 316 | 332 |
if err := validateID(nid, eid); err != nil {
|
| ... | ... |
@@ -413,7 +413,7 @@ func (epj *endpointJoinInfo) UnmarshalJSON(b []byte) error {
|
| 413 | 413 |
return err |
| 414 | 414 |
} |
| 415 | 415 |
if v, ok := epMap["gw"]; ok {
|
| 416 |
- epj.gw6 = net.ParseIP(v.(string)) |
|
| 416 |
+ epj.gw = net.ParseIP(v.(string)) |
|
| 417 | 417 |
} |
| 418 | 418 |
if v, ok := epMap["gw6"]; ok {
|
| 419 | 419 |
epj.gw6 = net.ParseIP(v.(string)) |
| ... | ... |
@@ -442,6 +442,6 @@ func (epj *endpointJoinInfo) CopyTo(dstEpj *endpointJoinInfo) error {
|
| 442 | 442 |
dstEpj.driverTableEntries = make([]*tableEntry, len(epj.driverTableEntries)) |
| 443 | 443 |
copy(dstEpj.driverTableEntries, epj.driverTableEntries) |
| 444 | 444 |
dstEpj.gw = types.GetIPCopy(epj.gw) |
| 445 |
- dstEpj.gw = types.GetIPCopy(epj.gw6) |
|
| 445 |
+ dstEpj.gw6 = types.GetIPCopy(epj.gw6) |
|
| 446 | 446 |
return nil |
| 447 | 447 |
} |
| ... | ... |
@@ -114,7 +114,8 @@ type tableEventMessage struct {
|
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 | 116 |
func (m *tableEventMessage) Invalidates(other memberlist.Broadcast) bool {
|
| 117 |
- return false |
|
| 117 |
+ otherm := other.(*tableEventMessage) |
|
| 118 |
+ return m.tname == otherm.tname && m.id == otherm.id && m.key == otherm.key |
|
| 118 | 119 |
} |
| 119 | 120 |
|
| 120 | 121 |
func (m *tableEventMessage) Message() []byte {
|
| ... | ... |
@@ -290,13 +290,6 @@ func (nDB *NetworkDB) reconnectNode() {
|
| 290 | 290 |
return |
| 291 | 291 |
} |
| 292 | 292 |
|
| 293 |
- // Update all the local table state to a new time to |
|
| 294 |
- // force update on the node we are trying to rejoin, just in |
|
| 295 |
- // case that node has these in deleting state still. This is |
|
| 296 |
- // facilitate fast convergence after recovering from a gossip |
|
| 297 |
- // failure. |
|
| 298 |
- nDB.updateLocalTableTime() |
|
| 299 |
- |
|
| 300 | 293 |
logrus.Debugf("Initiating bulk sync with node %s after reconnect", node.Name)
|
| 301 | 294 |
nDB.bulkSync([]string{node.Name}, true)
|
| 302 | 295 |
} |
| ... | ... |
@@ -104,6 +104,9 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool {
|
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
n = nDB.checkAndGetNode(nEvent) |
| 107 |
+ if n == nil {
|
|
| 108 |
+ return false |
|
| 109 |
+ } |
|
| 107 | 110 |
|
| 108 | 111 |
nDB.purgeSameNode(n) |
| 109 | 112 |
n.ltime = nEvent.LTime |
| ... | ... |
@@ -130,25 +133,12 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool {
|
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 | 132 |
func (nDB *NetworkDB) handleNetworkEvent(nEvent *NetworkEvent) bool {
|
| 133 |
- var flushEntries bool |
|
| 134 | 133 |
// Update our local clock if the received messages has newer |
| 135 | 134 |
// time. |
| 136 | 135 |
nDB.networkClock.Witness(nEvent.LTime) |
| 137 | 136 |
|
| 138 | 137 |
nDB.Lock() |
| 139 |
- defer func() {
|
|
| 140 |
- nDB.Unlock() |
|
| 141 |
- // When a node leaves a network on the last task removal cleanup the |
|
| 142 |
- // local entries for this network & node combination. When the tasks |
|
| 143 |
- // on a network are removed we could have missed the gossip updates. |
|
| 144 |
- // Not doing this cleanup can leave stale entries because bulksyncs |
|
| 145 |
- // from the node will no longer include this network state. |
|
| 146 |
- // |
|
| 147 |
- // deleteNodeNetworkEntries takes nDB lock. |
|
| 148 |
- if flushEntries {
|
|
| 149 |
- nDB.deleteNodeNetworkEntries(nEvent.NetworkID, nEvent.NodeName) |
|
| 150 |
- } |
|
| 151 |
- }() |
|
| 138 |
+ defer nDB.Unlock() |
|
| 152 | 139 |
|
| 153 | 140 |
if nEvent.NodeName == nDB.config.NodeName {
|
| 154 | 141 |
return false |
| ... | ... |
@@ -176,7 +166,12 @@ func (nDB *NetworkDB) handleNetworkEvent(nEvent *NetworkEvent) bool {
|
| 176 | 176 |
n.leaving = nEvent.Type == NetworkEventTypeLeave |
| 177 | 177 |
if n.leaving {
|
| 178 | 178 |
n.reapTime = reapInterval |
| 179 |
- flushEntries = true |
|
| 179 |
+ |
|
| 180 |
+ // The remote node is leaving the network, but not the gossip cluster. |
|
| 181 |
+ // Mark all its entries in deleted state, this will guarantee that |
|
| 182 |
+ // if some node bulk sync with us, the deleted state of |
|
| 183 |
+ // these entries will be propagated. |
|
| 184 |
+ nDB.deleteNodeNetworkEntries(nEvent.NetworkID, nEvent.NodeName) |
|
| 180 | 185 |
} |
| 181 | 186 |
|
| 182 | 187 |
if nEvent.Type == NetworkEventTypeLeave {
|
| ... | ... |
@@ -211,17 +206,22 @@ func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent) bool {
|
| 211 | 211 |
nDB.RLock() |
| 212 | 212 |
networks := nDB.networks[nDB.config.NodeName] |
| 213 | 213 |
network, ok := networks[tEvent.NetworkID] |
| 214 |
- nDB.RUnlock() |
|
| 215 |
- if !ok || network.leaving {
|
|
| 216 |
- return true |
|
| 214 |
+ // Check if the owner of the event is still part of the network |
|
| 215 |
+ nodes := nDB.networkNodes[tEvent.NetworkID] |
|
| 216 |
+ var nodePresent bool |
|
| 217 |
+ for _, node := range nodes {
|
|
| 218 |
+ if node == tEvent.NodeName {
|
|
| 219 |
+ nodePresent = true |
|
| 220 |
+ break |
|
| 221 |
+ } |
|
| 217 | 222 |
} |
| 218 |
- |
|
| 219 |
- e, err := nDB.getEntry(tEvent.TableName, tEvent.NetworkID, tEvent.Key) |
|
| 220 |
- if err != nil && tEvent.Type == TableEventTypeDelete {
|
|
| 221 |
- // If it is a delete event and we don't have the entry here nothing to do. |
|
| 223 |
+ nDB.RUnlock() |
|
| 224 |
+ if !ok || network.leaving || !nodePresent {
|
|
| 225 |
+ // I'm out of the network OR the event owner is not anymore part of the network so do not propagate |
|
| 222 | 226 |
return false |
| 223 | 227 |
} |
| 224 | 228 |
|
| 229 |
+ e, err := nDB.getEntry(tEvent.TableName, tEvent.NetworkID, tEvent.Key) |
|
| 225 | 230 |
if err == nil {
|
| 226 | 231 |
// We have the latest state. Ignore the event |
| 227 | 232 |
// since it is stale. |
| ... | ... |
@@ -246,6 +246,11 @@ func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent) bool {
|
| 246 | 246 |
nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", tEvent.NetworkID, tEvent.TableName, tEvent.Key), e)
|
| 247 | 247 |
nDB.Unlock() |
| 248 | 248 |
|
| 249 |
+ if err != nil && tEvent.Type == TableEventTypeDelete {
|
|
| 250 |
+ // If it is a delete event and we didn't have the entry here don't repropagate |
|
| 251 |
+ return true |
|
| 252 |
+ } |
|
| 253 |
+ |
|
| 249 | 254 |
var op opType |
| 250 | 255 |
switch tEvent.Type {
|
| 251 | 256 |
case TableEventTypeCreate: |
| ... | ... |
@@ -286,8 +291,7 @@ func (nDB *NetworkDB) handleTableMessage(buf []byte, isBulkSync bool) {
|
| 286 | 286 |
return |
| 287 | 287 |
} |
| 288 | 288 |
|
| 289 |
- // Do not rebroadcast a bulk sync |
|
| 290 |
- if rebroadcast := nDB.handleTableEvent(&tEvent); rebroadcast && !isBulkSync {
|
|
| 289 |
+ if rebroadcast := nDB.handleTableEvent(&tEvent); rebroadcast {
|
|
| 291 | 290 |
var err error |
| 292 | 291 |
buf, err = encodeRawMessage(MessageTypeTableEvent, buf) |
| 293 | 292 |
if err != nil {
|
| ... | ... |
@@ -45,9 +45,12 @@ func (e *eventDelegate) NotifyLeave(mn *memberlist.Node) {
|
| 45 | 45 |
var failed bool |
| 46 | 46 |
logrus.Infof("Node %s/%s, left gossip cluster", mn.Name, mn.Addr)
|
| 47 | 47 |
e.broadcastNodeEvent(mn.Addr, opDelete) |
| 48 |
- e.nDB.deleteNodeTableEntries(mn.Name) |
|
| 49 |
- e.nDB.deleteNetworkEntriesForNode(mn.Name) |
|
| 48 |
+ // The node left or failed, delete all the entries created by it. |
|
| 49 |
+ // If the node was temporary down, deleting the entries will guarantee that the CREATE events will be accepted |
|
| 50 |
+ // If the node instead left because was going down, then it makes sense to just delete all its state |
|
| 50 | 51 |
e.nDB.Lock() |
| 52 |
+ e.nDB.deleteNetworkEntriesForNode(mn.Name) |
|
| 53 |
+ e.nDB.deleteNodeTableEntries(mn.Name) |
|
| 51 | 54 |
if n, ok := e.nDB.nodes[mn.Name]; ok {
|
| 52 | 55 |
delete(e.nDB.nodes, mn.Name) |
| 53 | 56 |
|
| ... | ... |
@@ -61,7 +64,6 @@ func (e *eventDelegate) NotifyLeave(mn *memberlist.Node) {
|
| 61 | 61 |
if failed {
|
| 62 | 62 |
logrus.Infof("Node %s/%s, added to failed nodes list", mn.Name, mn.Addr)
|
| 63 | 63 |
} |
| 64 |
- |
|
| 65 | 64 |
} |
| 66 | 65 |
|
| 67 | 66 |
func (e *eventDelegate) NotifyUpdate(n *memberlist.Node) {
|
| ... | ... |
@@ -108,6 +108,11 @@ type PeerInfo struct {
|
| 108 | 108 |
IP string |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 |
+// PeerClusterInfo represents the peer (gossip cluster) nodes |
|
| 112 |
+type PeerClusterInfo struct {
|
|
| 113 |
+ PeerInfo |
|
| 114 |
+} |
|
| 115 |
+ |
|
| 111 | 116 |
type node struct {
|
| 112 | 117 |
memberlist.Node |
| 113 | 118 |
ltime serf.LamportTime |
| ... | ... |
@@ -253,6 +258,20 @@ func (nDB *NetworkDB) Close() {
|
| 253 | 253 |
} |
| 254 | 254 |
} |
| 255 | 255 |
|
| 256 |
+// ClusterPeers returns all the gossip cluster peers. |
|
| 257 |
+func (nDB *NetworkDB) ClusterPeers() []PeerInfo {
|
|
| 258 |
+ nDB.RLock() |
|
| 259 |
+ defer nDB.RUnlock() |
|
| 260 |
+ peers := make([]PeerInfo, 0, len(nDB.nodes)) |
|
| 261 |
+ for _, node := range nDB.nodes {
|
|
| 262 |
+ peers = append(peers, PeerInfo{
|
|
| 263 |
+ Name: node.Name, |
|
| 264 |
+ IP: node.Node.Addr.String(), |
|
| 265 |
+ }) |
|
| 266 |
+ } |
|
| 267 |
+ return peers |
|
| 268 |
+} |
|
| 269 |
+ |
|
| 256 | 270 |
// Peers returns the gossip peers for a given network. |
| 257 | 271 |
func (nDB *NetworkDB) Peers(nid string) []PeerInfo {
|
| 258 | 272 |
nDB.RLock() |
| ... | ... |
@@ -399,7 +418,6 @@ func (nDB *NetworkDB) DeleteEntry(tname, nid, key string) error {
|
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 | 401 |
func (nDB *NetworkDB) deleteNetworkEntriesForNode(deletedNode string) {
|
| 402 |
- nDB.Lock() |
|
| 403 | 402 |
for nid, nodes := range nDB.networkNodes {
|
| 404 | 403 |
updatedNodes := make([]string, 0, len(nodes)) |
| 405 | 404 |
for _, node := range nodes {
|
| ... | ... |
@@ -414,11 +432,25 @@ func (nDB *NetworkDB) deleteNetworkEntriesForNode(deletedNode string) {
|
| 414 | 414 |
} |
| 415 | 415 |
|
| 416 | 416 |
delete(nDB.networks, deletedNode) |
| 417 |
- nDB.Unlock() |
|
| 418 | 417 |
} |
| 419 | 418 |
|
| 419 |
+// deleteNodeNetworkEntries is called in 2 conditions with 2 different outcomes: |
|
| 420 |
+// 1) when a notification is coming of a node leaving the network |
|
| 421 |
+// - Walk all the network entries and mark the leaving node's entries for deletion |
|
| 422 |
+// These will be garbage collected when the reap timer will expire |
|
| 423 |
+// 2) when the local node is leaving the network |
|
| 424 |
+// - Walk all the network entries: |
|
| 425 |
+// A) if the entry is owned by the local node |
|
| 426 |
+// then we will mark it for deletion. This will ensure that if a node did not |
|
| 427 |
+// yet received the notification that the local node is leaving, will be aware |
|
| 428 |
+// of the entries to be deleted. |
|
| 429 |
+// B) if the entry is owned by a remote node, then we can safely delete it. This |
|
| 430 |
+// ensures that if we join back this network as we receive the CREATE event for |
|
| 431 |
+// entries owned by remote nodes, we will accept them and we notify the application |
|
| 420 | 432 |
func (nDB *NetworkDB) deleteNodeNetworkEntries(nid, node string) {
|
| 421 |
- nDB.Lock() |
|
| 433 |
+ // Indicates if the delete is triggered for the local node |
|
| 434 |
+ isNodeLocal := node == nDB.config.NodeName |
|
| 435 |
+ |
|
| 422 | 436 |
nDB.indexes[byNetwork].WalkPrefix(fmt.Sprintf("/%s", nid),
|
| 423 | 437 |
func(path string, v interface{}) bool {
|
| 424 | 438 |
oldEntry := v.(*entry) |
| ... | ... |
@@ -427,7 +459,15 @@ func (nDB *NetworkDB) deleteNodeNetworkEntries(nid, node string) {
|
| 427 | 427 |
tname := params[1] |
| 428 | 428 |
key := params[2] |
| 429 | 429 |
|
| 430 |
- if oldEntry.node != node {
|
|
| 430 |
+ // If the entry is owned by a remote node and this node is not leaving the network |
|
| 431 |
+ if oldEntry.node != node && !isNodeLocal {
|
|
| 432 |
+ // Don't do anything because the event is triggered for a node that does not own this entry |
|
| 433 |
+ return false |
|
| 434 |
+ } |
|
| 435 |
+ |
|
| 436 |
+ // If this entry is already marked for deletion and this node is not leaving the network |
|
| 437 |
+ if oldEntry.deleting && !isNodeLocal {
|
|
| 438 |
+ // Don't do anything this entry will be already garbage collected using the old reapTime |
|
| 431 | 439 |
return false |
| 432 | 440 |
} |
| 433 | 441 |
|
| ... | ... |
@@ -439,17 +479,29 @@ func (nDB *NetworkDB) deleteNodeNetworkEntries(nid, node string) {
|
| 439 | 439 |
reapTime: reapInterval, |
| 440 | 440 |
} |
| 441 | 441 |
|
| 442 |
- nDB.indexes[byTable].Insert(fmt.Sprintf("/%s/%s/%s", tname, nid, key), entry)
|
|
| 443 |
- nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", nid, tname, key), entry)
|
|
| 442 |
+ // we arrived at this point in 2 cases: |
|
| 443 |
+ // 1) this entry is owned by the node that is leaving the network |
|
| 444 |
+ // 2) the local node is leaving the network |
|
| 445 |
+ if oldEntry.node == node {
|
|
| 446 |
+ if isNodeLocal {
|
|
| 447 |
+ // TODO fcrisciani: this can be removed if there is no way to leave the network |
|
| 448 |
+ // without doing a delete of all the objects |
|
| 449 |
+ entry.ltime++ |
|
| 450 |
+ } |
|
| 451 |
+ nDB.indexes[byTable].Insert(fmt.Sprintf("/%s/%s/%s", tname, nid, key), entry)
|
|
| 452 |
+ nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", nid, tname, key), entry)
|
|
| 453 |
+ } else {
|
|
| 454 |
+ // the local node is leaving the network, all the entries of remote nodes can be safely removed |
|
| 455 |
+ nDB.indexes[byTable].Delete(fmt.Sprintf("/%s/%s/%s", tname, nid, key))
|
|
| 456 |
+ nDB.indexes[byNetwork].Delete(fmt.Sprintf("/%s/%s/%s", nid, tname, key))
|
|
| 457 |
+ } |
|
| 444 | 458 |
|
| 445 | 459 |
nDB.broadcaster.Write(makeEvent(opDelete, tname, nid, key, entry.value)) |
| 446 | 460 |
return false |
| 447 | 461 |
}) |
| 448 |
- nDB.Unlock() |
|
| 449 | 462 |
} |
| 450 | 463 |
|
| 451 | 464 |
func (nDB *NetworkDB) deleteNodeTableEntries(node string) {
|
| 452 |
- nDB.Lock() |
|
| 453 | 465 |
nDB.indexes[byTable].Walk(func(path string, v interface{}) bool {
|
| 454 | 466 |
oldEntry := v.(*entry) |
| 455 | 467 |
if oldEntry.node != node {
|
| ... | ... |
@@ -461,27 +513,18 @@ func (nDB *NetworkDB) deleteNodeTableEntries(node string) {
|
| 461 | 461 |
nid := params[1] |
| 462 | 462 |
key := params[2] |
| 463 | 463 |
|
| 464 |
- entry := &entry{
|
|
| 465 |
- ltime: oldEntry.ltime, |
|
| 466 |
- node: node, |
|
| 467 |
- value: oldEntry.value, |
|
| 468 |
- deleting: true, |
|
| 469 |
- reapTime: reapInterval, |
|
| 470 |
- } |
|
| 464 |
+ nDB.indexes[byTable].Delete(fmt.Sprintf("/%s/%s/%s", tname, nid, key))
|
|
| 465 |
+ nDB.indexes[byNetwork].Delete(fmt.Sprintf("/%s/%s/%s", nid, tname, key))
|
|
| 471 | 466 |
|
| 472 |
- nDB.indexes[byTable].Insert(fmt.Sprintf("/%s/%s/%s", tname, nid, key), entry)
|
|
| 473 |
- nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", nid, tname, key), entry)
|
|
| 474 |
- |
|
| 475 |
- nDB.broadcaster.Write(makeEvent(opDelete, tname, nid, key, entry.value)) |
|
| 467 |
+ nDB.broadcaster.Write(makeEvent(opDelete, tname, nid, key, oldEntry.value)) |
|
| 476 | 468 |
return false |
| 477 | 469 |
}) |
| 478 |
- nDB.Unlock() |
|
| 479 | 470 |
} |
| 480 | 471 |
|
| 481 | 472 |
// WalkTable walks a single table in NetworkDB and invokes the passed |
| 482 | 473 |
// function for each entry in the table passing the network, key, |
| 483 | 474 |
// value. The walk stops if the passed function returns a true. |
| 484 |
-func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte) bool) error {
|
|
| 475 |
+func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte, bool) bool) error {
|
|
| 485 | 476 |
nDB.RLock() |
| 486 | 477 |
values := make(map[string]interface{})
|
| 487 | 478 |
nDB.indexes[byTable].WalkPrefix(fmt.Sprintf("/%s", tname), func(path string, v interface{}) bool {
|
| ... | ... |
@@ -494,7 +537,7 @@ func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte) bo |
| 494 | 494 |
params := strings.Split(k[1:], "/") |
| 495 | 495 |
nid := params[1] |
| 496 | 496 |
key := params[2] |
| 497 |
- if fn(nid, key, v.(*entry).value) {
|
|
| 497 |
+ if fn(nid, key, v.(*entry).value, v.(*entry).deleting) {
|
|
| 498 | 498 |
return nil |
| 499 | 499 |
} |
| 500 | 500 |
} |
| ... | ... |
@@ -554,37 +597,12 @@ func (nDB *NetworkDB) LeaveNetwork(nid string) error {
|
| 554 | 554 |
|
| 555 | 555 |
nDB.Lock() |
| 556 | 556 |
defer nDB.Unlock() |
| 557 |
- var ( |
|
| 558 |
- paths []string |
|
| 559 |
- entries []*entry |
|
| 560 |
- ) |
|
| 561 | 557 |
|
| 558 |
+ // Remove myself from the list of the nodes participating to the network |
|
| 562 | 559 |
nDB.deleteNetworkNode(nid, nDB.config.NodeName) |
| 563 | 560 |
|
| 564 |
- nwWalker := func(path string, v interface{}) bool {
|
|
| 565 |
- entry, ok := v.(*entry) |
|
| 566 |
- if !ok {
|
|
| 567 |
- return false |
|
| 568 |
- } |
|
| 569 |
- paths = append(paths, path) |
|
| 570 |
- entries = append(entries, entry) |
|
| 571 |
- return false |
|
| 572 |
- } |
|
| 573 |
- |
|
| 574 |
- nDB.indexes[byNetwork].WalkPrefix(fmt.Sprintf("/%s", nid), nwWalker)
|
|
| 575 |
- for _, path := range paths {
|
|
| 576 |
- params := strings.Split(path[1:], "/") |
|
| 577 |
- tname := params[1] |
|
| 578 |
- key := params[2] |
|
| 579 |
- |
|
| 580 |
- if _, ok := nDB.indexes[byTable].Delete(fmt.Sprintf("/%s/%s/%s", tname, nid, key)); !ok {
|
|
| 581 |
- logrus.Errorf("Could not delete entry in table %s with network id %s and key %s as it does not exist", tname, nid, key)
|
|
| 582 |
- } |
|
| 583 |
- |
|
| 584 |
- if _, ok := nDB.indexes[byNetwork].Delete(fmt.Sprintf("/%s/%s/%s", nid, tname, key)); !ok {
|
|
| 585 |
- logrus.Errorf("Could not delete entry in network %s with table name %s and key %s as it does not exist", nid, tname, key)
|
|
| 586 |
- } |
|
| 587 |
- } |
|
| 561 |
+ // Update all the local entries marking them for deletion and delete all the remote entries |
|
| 562 |
+ nDB.deleteNodeNetworkEntries(nid, nDB.config.NodeName) |
|
| 588 | 563 |
|
| 589 | 564 |
nodeNetworks, ok := nDB.networks[nDB.config.NodeName] |
| 590 | 565 |
if !ok {
|
| ... | ... |
@@ -597,6 +615,7 @@ func (nDB *NetworkDB) LeaveNetwork(nid string) error {
|
| 597 | 597 |
} |
| 598 | 598 |
|
| 599 | 599 |
n.ltime = ltime |
| 600 |
+ n.reapTime = reapInterval |
|
| 600 | 601 |
n.leaving = true |
| 601 | 602 |
return nil |
| 602 | 603 |
} |
| ... | ... |
@@ -660,27 +679,3 @@ func (nDB *NetworkDB) updateLocalNetworkTime() {
|
| 660 | 660 |
n.ltime = ltime |
| 661 | 661 |
} |
| 662 | 662 |
} |
| 663 |
- |
|
| 664 |
-func (nDB *NetworkDB) updateLocalTableTime() {
|
|
| 665 |
- nDB.Lock() |
|
| 666 |
- defer nDB.Unlock() |
|
| 667 |
- |
|
| 668 |
- ltime := nDB.tableClock.Increment() |
|
| 669 |
- nDB.indexes[byTable].Walk(func(path string, v interface{}) bool {
|
|
| 670 |
- entry := v.(*entry) |
|
| 671 |
- if entry.node != nDB.config.NodeName {
|
|
| 672 |
- return false |
|
| 673 |
- } |
|
| 674 |
- |
|
| 675 |
- params := strings.Split(path[1:], "/") |
|
| 676 |
- tname := params[0] |
|
| 677 |
- nid := params[1] |
|
| 678 |
- key := params[2] |
|
| 679 |
- entry.ltime = ltime |
|
| 680 |
- |
|
| 681 |
- nDB.indexes[byTable].Insert(fmt.Sprintf("/%s/%s/%s", tname, nid, key), entry)
|
|
| 682 |
- nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", nid, tname, key), entry)
|
|
| 683 |
- |
|
| 684 |
- return false |
|
| 685 |
- }) |
|
| 686 |
-} |
| 687 | 663 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,242 @@ |
| 0 |
+package networkdb |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "fmt" |
|
| 4 |
+ "net/http" |
|
| 5 |
+ "strings" |
|
| 6 |
+ |
|
| 7 |
+ "github.com/docker/libnetwork/diagnose" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+const ( |
|
| 11 |
+ missingParameter = "missing parameter" |
|
| 12 |
+) |
|
| 13 |
+ |
|
| 14 |
+// NetDbPaths2Func TODO |
|
| 15 |
+var NetDbPaths2Func = map[string]diagnose.HTTPHandlerFunc{
|
|
| 16 |
+ "/join": dbJoin, |
|
| 17 |
+ "/networkpeers": dbPeers, |
|
| 18 |
+ "/clusterpeers": dbClusterPeers, |
|
| 19 |
+ "/joinnetwork": dbJoinNetwork, |
|
| 20 |
+ "/leavenetwork": dbLeaveNetwork, |
|
| 21 |
+ "/createentry": dbCreateEntry, |
|
| 22 |
+ "/updateentry": dbUpdateEntry, |
|
| 23 |
+ "/deleteentry": dbDeleteEntry, |
|
| 24 |
+ "/getentry": dbGetEntry, |
|
| 25 |
+ "/gettable": dbGetTable, |
|
| 26 |
+} |
|
| 27 |
+ |
|
| 28 |
+func dbJoin(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 29 |
+ r.ParseForm() |
|
| 30 |
+ diagnose.DebugHTTPForm(r) |
|
| 31 |
+ if len(r.Form["members"]) < 1 {
|
|
| 32 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?members=ip1,ip2,...", r.URL.Path))
|
|
| 33 |
+ return |
|
| 34 |
+ } |
|
| 35 |
+ |
|
| 36 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 37 |
+ if ok {
|
|
| 38 |
+ err := nDB.Join(strings.Split(r.Form["members"][0], ",")) |
|
| 39 |
+ if err != nil {
|
|
| 40 |
+ fmt.Fprintf(w, "%s error in the DB join %s\n", r.URL.Path, err) |
|
| 41 |
+ return |
|
| 42 |
+ } |
|
| 43 |
+ |
|
| 44 |
+ fmt.Fprintf(w, "OK\n") |
|
| 45 |
+ } |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+func dbPeers(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 49 |
+ r.ParseForm() |
|
| 50 |
+ diagnose.DebugHTTPForm(r) |
|
| 51 |
+ if len(r.Form["nid"]) < 1 {
|
|
| 52 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?nid=test", r.URL.Path))
|
|
| 53 |
+ return |
|
| 54 |
+ } |
|
| 55 |
+ |
|
| 56 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 57 |
+ if ok {
|
|
| 58 |
+ peers := nDB.Peers(r.Form["nid"][0]) |
|
| 59 |
+ fmt.Fprintf(w, "Network:%s Total peers: %d\n", r.Form["nid"], len(peers)) |
|
| 60 |
+ for i, peerInfo := range peers {
|
|
| 61 |
+ fmt.Fprintf(w, "%d) %s -> %s\n", i, peerInfo.Name, peerInfo.IP) |
|
| 62 |
+ } |
|
| 63 |
+ } |
|
| 64 |
+} |
|
| 65 |
+ |
|
| 66 |
+func dbClusterPeers(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 67 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 68 |
+ if ok {
|
|
| 69 |
+ peers := nDB.ClusterPeers() |
|
| 70 |
+ fmt.Fprintf(w, "Total peers: %d\n", len(peers)) |
|
| 71 |
+ for i, peerInfo := range peers {
|
|
| 72 |
+ fmt.Fprintf(w, "%d) %s -> %s\n", i, peerInfo.Name, peerInfo.IP) |
|
| 73 |
+ } |
|
| 74 |
+ } |
|
| 75 |
+} |
|
| 76 |
+ |
|
| 77 |
+func dbCreateEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 78 |
+ r.ParseForm() |
|
| 79 |
+ diagnose.DebugHTTPForm(r) |
|
| 80 |
+ if len(r.Form["tname"]) < 1 || |
|
| 81 |
+ len(r.Form["nid"]) < 1 || |
|
| 82 |
+ len(r.Form["key"]) < 1 || |
|
| 83 |
+ len(r.Form["value"]) < 1 {
|
|
| 84 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id&key=k&value=v", r.URL.Path))
|
|
| 85 |
+ return |
|
| 86 |
+ } |
|
| 87 |
+ |
|
| 88 |
+ tname := r.Form["tname"][0] |
|
| 89 |
+ nid := r.Form["nid"][0] |
|
| 90 |
+ key := r.Form["key"][0] |
|
| 91 |
+ value := r.Form["value"][0] |
|
| 92 |
+ |
|
| 93 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 94 |
+ if ok {
|
|
| 95 |
+ if err := nDB.CreateEntry(tname, nid, key, []byte(value)); err != nil {
|
|
| 96 |
+ diagnose.HTTPReplyError(w, err.Error(), "") |
|
| 97 |
+ return |
|
| 98 |
+ } |
|
| 99 |
+ fmt.Fprintf(w, "OK\n") |
|
| 100 |
+ } |
|
| 101 |
+} |
|
| 102 |
+ |
|
| 103 |
+func dbUpdateEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 104 |
+ r.ParseForm() |
|
| 105 |
+ diagnose.DebugHTTPForm(r) |
|
| 106 |
+ if len(r.Form["tname"]) < 1 || |
|
| 107 |
+ len(r.Form["nid"]) < 1 || |
|
| 108 |
+ len(r.Form["key"]) < 1 || |
|
| 109 |
+ len(r.Form["value"]) < 1 {
|
|
| 110 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id&key=k&value=v", r.URL.Path))
|
|
| 111 |
+ return |
|
| 112 |
+ } |
|
| 113 |
+ |
|
| 114 |
+ tname := r.Form["tname"][0] |
|
| 115 |
+ nid := r.Form["nid"][0] |
|
| 116 |
+ key := r.Form["key"][0] |
|
| 117 |
+ value := r.Form["value"][0] |
|
| 118 |
+ |
|
| 119 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 120 |
+ if ok {
|
|
| 121 |
+ if err := nDB.UpdateEntry(tname, nid, key, []byte(value)); err != nil {
|
|
| 122 |
+ diagnose.HTTPReplyError(w, err.Error(), "") |
|
| 123 |
+ return |
|
| 124 |
+ } |
|
| 125 |
+ fmt.Fprintf(w, "OK\n") |
|
| 126 |
+ } |
|
| 127 |
+} |
|
| 128 |
+ |
|
| 129 |
+func dbDeleteEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 130 |
+ r.ParseForm() |
|
| 131 |
+ diagnose.DebugHTTPForm(r) |
|
| 132 |
+ if len(r.Form["tname"]) < 1 || |
|
| 133 |
+ len(r.Form["nid"]) < 1 || |
|
| 134 |
+ len(r.Form["key"]) < 1 {
|
|
| 135 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id&key=k", r.URL.Path))
|
|
| 136 |
+ return |
|
| 137 |
+ } |
|
| 138 |
+ |
|
| 139 |
+ tname := r.Form["tname"][0] |
|
| 140 |
+ nid := r.Form["nid"][0] |
|
| 141 |
+ key := r.Form["key"][0] |
|
| 142 |
+ |
|
| 143 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 144 |
+ if ok {
|
|
| 145 |
+ err := nDB.DeleteEntry(tname, nid, key) |
|
| 146 |
+ if err != nil {
|
|
| 147 |
+ diagnose.HTTPReplyError(w, err.Error(), "") |
|
| 148 |
+ return |
|
| 149 |
+ } |
|
| 150 |
+ fmt.Fprintf(w, "OK\n") |
|
| 151 |
+ } |
|
| 152 |
+} |
|
| 153 |
+ |
|
| 154 |
+func dbGetEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 155 |
+ r.ParseForm() |
|
| 156 |
+ diagnose.DebugHTTPForm(r) |
|
| 157 |
+ if len(r.Form["tname"]) < 1 || |
|
| 158 |
+ len(r.Form["nid"]) < 1 || |
|
| 159 |
+ len(r.Form["key"]) < 1 {
|
|
| 160 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id&key=k", r.URL.Path))
|
|
| 161 |
+ return |
|
| 162 |
+ } |
|
| 163 |
+ |
|
| 164 |
+ tname := r.Form["tname"][0] |
|
| 165 |
+ nid := r.Form["nid"][0] |
|
| 166 |
+ key := r.Form["key"][0] |
|
| 167 |
+ |
|
| 168 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 169 |
+ if ok {
|
|
| 170 |
+ value, err := nDB.GetEntry(tname, nid, key) |
|
| 171 |
+ if err != nil {
|
|
| 172 |
+ diagnose.HTTPReplyError(w, err.Error(), "") |
|
| 173 |
+ return |
|
| 174 |
+ } |
|
| 175 |
+ fmt.Fprintf(w, "key:`%s` value:`%s`\n", key, string(value)) |
|
| 176 |
+ } |
|
| 177 |
+} |
|
| 178 |
+ |
|
| 179 |
+func dbJoinNetwork(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 180 |
+ r.ParseForm() |
|
| 181 |
+ diagnose.DebugHTTPForm(r) |
|
| 182 |
+ if len(r.Form["nid"]) < 1 {
|
|
| 183 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?nid=network_id", r.URL.Path))
|
|
| 184 |
+ return |
|
| 185 |
+ } |
|
| 186 |
+ |
|
| 187 |
+ nid := r.Form["nid"][0] |
|
| 188 |
+ |
|
| 189 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 190 |
+ if ok {
|
|
| 191 |
+ if err := nDB.JoinNetwork(nid); err != nil {
|
|
| 192 |
+ diagnose.HTTPReplyError(w, err.Error(), "") |
|
| 193 |
+ return |
|
| 194 |
+ } |
|
| 195 |
+ fmt.Fprintf(w, "OK\n") |
|
| 196 |
+ } |
|
| 197 |
+} |
|
| 198 |
+ |
|
| 199 |
+func dbLeaveNetwork(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 200 |
+ r.ParseForm() |
|
| 201 |
+ diagnose.DebugHTTPForm(r) |
|
| 202 |
+ if len(r.Form["nid"]) < 1 {
|
|
| 203 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?nid=network_id", r.URL.Path))
|
|
| 204 |
+ return |
|
| 205 |
+ } |
|
| 206 |
+ |
|
| 207 |
+ nid := r.Form["nid"][0] |
|
| 208 |
+ |
|
| 209 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 210 |
+ if ok {
|
|
| 211 |
+ if err := nDB.LeaveNetwork(nid); err != nil {
|
|
| 212 |
+ diagnose.HTTPReplyError(w, err.Error(), "") |
|
| 213 |
+ return |
|
| 214 |
+ } |
|
| 215 |
+ fmt.Fprintf(w, "OK\n") |
|
| 216 |
+ } |
|
| 217 |
+} |
|
| 218 |
+ |
|
| 219 |
+func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
| 220 |
+ r.ParseForm() |
|
| 221 |
+ diagnose.DebugHTTPForm(r) |
|
| 222 |
+ if len(r.Form["tname"]) < 1 || |
|
| 223 |
+ len(r.Form["nid"]) < 1 {
|
|
| 224 |
+ diagnose.HTTPReplyError(w, missingParameter, fmt.Sprintf("%s?tname=table_name&nid=network_id", r.URL.Path))
|
|
| 225 |
+ return |
|
| 226 |
+ } |
|
| 227 |
+ |
|
| 228 |
+ tname := r.Form["tname"][0] |
|
| 229 |
+ nid := r.Form["nid"][0] |
|
| 230 |
+ |
|
| 231 |
+ nDB, ok := ctx.(*NetworkDB) |
|
| 232 |
+ if ok {
|
|
| 233 |
+ table := nDB.GetTableByNetwork(tname, nid) |
|
| 234 |
+ fmt.Fprintf(w, "total elements: %d\n", len(table)) |
|
| 235 |
+ i := 0 |
|
| 236 |
+ for k, v := range table {
|
|
| 237 |
+ fmt.Fprintf(w, "%d) k:`%s` -> v:`%s`\n", i, k, string(v.([]byte))) |
|
| 238 |
+ i++ |
|
| 239 |
+ } |
|
| 240 |
+ } |
|
| 241 |
+} |
| ... | ... |
@@ -26,7 +26,6 @@ type nwIface struct {
|
| 26 | 26 |
mac net.HardwareAddr |
| 27 | 27 |
address *net.IPNet |
| 28 | 28 |
addressIPv6 *net.IPNet |
| 29 |
- ipAliases []*net.IPNet |
|
| 30 | 29 |
llAddrs []*net.IPNet |
| 31 | 30 |
routes []*net.IPNet |
| 32 | 31 |
bridge bool |
| ... | ... |
@@ -97,13 +96,6 @@ func (i *nwIface) LinkLocalAddresses() []*net.IPNet {
|
| 97 | 97 |
return i.llAddrs |
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 |
-func (i *nwIface) IPAliases() []*net.IPNet {
|
|
| 101 |
- i.Lock() |
|
| 102 |
- defer i.Unlock() |
|
| 103 |
- |
|
| 104 |
- return i.ipAliases |
|
| 105 |
-} |
|
| 106 |
- |
|
| 107 | 100 |
func (i *nwIface) Routes() []*net.IPNet {
|
| 108 | 101 |
i.Lock() |
| 109 | 102 |
defer i.Unlock() |
| ... | ... |
@@ -337,7 +329,6 @@ func configureInterface(nlh *netlink.Handle, iface netlink.Link, i *nwIface) err |
| 337 | 337 |
{setInterfaceIPv6, fmt.Sprintf("error setting interface %q IPv6 to %v", ifaceName, i.AddressIPv6())},
|
| 338 | 338 |
{setInterfaceMaster, fmt.Sprintf("error setting interface %q master to %q", ifaceName, i.DstMaster())},
|
| 339 | 339 |
{setInterfaceLinkLocalIPs, fmt.Sprintf("error setting interface %q link local IPs to %v", ifaceName, i.LinkLocalAddresses())},
|
| 340 |
- {setInterfaceIPAliases, fmt.Sprintf("error setting interface %q IP Aliases to %v", ifaceName, i.IPAliases())},
|
|
| 341 | 340 |
} |
| 342 | 341 |
|
| 343 | 342 |
for _, config := range ifaceConfigurators {
|
| ... | ... |
@@ -399,16 +390,6 @@ func setInterfaceLinkLocalIPs(nlh *netlink.Handle, iface netlink.Link, i *nwIfac |
| 399 | 399 |
return nil |
| 400 | 400 |
} |
| 401 | 401 |
|
| 402 |
-func setInterfaceIPAliases(nlh *netlink.Handle, iface netlink.Link, i *nwIface) error {
|
|
| 403 |
- for _, si := range i.IPAliases() {
|
|
| 404 |
- ipAddr := &netlink.Addr{IPNet: si}
|
|
| 405 |
- if err := nlh.AddrAdd(iface, ipAddr); err != nil {
|
|
| 406 |
- return err |
|
| 407 |
- } |
|
| 408 |
- } |
|
| 409 |
- return nil |
|
| 410 |
-} |
|
| 411 |
- |
|
| 412 | 402 |
func setInterfaceName(nlh *netlink.Handle, iface netlink.Link, i *nwIface) error {
|
| 413 | 403 |
return nlh.LinkSetName(iface, i.DstName()) |
| 414 | 404 |
} |
| ... | ... |
@@ -356,6 +356,22 @@ func (n *networkNamespace) loopbackUp() error {
|
| 356 | 356 |
return n.nlHandle.LinkSetUp(iface) |
| 357 | 357 |
} |
| 358 | 358 |
|
| 359 |
+func (n *networkNamespace) AddLoopbackAliasIP(ip *net.IPNet) error {
|
|
| 360 |
+ iface, err := n.nlHandle.LinkByName("lo")
|
|
| 361 |
+ if err != nil {
|
|
| 362 |
+ return err |
|
| 363 |
+ } |
|
| 364 |
+ return n.nlHandle.AddrAdd(iface, &netlink.Addr{IPNet: ip})
|
|
| 365 |
+} |
|
| 366 |
+ |
|
| 367 |
+func (n *networkNamespace) RemoveLoopbackAliasIP(ip *net.IPNet) error {
|
|
| 368 |
+ iface, err := n.nlHandle.LinkByName("lo")
|
|
| 369 |
+ if err != nil {
|
|
| 370 |
+ return err |
|
| 371 |
+ } |
|
| 372 |
+ return n.nlHandle.AddrDel(iface, &netlink.Addr{IPNet: ip})
|
|
| 373 |
+} |
|
| 374 |
+ |
|
| 359 | 375 |
func (n *networkNamespace) InvokeFunc(f func()) error {
|
| 360 | 376 |
return nsInvoke(n.nsPath(), func(nsFD int) error { return nil }, func(callerFD int) error {
|
| 361 | 377 |
f() |
| ... | ... |
@@ -91,9 +91,7 @@ func (n *networkNamespace) DeleteNeighbor(dstIP net.IP, dstMac net.HardwareAddr, |
| 91 | 91 |
if nh.linkDst != "" {
|
| 92 | 92 |
nlnh.LinkIndex = iface.Attrs().Index |
| 93 | 93 |
} |
| 94 |
- if err := nlh.NeighDel(nlnh); err != nil {
|
|
| 95 |
- logrus.Warnf("Deleting bridge mac mac %s failed, %v", dstMac, err)
|
|
| 96 |
- } |
|
| 94 |
+ nlh.NeighDel(nlnh) |
|
| 97 | 95 |
} |
| 98 | 96 |
} |
| 99 | 97 |
|
| ... | ... |
@@ -66,12 +66,6 @@ func (n *networkNamespace) LinkLocalAddresses(list []*net.IPNet) IfaceOption {
|
| 66 | 66 |
} |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
-func (n *networkNamespace) IPAliases(list []*net.IPNet) IfaceOption {
|
|
| 70 |
- return func(i *nwIface) {
|
|
| 71 |
- i.ipAliases = list |
|
| 72 |
- } |
|
| 73 |
-} |
|
| 74 |
- |
|
| 75 | 69 |
func (n *networkNamespace) Routes(routes []*net.IPNet) IfaceOption {
|
| 76 | 70 |
return func(i *nwIface) {
|
| 77 | 71 |
i.routes = routes |
| ... | ... |
@@ -32,6 +32,12 @@ type Sandbox interface {
|
| 32 | 32 |
// Unset the previously set default IPv6 gateway in the sandbox |
| 33 | 33 |
UnsetGatewayIPv6() error |
| 34 | 34 |
|
| 35 |
+ // AddLoopbackAliasIP adds the passed IP address to the sandbox loopback interface |
|
| 36 |
+ AddLoopbackAliasIP(ip *net.IPNet) error |
|
| 37 |
+ |
|
| 38 |
+ // RemoveLoopbackAliasIP removes the passed IP address from the sandbox loopback interface |
|
| 39 |
+ RemoveLoopbackAliasIP(ip *net.IPNet) error |
|
| 40 |
+ |
|
| 35 | 41 |
// Add a static route to the sandbox. |
| 36 | 42 |
AddStaticRoute(*types.StaticRoute) error |
| 37 | 43 |
|
| ... | ... |
@@ -91,9 +97,6 @@ type IfaceOptionSetter interface {
|
| 91 | 91 |
// LinkLocalAddresses returns an option setter to set the link-local IP addresses. |
| 92 | 92 |
LinkLocalAddresses([]*net.IPNet) IfaceOption |
| 93 | 93 |
|
| 94 |
- // IPAliases returns an option setter to set IP address Aliases |
|
| 95 |
- IPAliases([]*net.IPNet) IfaceOption |
|
| 96 |
- |
|
| 97 | 94 |
// Master returns an option setter to set the master interface if any for this |
| 98 | 95 |
// interface. The master interface name should refer to the srcname of a |
| 99 | 96 |
// previously added interface of type bridge. |
| ... | ... |
@@ -150,9 +153,6 @@ type Interface interface {
|
| 150 | 150 |
// LinkLocalAddresses returns the link-local IP addresses assigned to the interface. |
| 151 | 151 |
LinkLocalAddresses() []*net.IPNet |
| 152 | 152 |
|
| 153 |
- // IPAliases returns the IP address aliases assigned to the interface. |
|
| 154 |
- IPAliases() []*net.IPNet |
|
| 155 |
- |
|
| 156 | 153 |
// IP routes for the interface. |
| 157 | 154 |
Routes() []*net.IPNet |
| 158 | 155 |
|
| ... | ... |
@@ -231,7 +231,7 @@ func (r *resolver) handleIPQuery(name string, query *dns.Msg, ipType int) (*dns. |
| 231 | 231 |
|
| 232 | 232 |
if addr == nil && ipv6Miss {
|
| 233 | 233 |
// Send a reply without any Answer sections |
| 234 |
- logrus.Debugf("Lookup name %s present without IPv6 address", name)
|
|
| 234 |
+ logrus.Debugf("[resolver] lookup name %s present without IPv6 address", name)
|
|
| 235 | 235 |
resp := createRespMsg(query) |
| 236 | 236 |
return resp, nil |
| 237 | 237 |
} |
| ... | ... |
@@ -239,7 +239,7 @@ func (r *resolver) handleIPQuery(name string, query *dns.Msg, ipType int) (*dns. |
| 239 | 239 |
return nil, nil |
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 |
- logrus.Debugf("Lookup for %s: IP %v", name, addr)
|
|
| 242 |
+ logrus.Debugf("[resolver] lookup for %s: IP %v", name, addr)
|
|
| 243 | 243 |
|
| 244 | 244 |
resp := createRespMsg(query) |
| 245 | 245 |
if len(addr) > 1 {
|
| ... | ... |
@@ -280,7 +280,7 @@ func (r *resolver) handlePTRQuery(ptr string, query *dns.Msg) (*dns.Msg, error) |
| 280 | 280 |
return nil, nil |
| 281 | 281 |
} |
| 282 | 282 |
|
| 283 |
- logrus.Debugf("Lookup for IP %s: name %s", parts[0], host)
|
|
| 283 |
+ logrus.Debugf("[resolver] lookup for IP %s: name %s", parts[0], host)
|
|
| 284 | 284 |
fqdn := dns.Fqdn(host) |
| 285 | 285 |
|
| 286 | 286 |
resp := new(dns.Msg) |
| ... | ... |
@@ -431,10 +431,12 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 431 | 431 |
} |
| 432 | 432 |
} |
| 433 | 433 |
if err != nil {
|
| 434 |
- logrus.Warnf("Connect failed: %s", err)
|
|
| 434 |
+ logrus.Warnf("[resolver] connect failed: %s", err)
|
|
| 435 | 435 |
continue |
| 436 | 436 |
} |
| 437 |
- logrus.Debugf("Query %s[%d] from %s, forwarding to %s:%s", name, query.Question[0].Qtype,
|
|
| 437 |
+ |
|
| 438 |
+ queryType := dns.TypeToString[query.Question[0].Qtype] |
|
| 439 |
+ logrus.Debugf("[resolver] query %s (%s) from %s, forwarding to %s:%s", name, queryType,
|
|
| 438 | 440 |
extConn.LocalAddr().String(), proto, extDNS.IPStr) |
| 439 | 441 |
|
| 440 | 442 |
// Timeout has to be set for every IO operation. |
| ... | ... |
@@ -450,7 +452,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 450 | 450 |
old := r.tStamp |
| 451 | 451 |
r.tStamp = time.Now() |
| 452 | 452 |
if r.tStamp.Sub(old) > logInterval {
|
| 453 |
- logrus.Errorf("More than %v concurrent queries from %s", maxConcurrent, extConn.LocalAddr().String())
|
|
| 453 |
+ logrus.Errorf("[resolver] more than %v concurrent queries from %s", maxConcurrent, extConn.LocalAddr().String())
|
|
| 454 | 454 |
} |
| 455 | 455 |
continue |
| 456 | 456 |
} |
| ... | ... |
@@ -458,7 +460,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 458 | 458 |
err = co.WriteMsg(query) |
| 459 | 459 |
if err != nil {
|
| 460 | 460 |
r.forwardQueryEnd() |
| 461 |
- logrus.Debugf("Send to DNS server failed, %s", err)
|
|
| 461 |
+ logrus.Debugf("[resolver] send to DNS server failed, %s", err)
|
|
| 462 | 462 |
continue |
| 463 | 463 |
} |
| 464 | 464 |
|
| ... | ... |
@@ -467,22 +469,32 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 467 | 467 |
// client can retry over TCP |
| 468 | 468 |
if err != nil && err != dns.ErrTruncated {
|
| 469 | 469 |
r.forwardQueryEnd() |
| 470 |
- logrus.Debugf("Read from DNS server failed, %s", err)
|
|
| 470 |
+ logrus.Debugf("[resolver] read from DNS server failed, %s", err)
|
|
| 471 | 471 |
continue |
| 472 | 472 |
} |
| 473 | 473 |
r.forwardQueryEnd() |
| 474 | 474 |
if resp != nil {
|
| 475 |
+ answers := 0 |
|
| 475 | 476 |
for _, rr := range resp.Answer {
|
| 476 | 477 |
h := rr.Header() |
| 477 | 478 |
switch h.Rrtype {
|
| 478 | 479 |
case dns.TypeA: |
| 480 |
+ answers++ |
|
| 479 | 481 |
ip := rr.(*dns.A).A |
| 482 |
+ logrus.Debugf("[resolver] received A record %q for %q from %s:%s", ip, h.Name, proto, extDNS.IPStr)
|
|
| 480 | 483 |
r.backend.HandleQueryResp(h.Name, ip) |
| 481 | 484 |
case dns.TypeAAAA: |
| 485 |
+ answers++ |
|
| 482 | 486 |
ip := rr.(*dns.AAAA).AAAA |
| 487 |
+ logrus.Debugf("[resolver] received AAAA record %q for %q from %s:%s", ip, h.Name, proto, extDNS.IPStr)
|
|
| 483 | 488 |
r.backend.HandleQueryResp(h.Name, ip) |
| 484 | 489 |
} |
| 485 | 490 |
} |
| 491 |
+ if resp.Answer == nil || answers == 0 {
|
|
| 492 |
+ logrus.Debugf("[resolver] external DNS %s:%s did not return any %s records for %q", proto, extDNS.IPStr, queryType, name)
|
|
| 493 |
+ } |
|
| 494 |
+ } else {
|
|
| 495 |
+ logrus.Debugf("[resolver] external DNS %s:%s returned empty response for %q", proto, extDNS.IPStr, name)
|
|
| 486 | 496 |
} |
| 487 | 497 |
resp.Compress = true |
| 488 | 498 |
break |
| ... | ... |
@@ -493,7 +505,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 493 | 493 |
} |
| 494 | 494 |
|
| 495 | 495 |
if err = w.WriteMsg(resp); err != nil {
|
| 496 |
- logrus.Errorf("error writing resolver resp, %s", err)
|
|
| 496 |
+ logrus.Errorf("[resolver] error writing resolver resp, %s", err)
|
|
| 497 | 497 |
} |
| 498 | 498 |
} |
| 499 | 499 |
|
| ... | ... |
@@ -514,7 +526,7 @@ func (r *resolver) forwardQueryEnd() {
|
| 514 | 514 |
defer r.queryLock.Unlock() |
| 515 | 515 |
|
| 516 | 516 |
if r.count == 0 {
|
| 517 |
- logrus.Error("Invalid concurrent query count")
|
|
| 517 |
+ logrus.Error("[resolver] invalid concurrent query count")
|
|
| 518 | 518 |
} else {
|
| 519 | 519 |
r.count-- |
| 520 | 520 |
} |
| ... | ... |
@@ -709,8 +709,15 @@ func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) {
|
| 709 | 709 |
|
| 710 | 710 |
ep.Lock() |
| 711 | 711 |
joinInfo := ep.joinInfo |
| 712 |
+ vip := ep.virtualIP |
|
| 712 | 713 |
ep.Unlock() |
| 713 | 714 |
|
| 715 |
+ if len(vip) != 0 {
|
|
| 716 |
+ if err := osSbox.RemoveLoopbackAliasIP(&net.IPNet{IP: vip, Mask: net.CIDRMask(32, 32)}); err != nil {
|
|
| 717 |
+ logrus.Warnf("Remove virtual IP %v failed: %v", vip, err)
|
|
| 718 |
+ } |
|
| 719 |
+ } |
|
| 720 |
+ |
|
| 714 | 721 |
if joinInfo == nil {
|
| 715 | 722 |
return |
| 716 | 723 |
} |
| ... | ... |
@@ -767,10 +774,6 @@ func (sb *sandbox) restoreOslSandbox() error {
|
| 767 | 767 |
if len(i.llAddrs) != 0 {
|
| 768 | 768 |
ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().LinkLocalAddresses(i.llAddrs)) |
| 769 | 769 |
} |
| 770 |
- if len(ep.virtualIP) != 0 {
|
|
| 771 |
- vipAlias := &net.IPNet{IP: ep.virtualIP, Mask: net.CIDRMask(32, 32)}
|
|
| 772 |
- ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().IPAliases([]*net.IPNet{vipAlias}))
|
|
| 773 |
- } |
|
| 774 | 770 |
Ifaces[fmt.Sprintf("%s+%s", i.srcName, i.dstPrefix)] = ifaceOptions
|
| 775 | 771 |
if joinInfo != nil {
|
| 776 | 772 |
routes = append(routes, joinInfo.StaticRoutes...) |
| ... | ... |
@@ -818,10 +821,6 @@ func (sb *sandbox) populateNetworkResources(ep *endpoint) error {
|
| 818 | 818 |
if len(i.llAddrs) != 0 {
|
| 819 | 819 |
ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().LinkLocalAddresses(i.llAddrs)) |
| 820 | 820 |
} |
| 821 |
- if len(ep.virtualIP) != 0 {
|
|
| 822 |
- vipAlias := &net.IPNet{IP: ep.virtualIP, Mask: net.CIDRMask(32, 32)}
|
|
| 823 |
- ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().IPAliases([]*net.IPNet{vipAlias}))
|
|
| 824 |
- } |
|
| 825 | 821 |
if i.mac != nil {
|
| 826 | 822 |
ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().MacAddress(i.mac)) |
| 827 | 823 |
} |
| ... | ... |
@@ -831,6 +830,13 @@ func (sb *sandbox) populateNetworkResources(ep *endpoint) error {
|
| 831 | 831 |
} |
| 832 | 832 |
} |
| 833 | 833 |
|
| 834 |
+ if len(ep.virtualIP) != 0 {
|
|
| 835 |
+ err := sb.osSbox.AddLoopbackAliasIP(&net.IPNet{IP: ep.virtualIP, Mask: net.CIDRMask(32, 32)})
|
|
| 836 |
+ if err != nil {
|
|
| 837 |
+ return fmt.Errorf("failed to add virtual IP %v: %v", ep.virtualIP, err)
|
|
| 838 |
+ } |
|
| 839 |
+ } |
|
| 840 |
+ |
|
| 834 | 841 |
if joinInfo != nil {
|
| 835 | 842 |
// Set up non-interface routes. |
| 836 | 843 |
for _, r := range joinInfo.StaticRoutes {
|
| ... | ... |
@@ -1,8 +1,7 @@ |
| 1 |
-github.com/Azure/go-ansiterm 04b7f292a41fcb5da32dda536c0807fc13e8351c |
|
| 1 |
+github.com/Azure/go-ansiterm 19f72df4d05d31cbe1c56bfc8045c96babff6c7e |
|
| 2 | 2 |
github.com/BurntSushi/toml f706d00e3de6abe700c994cdd545a1a4915af060 |
| 3 | 3 |
github.com/Microsoft/go-winio ce2922f643c8fd76b46cadc7f404a06282678b34 |
| 4 |
-github.com/Microsoft/hcsshim e439b7d2b63f036d3a50c93a9e0b154a0d50e788 |
|
| 5 |
-github.com/Sirupsen/logrus 4b6ea7319e214d98c938f12692336f7ca9348d6b |
|
| 4 |
+github.com/Microsoft/hcsshim v0.6.1 |
|
| 6 | 5 |
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec |
| 7 | 6 |
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80 |
| 8 | 7 |
github.com/boltdb/bolt c6ba97b89e0454fec9aa92e1d33a4e2c5fc1f631 |
| ... | ... |
@@ -11,9 +10,9 @@ github.com/coreos/etcd 925d1d74cec8c3b169c52fd4b2dc234a35934fce |
| 11 | 11 |
github.com/coreos/go-systemd b4a58d95188dd092ae20072bac14cece0e67c388 |
| 12 | 12 |
github.com/deckarep/golang-set ef32fa3046d9f249d399f98ebaf9be944430fd1d |
| 13 | 13 |
|
| 14 |
-github.com/docker/docker 9c96768eae4b3a65147b47a55c850c103ab8972d |
|
| 15 |
-github.com/docker/go-connections 34b5052da6b11e27f5f2e357b38b571ddddd3928 |
|
| 16 |
-github.com/docker/go-events 2e7d352816128aa84f4d29b2a21d400133701a0d |
|
| 14 |
+github.com/docker/docker 2cac43e3573893cf8fd816e0ad5615426acb87f4 https://github.com/dmcgowan/docker.git |
|
| 15 |
+github.com/docker/go-connections 3ede32e2033de7505e6500d6c868c2b9ed9f169d |
|
| 16 |
+github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 |
|
| 17 | 17 |
github.com/docker/go-units 8e2d4523730c73120e10d4652f36ad6010998f4e |
| 18 | 18 |
github.com/docker/libkv 1d8431073ae03cdaedb198a89722f3aab6d418ef |
| 19 | 19 |
|
| ... | ... |
@@ -31,9 +30,10 @@ github.com/hashicorp/go-sockaddr acd314c5781ea706c710d9ea70069fd2e110d61d |
| 31 | 31 |
github.com/hashicorp/serf 598c54895cc5a7b1a24a398d635e8c0ea0959870 |
| 32 | 32 |
github.com/mattn/go-shellwords 525bedee691b5a8df547cb5cf9f86b7fb1883e24 |
| 33 | 33 |
github.com/miekg/dns d27455715200c7d3e321a1e5cadb27c9ee0b0f02 |
| 34 |
-github.com/opencontainers/runc ba1568de399395774ad84c2ace65937814c542ed |
|
| 34 |
+github.com/opencontainers/runc 8694d576ea3ce3c9e2c804b7f91b4e1e9a575d1c https://github.com/dmcgowan/runc.git |
|
| 35 | 35 |
github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374 |
| 36 | 36 |
github.com/seccomp/libseccomp-golang 1b506fc7c24eec5a3693cdcbed40d9c226cfc6a1 |
| 37 |
+github.com/sirupsen/logrus v1.0.1 |
|
| 37 | 38 |
github.com/stretchr/testify dab07ac62d4905d3e48d17dc549c684ac3b7c15a |
| 38 | 39 |
github.com/syndtr/gocapability 2c00daeb6c3b45114c80ac44119e7b8801fdd852 |
| 39 | 40 |
github.com/ugorji/go f1f1a805ed361a0e078bb537e4ea78cd37dcf065 |