فهرست منبع

Avoid k/v store endpoint update in swarm mode

Avoid the whole store endpoint update logic when running in swarm mode
and the endpoint is part of a global scope network. Currently there is
no store update that is happening for global scope networks in swarm
mode, but this code path will delete the svcRecords database when the
last endpoint on the network is removed which is something that is not
required.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Jana Radhakrishnan 8 سال پیش
والد
کامیت
1f4c1cb75c
1فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 8 0
      libnetwork/store.go

+ 8 - 0
libnetwork/store.go

@@ -346,6 +346,10 @@ func (c *controller) networkWatchLoop(nw *netWatch, ep *endpoint, ecCh <-chan da
 }
 }
 
 
 func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoint) {
 func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoint) {
+	if !c.isDistributedControl() && ep.getNetwork().driverScope() == datastore.GlobalScope {
+		return
+	}
+
 	c.Lock()
 	c.Lock()
 	nw, ok := nmap[ep.getNetwork().ID()]
 	nw, ok := nmap[ep.getNetwork().ID()]
 	c.Unlock()
 	c.Unlock()
@@ -400,6 +404,10 @@ func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoi
 }
 }
 
 
 func (c *controller) processEndpointDelete(nmap map[string]*netWatch, ep *endpoint) {
 func (c *controller) processEndpointDelete(nmap map[string]*netWatch, ep *endpoint) {
+	if !c.isDistributedControl() && ep.getNetwork().driverScope() == datastore.GlobalScope {
+		return
+	}
+
 	c.Lock()
 	c.Lock()
 	nw, ok := nmap[ep.getNetwork().ID()]
 	nw, ok := nmap[ep.getNetwork().ID()]