public static String findClusterDetails(long clusterId, String name) { ClusterDetailsVO detailsVO = s_clusterDetailsDao.findDetail(clusterId, name); if (detailsVO != null) { return detailsVO.getValue(); } return null; }
private void afterStorageMigrationVmwareVMcleanup(StoragePool destPool, VMInstanceVO vm, HostVO srcHost, Long srcClusterId) { // OfflineVmwareMigration: this should only happen on storage migration, else the guru would already have issued the command final Long destClusterId = destPool.getClusterId(); if (srcClusterId != null && destClusterId != null && ! srcClusterId.equals(destClusterId)) { final String srcDcName = _clusterDetailsDao.getVmwareDcName(srcClusterId); final String destDcName = _clusterDetailsDao.getVmwareDcName(destClusterId); if (srcDcName != null && destDcName != null && !srcDcName.equals(destDcName)) { removeStaleVmFromSource(vm, srcHost); } } }
@Override @ActionEvent(eventType = EventTypes.EVENT_HA_RESOURCE_ENABLE, eventDescription = "enabling HA for a cluster") public boolean enableHA(final Cluster cluster) { clusterDetailsDao.persist(cluster.getId(), HA_ENABLED_DETAIL, String.valueOf(true)); return true; }
ClusterDetailsVO clusterDetailsVO = _clusterDetailsDao.findDetail(host.getClusterId(), name); clusterDetailsVO.setValue(Boolean.TRUE.toString()); _clusterDetailsDao.update(clusterDetailsVO.getId(), clusterDetailsVO); _clusterDetailsDao.remove(clusterDetailsVO.getId()); clusterDetailsVO = new ClusterDetailsVO(host.getClusterId(), name, Boolean.TRUE.toString()); _clusterDetailsDao.persist(clusterDetailsVO);
final Map<String, String> clusterDetails = _clusterDetailsDao.findDetails(clusterId); username = clusterDetails.get("username"); assert username != null; if (_clusterDetailsDao.findDetail(clusterId, "cpuOvercommitRatio") == null) { final ClusterDetailsVO cluster_cpu_detail = new ClusterDetailsVO(clusterId, "cpuOvercommitRatio", "1"); final ClusterDetailsVO cluster_memory_detail = new ClusterDetailsVO(clusterId, "memoryOvercommitRatio", "1"); _clusterDetailsDao.persist(cluster_cpu_detail); _clusterDetailsDao.persist(cluster_memory_detail);
throw new InvalidParameterValueException("unable to find cluster by id " + resourceId); ClusterDetailsVO clusterDetailsVO = _clusterDetailsDao.findDetail(resourceId, name); if (clusterDetailsVO == null) { clusterDetailsVO = new ClusterDetailsVO(resourceId, name, value); _clusterDetailsDao.persist(clusterDetailsVO); } else { clusterDetailsVO.setValue(value); _clusterDetailsDao.update(clusterDetailsVO.getId(), clusterDetailsVO);
.findDetails(clusterId); String ovm3vip = (clusterDetails.get("ovm3vip") == null) ? "" : clusterDetails.get("ovm3vip");
_clusterDetailsDao.persist(cluster.getId(), details); return result; details.put("cpuOvercommitRatio", CapacityManager.CpuOverprovisioningFactor.value().toString()); details.put("memoryOvercommitRatio", CapacityManager.MemOverprovisioningFactor.value().toString()); _clusterDetailsDao.persist(cluster.getId(), details); } finally { if (!success) { _clusterDetailsDao.deleteDetails(cluster.getId()); _clusterDao.remove(cluster.getId());
clusterResponse.setCpuOvercommitRatio(cpuOvercommitRatio); clusterResponse.setMemoryOvercommitRatio(memoryOvercommitRatio); clusterResponse.setResourceDetails(_clusterDetailsDao.findDetails(cluster.getId()));
private boolean isOutOfBandManagementEnabledForCluster(Long clusterId) { if (clusterId == null) { return true; } final ClusterDetailsVO clusterDetails = clusterDetailsDao.findDetail(clusterId, OOBM_ENABLED_DETAIL); if (clusterDetails != null && !Strings.isNullOrEmpty(clusterDetails.getValue()) && !Boolean.valueOf(clusterDetails.getValue())) { return false; } return true; }
String srcDcName = _clusterDetailsDao.getVmwareDcName(srcClusterId); String destDcName = _clusterDetailsDao.getVmwareDcName(destPool.getClusterId()); if (srcDcName != null && destDcName != null && !srcDcName.equals(destDcName)) { throw new InvalidParameterValueException("Cannot migrate ROOT volume of a stopped VM to a storage pool in a different VMware datacenter");
@Override @ActionEvent(eventType = EventTypes.EVENT_HOST_OUTOFBAND_MANAGEMENT_ENABLE, eventDescription = "enabling out-of-band management on a cluster") public OutOfBandManagementResponse enableOutOfBandManagement(final Cluster cluster) { clusterDetailsDao.persist(cluster.getId(), OOBM_ENABLED_DETAIL, String.valueOf(true)); return buildEnableDisableResponse(true); }
@Override public float getClusterOverProvisioningFactor(Long clusterId, short capacityType) { String capacityOverProvisioningName = ""; if (capacityType == Capacity.CAPACITY_TYPE_CPU) { capacityOverProvisioningName = "cpuOvercommitRatio"; } else if (capacityType == Capacity.CAPACITY_TYPE_MEMORY) { capacityOverProvisioningName = "memoryOvercommitRatio"; } else { throw new CloudRuntimeException("Invalid capacityType - " + capacityType); } ClusterDetailsVO clusterDetailCpu = _clusterDetailsDao.findDetail(clusterId, capacityOverProvisioningName); Float clusterOverProvisioningRatio = Float.parseFloat(clusterDetailCpu.getValue()); return clusterOverProvisioningRatio; }
@Override @ActionEvent(eventType = EventTypes.EVENT_HA_RESOURCE_DISABLE, eventDescription = "disabling HA for a cluster") public boolean disableHA(final Cluster cluster) { clusterDetailsDao.persist(cluster.getId(), HA_ENABLED_DETAIL, String.valueOf(false)); return transitionResourceStateToDisabled(cluster); }
private boolean isHAEnabledForCluster(final HAResource resource) { if (resource == null || resource.getClusterId() == null) { return true; } final ClusterDetailsVO clusterDetails = clusterDetailsDao.findDetail(resource.getClusterId(), HA_ENABLED_DETAIL); return clusterDetails == null || Strings.isNullOrEmpty(clusterDetails.getValue()) || Boolean.valueOf(clusterDetails.getValue()); }
@Override @ActionEvent(eventType = EventTypes.EVENT_HOST_OUTOFBAND_MANAGEMENT_DISABLE, eventDescription = "disabling out-of-band management on a cluster") public OutOfBandManagementResponse disableOutOfBandManagement(final Cluster cluster) { clusterDetailsDao.persist(cluster.getId(), OOBM_ENABLED_DETAIL, String.valueOf(false)); transitionPowerStateToDisabled(hostDao.findByClusterId(cluster.getId())); return buildEnableDisableResponse(false); }
@Override public boolean getSupportsResigning(long clusterId) { ClusterVO cluster = findById(clusterId); if (cluster == null || cluster.getAllocationState() != Grouping.AllocationState.Enabled) { return false; } ClusterDetailsVO clusterDetailsVO = clusterDetailsDao.findDetail(clusterId, "supportsResign"); if (clusterDetailsVO != null) { String value = clusterDetailsVO.getValue(); return Boolean.parseBoolean(value); } return false; } }
long ram_requested = offering.getRamSize() * 1024L * 1024L; Cluster cluster = _clusterDao.findById(host.getClusterId()); ClusterDetailsVO clusterDetailsCpuOvercommit = _clusterDetailsDao.findDetail(cluster.getId(), "cpuOvercommitRatio"); ClusterDetailsVO clusterDetailsRamOvercommmt = _clusterDetailsDao.findDetail(cluster.getId(), "memoryOvercommitRatio"); Float cpuOvercommitRatio = Float.parseFloat(clusterDetailsCpuOvercommit.getValue()); Float memoryOvercommitRatio = Float.parseFloat(clusterDetailsRamOvercommmt.getValue());
long reservedMem = capacityMemory.getReservedCapacity(); long actualTotalCpu = capacityCpu.getTotalCapacity(); float cpuOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterIdFinal, "cpuOvercommitRatio").getValue()); float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterIdFinal, "memoryOvercommitRatio").getValue()); int vmCPU = svo.getCpu() * svo.getSpeed(); long vmMem = svo.getRamSize() * 1024L * 1024L;
HostVO host = _hostDao.findById(hostId); final long clusterId = host.getClusterId(); final float cpuOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId, "cpuOvercommitRatio").getValue()); final float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId, "memoryOvercommitRatio").getValue());