public static List<DataCenterVO> listZones() { return s_zoneDao.listAll(); }
@Override public void associateTemplateToZone(long templateId, Long zoneId) { List<Long> dcs = new ArrayList<Long>(); if (zoneId != null) { dcs.add(zoneId); } else { List<DataCenterVO> zones = _dcDao.listAll(); for (DataCenterVO zone : zones) { dcs.add(zone.getId()); } } for (Long id : dcs) { VMTemplateZoneVO tmpltZoneVO = _vmTemplateZoneDao.findByZoneTemplate(id, templateId); if (tmpltZoneVO == null) { tmpltZoneVO = new VMTemplateZoneVO(id, templateId, new Date()); _vmTemplateZoneDao.persist(tmpltZoneVO); } else { tmpltZoneVO.setLastUpdated(new Date()); _vmTemplateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO); } } }
final List<DataCenterVO> zones = _dcDao.listAll();
private void associateCrosszoneTemplatesToZone(Long zoneId) { VMTemplateZoneVO tmpltZone; List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll(); List<Long> dcIds = new ArrayList<Long>(); if (zoneId != null) { dcIds.add(zoneId); } else { List<DataCenterVO> dcs = _dcDao.listAll(); if (dcs != null) { for (DataCenterVO dc : dcs) { dcIds.add(dc.getId()); } } } for (VMTemplateVO vt : allTemplates) { if (vt.isCrossZones()) { for (Long dcId : dcIds) { tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId()); if (tmpltZone == null) { VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date()); _vmTemplateZoneDao.persist(vmTemplateZone); } } } } }
List<DataCenterVO> datacenters = _dcDao.listAll(); for (DataCenterVO datacenter : datacenters) { long dcId = datacenter.getId();
private void createDefaultNetworks() { List<DataCenterVO> zones = _dataCenterDao.listAll(); long id = 1;
protected void runExternalDeviceNetworkUsageTask() { s_logger.debug("External devices stats collector is running..."); for (DataCenterVO zone : _dcDao.listAll()) { List<DomainRouterVO> domainRoutersInZone = _routerDao.listByDataCenter(zone.getId()); if (domainRoutersInZone == null) {
List<DataCenterVO> dataCenterList = _dcDao.listAll(); List<ClusterVO> clusterList = _clusterDao.listAll(); List<HostPodVO> podList = _podDao.listAll();
@Override public void updateMetrics() { final List<Item> latestMetricsItems = new ArrayList<Item>(); try { for (final DataCenterVO dc : dcDao.listAll()) { final String zoneName = dc.getName(); final String zoneUuid = dc.getUuid(); alertManager.recalculateCapacity(); addHostMetrics(latestMetricsItems, dc.getId(), zoneName, zoneUuid); addVMMetrics(latestMetricsItems, dc.getId(), zoneName, zoneUuid); addVolumeMetrics(latestMetricsItems, dc.getId(), zoneName, zoneUuid); addStorageMetrics(latestMetricsItems, dc.getId(), zoneName, zoneUuid); addIpAddressMetrics(latestMetricsItems, dc.getId(), zoneName, zoneUuid); addVlanMetrics(latestMetricsItems, dc.getId(), zoneName, zoneUuid); } addDomainLimits(latestMetricsItems); } catch (Exception e) { LOG.warn("Getting metrics failed ", e); } metricsItems = latestMetricsItems; }
List<DataCenterVO> dataCenters = _zoneDao.listAll(); TrafficType trafficType = offeringToUpdate.getTrafficType(); String oldTags = offeringToUpdate.getTags();
protected VMTemplateVO persistTemplate(TemplateProfile profile, VirtualMachineTemplate.State initialState) { List<Long> zoneIdList = profile.getZoneIdList(); VMTemplateVO template = new VMTemplateVO(profile.getTemplateId(), profile.getName(), profile.getFormat(), profile.isPublic(), profile.isFeatured(), profile.isExtractable(), profile.getTemplateType(), profile.getUrl(), profile.isRequiresHVM(), profile.getBits(), profile.getAccountId(), profile.getCheckSum(), profile.getDisplayText(), profile.isPasswordEnabled(), profile.getGuestOsId(), profile.isBootable(), profile.getHypervisorType(), profile.getTemplateTag(), profile.getDetails(), profile.isSshKeyEnabled(), profile.IsDynamicallyScalable(), profile.isDirectDownload()); template.setState(initialState); if (profile.isDirectDownload()) { template.setSize(profile.getSize()); } if (zoneIdList == null) { List<DataCenterVO> dcs = _dcDao.listAll(); if (dcs.isEmpty()) { throw new CloudRuntimeException("No zones are present in the system, can't add template"); } template.setCrossZones(true); for (DataCenterVO dc : dcs) { _tmpltDao.addTemplateToZone(template, dc.getId()); } } else { for (Long zoneId: zoneIdList) { _tmpltDao.addTemplateToZone(template, zoneId); } } return _tmpltDao.findById(template.getId()); }