mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add AgentStopWait method
- to signal when the networking cluster agent is stopped Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
7ee02a3176
commit
18098ab1c8
2 changed files with 22 additions and 0 deletions
|
@ -218,6 +218,7 @@ func (c *controller) agentSetup() error {
|
||||||
if c.agent != nil && c.agentInitDone != nil {
|
if c.agent != nil && c.agentInitDone != nil {
|
||||||
close(c.agentInitDone)
|
close(c.agentInitDone)
|
||||||
c.agentInitDone = nil
|
c.agentInitDone = nil
|
||||||
|
c.agentStopDone = make(chan struct{})
|
||||||
}
|
}
|
||||||
c.Unlock()
|
c.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue