Skip to content

Commit

Permalink
NetworkDB deleteEntry has to happen
Browse files Browse the repository at this point in the history
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
(cherry picked from commit 49378070a1683d0b53550bc21e121816bdf28cd8)
  • Loading branch information
Flavio Crisciani committed Jun 18, 2017
1 parent 0412c9d commit 05bd0fb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,13 +525,13 @@ func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
TaskAliases: ep.myAliases,
EndpointIP: ep.Iface().Address().IP.String(),
})

if err != nil {
return err
}

if agent != nil {
if err := agent.networkDB.CreateEntry("endpoint_table", n.ID(), ep.ID(), buf); err != nil {
logrus.Warnf("addServiceInfoToCluster NetworkDB CreateEntry failed for %s %s err:%s", ep.id, n.id, err)
return err
}
}
Expand All @@ -556,6 +556,13 @@ func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, method string) err
agent := c.getAgent()

if !ep.isAnonymous() && ep.Iface().Address() != nil {
// Delete the entry from network DB, this will trigger a notification to other nodes
if agent != nil {
if err := agent.networkDB.DeleteEntry("endpoint_table", n.ID(), ep.ID()); err != nil {
logrus.Warnf("deleteServiceInfoFromCluster NetworkDB DeleteEntry failed for %s %s err:%s", ep.id, n.id, err)
}
}
// Update locally
if ep.svcID != "" {
// This is a task part of a service
var ingressPorts []*PortConfig
Expand All @@ -571,11 +578,6 @@ func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, method string) err
return err
}
}
if agent != nil {
if err := agent.networkDB.DeleteEntry("endpoint_table", n.ID(), ep.ID()); err != nil {
return err
}
}
}

logrus.Debugf("deleteServiceInfoFromCluster from %s END for %s %s", method, ep.svcName, ep.ID())
Expand Down

0 comments on commit 05bd0fb

Please sign in to comment.