private boolean podHasAllocatedPrivateIPs(final long podId) { final HostPodVO pod = _podDao.findById(podId); final int count = _privateIpAddressDao.countIPs(podId, pod.getDataCenterId(), true); return count > 0; }
private void addIpAddressMetrics(final List<Item> metricsList, final long dcId, final String zoneName, final String zoneUuid) { metricsList.add(new ItemPrivateIp(zoneName, zoneUuid, ALLOCATED, privateIpAddressDao.countIPs(dcId, true))); metricsList.add(new ItemPrivateIp(zoneName, zoneUuid, TOTAL, privateIpAddressDao.countIPs(dcId, false))); metricsList.add(new ItemPublicIp(zoneName, zoneUuid, ALLOCATED, publicIpAddressDao.countIPsForNetwork(dcId, true, Vlan.VlanType.VirtualNetwork))); metricsList.add(new ItemPublicIp(zoneName, zoneUuid, TOTAL, publicIpAddressDao.countIPsForNetwork(dcId, false, Vlan.VlanType.VirtualNetwork))); metricsList.add(new ItemSharedNetworkIp(zoneName, zoneUuid, ALLOCATED, publicIpAddressDao.countIPsForNetwork(dcId, true, Vlan.VlanType.DirectAttached))); metricsList.add(new ItemSharedNetworkIp(zoneName, zoneUuid, TOTAL, publicIpAddressDao.countIPsForNetwork(dcId, false, Vlan.VlanType.DirectAttached))); }
protected void checkIfPodIsDeletable(final long podId) { final HostPodVO pod = _podDao.findById(podId); final String errorMsg = "The pod cannot be deleted because "; // Check if there are allocated private IP addresses in the pod if (_privateIpAddressDao.countIPs(podId, pod.getDataCenterId(), true) != 0) { throw new CloudRuntimeException(errorMsg + "there are private IP addresses allocated in this pod."); } // Check if there are any non-removed volumes in the pod. if (!_volumeDao.findByPod(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are storage volumes in this pod."); } // Check if there are any non-removed hosts in the pod. if (!_hostDao.findByPodId(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are servers in this pod."); } // Check if there are any non-removed vms in the pod. if (!_vmInstanceDao.listByPodId(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are virtual machines in this pod."); } // Check if there are any non-removed clusters in the pod. if (!_clusterDao.listByPodId(podId).isEmpty()) { throw new CloudRuntimeException(errorMsg + "there are clusters in this pod."); } }
if (_privateIpAddressDao.countIPs(zoneId, true) != 0) { throw new CloudRuntimeException(errorMsg + "there are private IP addresses allocated in this zone.");
capacities = _capacityDao.search(capacitySC, null); if (capacityType == Capacity.CAPACITY_TYPE_PRIVATE_IP) { totalIPs = _privateIPAddressDao.countIPs(podId, dcId, false); allocatedIPs = _privateIPAddressDao.countIPs(podId, dcId, true); } else if (capacityType == Capacity.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP) { totalIPs = _publicIPAddressDao.countIPsForNetwork(dcId, false, VlanType.VirtualNetwork);