mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Delete corresponding networks during zone deletion.
This commit is contained in:
parent
8db9f9fbdb
commit
7d7817ecba
@ -860,6 +860,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
try {
|
try {
|
||||||
// Delete vNet
|
// Delete vNet
|
||||||
_zoneDao.deleteVnet(zoneId);
|
_zoneDao.deleteVnet(zoneId);
|
||||||
|
|
||||||
|
//Delete networks
|
||||||
|
List<NetworkVO> networks = _networkDao.listByZone(zoneId);
|
||||||
|
if (networks != null && !networks.isEmpty()) {
|
||||||
|
for (NetworkVO network : networks) {
|
||||||
|
_networkDao.remove(network.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
s_logger.error("Failed to delete zone " + zoneId);
|
s_logger.error("Failed to delete zone " + zoneId);
|
||||||
throw new CloudRuntimeException("Failed to delete zone " + zoneId);
|
throw new CloudRuntimeException("Failed to delete zone " + zoneId);
|
||||||
|
|||||||
@ -49,6 +49,8 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
|
|||||||
|
|
||||||
List<NetworkVO> listBy(long zoneId, String broadcastUri);
|
List<NetworkVO> listBy(long zoneId, String broadcastUri);
|
||||||
|
|
||||||
|
List<NetworkVO> listByZone(long zoneId);
|
||||||
|
|
||||||
void changeActiveNicsBy(long networkId, int nicsCount);
|
void changeActiveNicsBy(long networkId, int nicsCount);
|
||||||
|
|
||||||
int getActiveNicsIn(long networkId);
|
int getActiveNicsIn(long networkId);
|
||||||
|
|||||||
@ -210,6 +210,13 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
|||||||
return search(sc, null);
|
return search(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NetworkVO> listByZone(long zoneId) {
|
||||||
|
SearchCriteria<NetworkVO> sc = ZoneBroadcastUriSearch.create();
|
||||||
|
sc.setParameters("dataCenterId", zoneId);
|
||||||
|
return search(sc, null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeActiveNicsBy(long networkId, int count) {
|
public void changeActiveNicsBy(long networkId, int count) {
|
||||||
_opDao.changeActiveNicsBy(networkId, count);
|
_opDao.changeActiveNicsBy(networkId, count);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user