|
@@ -127,6 +127,9 @@ type NetworkController interface {
|
|
// Wait for agent initialization complete in libnetwork controller
|
|
// Wait for agent initialization complete in libnetwork controller
|
|
AgentInitWait()
|
|
AgentInitWait()
|
|
|
|
|
|
|
|
+ // Wait for agent to stop if running
|
|
|
|
+ AgentStopWait()
|
|
|
|
+
|
|
// SetKeys configures the encryption key for gossip and overlay data path
|
|
// SetKeys configures the encryption key for gossip and overlay data path
|
|
SetKeys(keys []*types.EncryptionKey) error
|
|
SetKeys(keys []*types.EncryptionKey) error
|
|
}
|
|
}
|
|
@@ -160,6 +163,7 @@ type controller struct {
|
|
agent *agent
|
|
agent *agent
|
|
networkLocker *locker.Locker
|
|
networkLocker *locker.Locker
|
|
agentInitDone chan struct{}
|
|
agentInitDone chan struct{}
|
|
|
|
+ agentStopDone chan struct{}
|
|
keys []*types.EncryptionKey
|
|
keys []*types.EncryptionKey
|
|
clusterConfigAvailable bool
|
|
clusterConfigAvailable bool
|
|
sync.Mutex
|
|
sync.Mutex
|
|
@@ -337,6 +341,14 @@ func (c *controller) clusterAgentInit() {
|
|
// service bindings
|
|
// service bindings
|
|
c.agentClose()
|
|
c.agentClose()
|
|
c.cleanupServiceBindings("")
|
|
c.cleanupServiceBindings("")
|
|
|
|
+
|
|
|
|
+ c.Lock()
|
|
|
|
+ if c.agentStopDone != nil {
|
|
|
|
+ close(c.agentStopDone)
|
|
|
|
+ c.agentStopDone = nil
|
|
|
|
+ }
|
|
|
|
+ c.Unlock()
|
|
|
|
+
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -354,6 +366,15 @@ func (c *controller) AgentInitWait() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (c *controller) AgentStopWait() {
|
|
|
|
+ c.Lock()
|
|
|
|
+ agentStopDone := c.agentStopDone
|
|
|
|
+ c.Unlock()
|
|
|
|
+ if agentStopDone != nil {
|
|
|
|
+ <-agentStopDone
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
func (c *controller) makeDriverConfig(ntype string) map[string]interface{} {
|
|
func (c *controller) makeDriverConfig(ntype string) map[string]interface{} {
|
|
if c.cfg == nil {
|
|
if c.cfg == nil {
|
|
return nil
|
|
return nil
|