Only pass ipam parameter to create_network() if needed. (#48735)
This commit is contained in:
parent
6745ee7cc8
commit
ce3a9cfae5
1 changed files with 11 additions and 6 deletions
|
@ -424,12 +424,17 @@ class DockerNetworkManager(object):
|
||||||
else:
|
else:
|
||||||
ipam_pools.append(utils.create_ipam_pool(**ipam_pool))
|
ipam_pools.append(utils.create_ipam_pool(**ipam_pool))
|
||||||
|
|
||||||
if HAS_DOCKER_PY_2 or HAS_DOCKER_PY_3:
|
if self.parameters.ipam_driver or ipam_pools:
|
||||||
params['ipam'] = IPAMConfig(driver=self.parameters.ipam_driver,
|
# Only add ipam parameter if a driver was specified or if IPAM parameters
|
||||||
pool_configs=ipam_pools)
|
# were specified. Leaving this parameter away can significantly speed up
|
||||||
else:
|
# creation; on my machine creation with this option needs ~15 seconds,
|
||||||
params['ipam'] = utils.create_ipam_config(driver=self.parameters.ipam_driver,
|
# and without just a few seconds.
|
||||||
pool_configs=ipam_pools)
|
if HAS_DOCKER_PY_2 or HAS_DOCKER_PY_3:
|
||||||
|
params['ipam'] = IPAMConfig(driver=self.parameters.ipam_driver,
|
||||||
|
pool_configs=ipam_pools)
|
||||||
|
else:
|
||||||
|
params['ipam'] = utils.create_ipam_config(driver=self.parameters.ipam_driver,
|
||||||
|
pool_configs=ipam_pools)
|
||||||
|
|
||||||
if self.parameters.enable_ipv6 is not None:
|
if self.parameters.enable_ipv6 is not None:
|
||||||
params['enable_ipv6'] = self.parameters.enable_ipv6
|
params['enable_ipv6'] = self.parameters.enable_ipv6
|
||||||
|
|
Loading…
Reference in a new issue