diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java index 229cabc1e59..99dd28c75de 100644 --- a/server/src/com/cloud/network/NetworkManager.java +++ b/server/src/com/cloud/network/NetworkManager.java @@ -151,7 +151,7 @@ public interface NetworkManager extends NetworkService { void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest); - void shutdownNetwork(long networkId, ReservationContext context); + void shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements); boolean destroyNetwork(long networkId, ReservationContext context); diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 17bd4d6875b..cdcf3fdf4a6 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -1302,7 +1302,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag network.setState(Network.State.Shutdown); _networksDao.update(networkId, network); - shutdownNetwork(networkId, context); + shutdownNetwork(networkId, context, false); } _networksDao.releaseFromLockTable(networkId); } @@ -2133,7 +2133,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Override @DB - public void shutdownNetwork(long networkId, ReservationContext context) { + public void shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements) { Transaction txn = Transaction.currentTxn(); txn.start(); @@ -2161,7 +2161,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag s_logger.debug("Sending network shutdown to " + element.getName()); } - element.shutdown(network, context, false); + element.shutdown(network, context, cleanupElements); } catch (ResourceUnavailableException e) { s_logger.warn("Unable to complete shutdown of the network due to element: " + element.getName(), e); success = false; @@ -2225,7 +2225,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } // Shutdown network first - shutdownNetwork(networkId, context); + shutdownNetwork(networkId, context, false); // get updated state for the network network = _networksDao.findById(networkId); @@ -2438,7 +2438,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag ReservationContext context = new ReservationContextImpl(null, null, caller, owner); - shutdownNetwork(networkId, context); + shutdownNetwork(networkId, context, false); } catch (Exception e) { s_logger.warn("Unable to shutdown network: " + networkId); } @@ -2472,7 +2472,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag _accountMgr.checkAccess(callerAccount, null, network); - boolean success = restartNetwork(networkId, callerAccount, null); + boolean success = restartNetwork(networkId, callerAccount, null, cleanup); if (success) { s_logger.debug("Network id=" + networkId + " is restarted successfully."); @@ -2503,7 +2503,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } } - private boolean restartNetwork(long networkId, Account caller, Long newNetworkOfferingId) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + private boolean restartNetwork(long networkId, Account caller, Long newNetworkOfferingId, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { NetworkVO network = _networksDao.findById(networkId); @@ -2513,7 +2513,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag ReservationContext context = new ReservationContextImpl(null, null, null, caller); s_logger.debug("Shutting down the network id=" + networkId + " as a part of network restart"); - shutdownNetwork(networkId, context); + shutdownNetwork(networkId, context, cleanup); //check that the network was shutdown properly network = _networksDao.findById(networkId); @@ -3198,7 +3198,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag s_logger.info("Restarting network " + network + " as a part of update network call"); try { - success = restartNetwork(networkId, caller, networkOfferingId); + success = restartNetwork(networkId, caller, networkOfferingId, true); } catch (Exception e) { success = false; } diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java index 7b4bf33deab..aab5b9f170d 100644 --- a/server/test/com/cloud/network/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java @@ -328,7 +328,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS } @Override - public void shutdownNetwork(long networkId, ReservationContext context) { + public void shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements) { // TODO Auto-generated method stub }