sureshanaparti commented on a change in pull request #4561: URL: https://github.com/apache/cloudstack/pull/4561#discussion_r566842841
########## File path: engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java ########## @@ -2864,6 +2962,33 @@ public boolean shutdownNetworkElementsAndResources(final ReservationContext cont return success; } + private void cleanupPersistentnNetworkResources(NetworkVO network) { + long networkOfferingId = network.getNetworkOfferingId(); + NetworkOfferingVO offering = _networkOfferingDao.findById(networkOfferingId); + if (offering != null) { + if (networkMeetsPersistenceCriteria(network, offering, true) && + _networksDao.getOtherPersistentNetworksCount(network.getId(), network.getBroadcastUri().toString(), offering.isPersistent()) == 0) { + List<HostVO> hosts = resourceManager.listAllUpAndEnabledHostsInOneZoneByType(Host.Type.Routing, network.getDataCenterId()); + for (HostVO host : hosts) { + try { + NicTO to = createNicTOFromNetworkAndOffering(network, offering, host); + CleanupPersistentNetworkResourceCommand cmd = new CleanupPersistentNetworkResourceCommand(to); + CleanupPersistentNetworkResourceAnswer answer = (CleanupPersistentNetworkResourceAnswer) _agentMgr.send(host.getId(), cmd); + if (answer == null) { + s_logger.warn("Unable to get an answer to the CleanupPersistentNetworkResourceCommand from agent:" + host.getId()); Review comment: potential NPE issue below. `continue` missing here ? please check. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org