Search in sources :

Example 86 with Cluster

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));
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) BackendLocal(org.ovirt.engine.core.common.interfaces.BackendLocal) EngineContext(org.ovirt.engine.core.bll.context.EngineContext) VmDao(org.ovirt.engine.core.dao.VmDao) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) StreamSupport.stream(java.util.stream.StreamSupport.stream) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Nameable(org.ovirt.engine.core.common.businessentities.Nameable) VdsDao(org.ovirt.engine.core.dao.VdsDao) ClusterEditWarnings(org.ovirt.engine.core.common.businessentities.ClusterEditWarnings) Any(javax.enterprise.inject.Any) ClusterEditParameters(org.ovirt.engine.core.common.queries.ClusterEditParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) Instance(javax.enterprise.inject.Instance) ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ClusterEditWarnings(org.ovirt.engine.core.common.businessentities.ClusterEditWarnings)

Example 87 with Cluster

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();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid)

Example 88 with Cluster

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);
    }
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkInSyncWithVdsNetworkInterface(org.ovirt.engine.core.utils.NetworkInSyncWithVdsNetworkInterface) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 89 with 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());
}
Also used : SchedulingUnit(org.ovirt.engine.core.bll.scheduling.SchedulingUnit) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) Collectors(java.util.stream.Collectors) PolicyUnitType(org.ovirt.engine.core.common.scheduling.PolicyUnitType) NumberUtils(org.apache.commons.lang.math.NumberUtils) List(java.util.List) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit) PendingResourceManager(org.ovirt.engine.core.bll.scheduling.pending.PendingResourceManager) Map(java.util.Map) VDS(org.ovirt.engine.core.common.businessentities.VDS) PolicyUnitParameter(org.ovirt.engine.core.bll.scheduling.PolicyUnitParameter) Config(org.ovirt.engine.core.common.config.Config) VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 90 with Cluster

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;
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Aggregations

Cluster (org.ovirt.engine.core.common.businessentities.Cluster)346 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)80 Guid (org.ovirt.engine.core.compat.Guid)77 VDS (org.ovirt.engine.core.common.businessentities.VDS)54 List (java.util.List)50 VM (org.ovirt.engine.core.common.businessentities.VM)36 HashMap (java.util.HashMap)35 Map (java.util.Map)33 HashSet (java.util.HashSet)30 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)30 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)28 Version (org.ovirt.engine.core.compat.Version)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)26 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)26 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)25 Set (java.util.Set)24 QueryType (org.ovirt.engine.core.common.queries.QueryType)23 Collections (java.util.Collections)22 Frontend (org.ovirt.engine.ui.frontend.Frontend)22