Don't release dead container's IP addresses if not asked to check it is alive.
This commit is contained in:
1 parent
49e76d1486
commit
e42600632f
1 file changed
+5
-5
+5
-5
@@ -322,7 +322,7 @@ func (alloc *Allocator) Claim(ident string, cidr address.CIDR, isContainer, noEr
|
|||||||
// ContainerDied called from the updater interface. Async.
|
// ContainerDied called from the updater interface. Async.
|
||||||
func (alloc *Allocator) ContainerDied(ident string) {
|
func (alloc *Allocator) ContainerDied(ident string) {
|
||||||
alloc.actionChan <- func() {
|
alloc.actionChan <- func() {
|
||||||
if alloc.hasOwned(ident) {
|
if alloc.hasOwnedByContainer(ident) {
|
||||||
alloc.debugln("Container", ident, "died; noting to remove later")
|
alloc.debugln("Container", ident, "died; noting to remove later")
|
||||||
alloc.dead[ident] = alloc.now()
|
alloc.dead[ident] = alloc.now()
|
||||||
}
|
}
|
||||||
@@ -335,7 +335,7 @@ func (alloc *Allocator) ContainerDied(ident string) {
|
|||||||
// ContainerDestroyed called from the updater interface. Async.
|
// ContainerDestroyed called from the updater interface. Async.
|
||||||
func (alloc *Allocator) ContainerDestroyed(ident string) {
|
func (alloc *Allocator) ContainerDestroyed(ident string) {
|
||||||
alloc.actionChan <- func() {
|
alloc.actionChan <- func() {
|
||||||
if alloc.hasOwned(ident) {
|
if alloc.hasOwnedByContainer(ident) {
|
||||||
alloc.debugln("Container", ident, "destroyed; removing addresses")
|
alloc.debugln("Container", ident, "destroyed; removing addresses")
|
||||||
alloc.delete(ident)
|
alloc.delete(ident)
|
||||||
delete(alloc.dead, ident)
|
delete(alloc.dead, ident)
|
||||||
@@ -996,9 +996,9 @@ func (alloc *Allocator) persistOwned() {
|
|||||||
|
|
||||||
// Owned addresses
|
// Owned addresses
|
||||||
|
|
||||||
func (alloc *Allocator) hasOwned(ident string) bool {
|
func (alloc *Allocator) hasOwnedByContainer(ident string) bool {
|
||||||
_, b := alloc.owned[ident]
|
d, b := alloc.owned[ident]
|
||||||
return b
|
return b && d.IsContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: addr must not be owned by ident already
|
// NB: addr must not be owned by ident already
|
||||||
|
|||||||
Reference in new issue
Block a user