Forráskód Böngészése

Reserve IPAM pools before resource cleanup

If the IPAM pools are not reserved before resource cleanup happens then
the resource release will not happen correctly.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Jana Radhakrishnan 9 éve
szülő
commit
a70909792a
1 módosított fájl, 8 hozzáadás és 2 törlés
  1. 8 2
      libnetwork/controller.go

+ 8 - 2
libnetwork/controller.go

@@ -203,12 +203,18 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
 		}
 		}
 	}
 	}
 
 
+	// Reserve pools first before doing cleanup. This is because
+	// if the pools are not populated properly, the cleanups of
+	// endpoint/network and sandbox below will not be able to
+	// release ip subnets and addresses properly into the pool
+	// because the pools won't exist.
+	c.reservePools()
+
+	// Cleanup resources
 	c.sandboxCleanup()
 	c.sandboxCleanup()
 	c.cleanupLocalEndpoints()
 	c.cleanupLocalEndpoints()
 	c.networkCleanup()
 	c.networkCleanup()
 
 
-	c.reservePools()
-
 	if err := c.startExternalKeyListener(); err != nil {
 	if err := c.startExternalKeyListener(); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}