File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,11 @@ func DeleteNetworkID(stateDriver core.StateDriver, netID string) error {
371
371
return err
372
372
}
373
373
374
+ // Check if there are any active endpoints
375
+ if hasActiveEndpoints (nwCfg ) {
376
+ return core .Errorf ("Error: Network has active endpoints" )
377
+ }
378
+
374
379
if IsDNSEnabled () {
375
380
// detach Dns container
376
381
err = detachServiceContainer (nwCfg .Tenant , nwCfg .NetworkName )
@@ -379,11 +384,6 @@ func DeleteNetworkID(stateDriver core.StateDriver, netID string) error {
379
384
}
380
385
}
381
386
382
- // Check if there are any active endpoints
383
- if hasActiveEndpoints (nwCfg ) {
384
- return core .Errorf ("Error: Network has active endpoints" )
385
- }
386
-
387
387
if GetClusterMode () == "docker" {
388
388
// Delete the docker network
389
389
err = docknet .DeleteDockNet (nwCfg .Tenant , nwCfg .NetworkName , "" )
@@ -534,5 +534,7 @@ func networkReleaseAddress(nwCfg *mastercfg.CfgNetworkState, ipAddress string) e
534
534
}
535
535
536
536
func hasActiveEndpoints (nwCfg * mastercfg.CfgNetworkState ) bool {
537
- return nwCfg .EpCount > 0
537
+ // We spin a dns container if IsDNSEnabled() == true
538
+ // We need to exlude that from Active EPs check.
539
+ return (IsDNSEnabled () && nwCfg .EpCount > 1 ) || ((! IsDNSEnabled ()) && nwCfg .EpCount > 0 )
538
540
}
You can’t perform that action at this time.
0 commit comments