use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class GetClusterEditWarningsQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
final Cluster oldCluster = backend.runQuery(QueryType.GetClusterById, getParameters()).getReturnValue();
Cluster newCluster = getParameters().getNewCluster();
List<ClusterEditWarnings.Warning> hostWarnings = getProblematicEntities(oldCluster, newCluster, hostCheckers, cluster -> vdsDao.getAllForCluster(cluster.getId()));
List<ClusterEditWarnings.Warning> vmWarnings = new ArrayList<>();
if (oldCluster.supportsVirtService() && newCluster.supportsVirtService()) {
vmWarnings = getProblematicEntities(oldCluster, newCluster, vmCheckers, cluster -> vmDao.getAllForCluster(cluster.getId()));
}
setReturnValue(new ClusterEditWarnings(hostWarnings, vmWarnings));
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class UpdateFenceAgentCommand method validate.
@Override
protected boolean validate() {
if (getParameters() != null && getParameters().getAgent() != null && getParameters().getAgent().getHostId() != null && getParameters().getAgent().getType() != null) {
Guid vdsId = getParameters().getAgent().getHostId();
VDS vds = vdsDao.get(vdsId);
if (vds == null) {
return failValidation(EngineMessage.VDS_INVALID_SERVER_ID);
}
Guid vdsClusterId = vds.getClusterId();
Cluster cluster = clusterDao.get(vdsClusterId);
String clusterCompatibilityVersion = cluster.getCompatibilityVersion().toString();
if (!FenceConfigHelper.getValidFenceAgentTypes(clusterCompatibilityVersion).contains(getParameters().getAgent().getType())) {
return failValidation(EngineMessage.ACTION_TYPE_FAILED_AGENT_NOT_SUPPORTED);
}
if (!validatePMAgentPort()) {
return failValidation(EngineMessage.VDS_ILLEGAL_PM_AGENT_PORT_VALUE);
}
}
return super.validate();
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ReportedConfigurationsFiller method fillReportedConfigurations.
public void fillReportedConfigurations(List<VdsNetworkInterface> allInterfacesForHost, BusinessEntityMap<Network> networkMap, List<NetworkAttachment> networkAttachments, DnsResolverConfiguration reportedDnsResolverConfiguration, Guid clusterId) {
Cluster cluster = clusterDao.get(clusterId);
Map<String, VdsNetworkInterface> networkNameToNicMap = nicsByNetworkId(allInterfacesForHost);
for (NetworkAttachment networkAttachment : networkAttachments) {
fillReportedConfigurations(networkNameToNicMap, networkMap, networkAttachment, reportedDnsResolverConfiguration, cluster);
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class EvenGuestDistributionBalancePolicyUnit method getPrimarySources.
@Override
protected List<VDS> getPrimarySources(Cluster cluster, List<VDS> candidateHosts, final Map<String, String> parameters) {
final int highVmCountUtilization = NumberUtils.toInt(parameters.get(PolicyUnitParameter.HIGH_VM_COUNT.getDbName()), highVmCountDefault);
final VDS worstVDS = getWorstVDS(candidateHosts, parameters);
final int worstVdsOccupiedVmSlots = getOccupiedVmSlots(worstVDS, parameters);
if (worstVdsOccupiedVmSlots < highVmCountUtilization) {
log.info("There is no host with more than {} running guests, no balancing is needed", highVmCountUtilization);
return null;
}
return candidateHosts.stream().filter(p -> getOccupiedVmSlots(p, parameters) >= worstVdsOccupiedVmSlots).collect(Collectors.toList());
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class AddClusterCommandTest method createCluster.
private static Cluster createCluster() {
Cluster cluster = new Cluster();
cluster.setName(CLUSTER_NAME);
cluster.setDescription(CLUSTER_DESCRIPTION);
cluster.setStoragePoolId(DATA_CENTER_ID);
cluster.setCpuName(CPU_NAME);
cluster.setMaxVdsMemoryOverCommit(MAX_VDS_MEMORY_OVER_COMMIT);
cluster.setCountThreadsAsCores(COUNT_THREADS_AS_CORES);
cluster.setTransparentHugepages(SET_TRANSPARENT_HUGE_PAGES);
cluster.setCompatibilityVersion(SET_COMPATIBILITY_VERSION);
cluster.setMigrateOnError(MIGRATE_ON_ERROR);
cluster.setArchitecture(ARCHITECTURE_TYPE);
return cluster;
}
Aggregations