@Override public Boolean doInTransaction(final TransactionStatus status) { // delete vlans for this zone final List<VlanVO> vlans = _vlanDao.listByZone(zoneId); for (final VlanVO vlan : vlans) { _vlanDao.remove(vlan.getId()); } final boolean success = _zoneDao.remove(zoneId); if (success) { // delete all capacity records for the zone _capacityDao.removeBy(null, zoneId, null, null, null); // remove from dedicated resources final DedicatedResourceVO dr = _dedicatedDao.findByZoneId(zoneId); if (dr != null) { _dedicatedDao.remove(dr.getId()); // find the group associated and check if there are any more // resources under that group final List<DedicatedResourceVO> resourcesInGroup = _dedicatedDao.listByAffinityGroupId(dr.getAffinityGroupId()); if (resourcesInGroup.isEmpty()) { // delete the group _affinityGroupService.deleteAffinityGroup(dr.getAffinityGroupId(), null, null, null, null); } } } return success; } });
private void checkVlanUnderlayCompatibility(VlanVO newVlan) throws ResourceUnavailableException { List<VlanVO> vlans = _vlanDao.listByZone(newVlan.getDataCenterId()); if (CollectionUtils.isNotEmpty(vlans)) { boolean newVlanUnderlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, newVlan); final String newCidr = NetUtils.getCidrFromGatewayAndNetmask(newVlan.getVlanGateway(), newVlan.getVlanNetmask()); for (VlanVO vlan : vlans) { if (vlan.getId() == newVlan.getId()) continue; final String existingCidr = NetUtils.getCidrFromGatewayAndNetmask(vlan.getVlanGateway(), vlan.getVlanNetmask()); NetUtils.SupersetOrSubset supersetOrSubset = NetUtils.isNetowrkASubsetOrSupersetOfNetworkB(newCidr, existingCidr); if (supersetOrSubset == NetUtils.SupersetOrSubset.sameSubnet) { boolean vlanUnderlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, vlan); if (newVlanUnderlay != vlanUnderlay) { throw new ResourceUnavailableException("Mixed values for the underlay flag for IP ranges in the same subnet is not supported", Vlan.class, newVlan.getId()); } break; } } } }
final List<VlanVO> vlans = _vlanDao.listByZone(dataCenterId); List<String> pvlan = new ArrayList<String>(); for (final VlanVO vlan : vlans) {
final List<VlanVO> vlans = _vlanDao.listByZone(zone.getId()); for (final VlanVO vlan : vlans) { final String otherVlanGateway = vlan.getVlanGateway(); final List<VlanVO> vlans = _vlanDao.listByZone(zone.getId()); for (final VlanVO vlan : vlans) { if (vlan.getIp6Gateway() == null) {