Search in sources :

Example 11 with SupportedAdditionalClusterFeature

use of org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature in project ovirt-engine by oVirt.

the class VmInfoBuildUtilsTest method getSupportedAdditionalClusterFeatures.

private Set<SupportedAdditionalClusterFeature> getSupportedAdditionalClusterFeatures(Boolean enabled) {
    SupportedAdditionalClusterFeature clusterFeature = new SupportedAdditionalClusterFeature();
    AdditionalFeature feature = new AdditionalFeature(Guid.newGuid(), VmInfoBuildUtils.VDSM_LIBGF_CAP_NAME, Version.v4_1, null, null);
    clusterFeature.setFeature(feature);
    clusterFeature.setEnabled(enabled);
    return Collections.singleton(clusterFeature);
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature)

Example 12 with SupportedAdditionalClusterFeature

use of org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature in project ovirt-engine by oVirt.

the class UpdateClusterCommand method addOrUpdateAddtionalClusterFeatures.

private void addOrUpdateAddtionalClusterFeatures() {
    Set<SupportedAdditionalClusterFeature> featuresInDb = clusterFeatureDao.getSupportedFeaturesByClusterId(getCluster().getId());
    Map<Guid, SupportedAdditionalClusterFeature> featuresEnabled = new HashMap<>();
    for (SupportedAdditionalClusterFeature feature : getCluster().getAddtionalFeaturesSupported()) {
        featuresEnabled.put(feature.getFeature().getId(), feature);
    }
    for (SupportedAdditionalClusterFeature featureInDb : featuresInDb) {
        if (featureInDb.isEnabled() && !featuresEnabled.containsKey(featureInDb.getFeature().getId())) {
            // Disable the features which are not selected in update cluster
            featureInDb.setEnabled(false);
            clusterFeatureDao.updateSupportedClusterFeature(featureInDb);
        } else if (!featureInDb.isEnabled() && featuresEnabled.containsKey(featureInDb.getFeature().getId())) {
            // Enable the features which are selected in update cluster
            featureInDb.setEnabled(true);
            clusterFeatureDao.updateSupportedClusterFeature(featureInDb);
        }
        featuresEnabled.remove(featureInDb.getFeature().getId());
    }
    // Add the newly add cluster features
    if (CollectionUtils.isNotEmpty(featuresEnabled.values())) {
        clusterFeatureDao.addAllSupportedClusterFeature(featuresEnabled.values());
    }
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid)

Example 13 with SupportedAdditionalClusterFeature

use of org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature in project ovirt-engine by oVirt.

the class AddClusterCommand method executeCommand.

@Override
protected void executeCommand() {
    Cluster cluster = getCluster();
    cluster.setArchitecture(getArchitecture());
    setDefaultSwitchTypeIfNeeded();
    setDefaultFirewallTypeIfNeeded();
    checkMaxMemoryOverCommitValue();
    cluster.setDetectEmulatedMachine(true);
    cluster.setMacPoolId(calculateMacPoolIdToUse());
    clusterDao.save(cluster);
    alertIfFencingDisabled();
    // add default network
    if (getParameters().getCluster().getStoragePoolId() != null) {
        attachManagementNetwork();
    }
    // create default CPU profile for supported clusters.
    addDefaultCpuProfile();
    if (CollectionUtils.isNotEmpty(cluster.getAddtionalFeaturesSupported())) {
        for (SupportedAdditionalClusterFeature feature : cluster.getAddtionalFeaturesSupported()) {
            feature.setClusterId(cluster.getId());
        }
        clusterFeatureDao.addAllSupportedClusterFeature(cluster.getAddtionalFeaturesSupported());
    }
    setActionReturnValue(cluster.getId());
    setSucceeded(true);
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 14 with SupportedAdditionalClusterFeature

use of org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature in project ovirt-engine by oVirt.

the class HandleVdsVersionCommand method checkClusterAdditionalFeaturesSupported.

private void checkClusterAdditionalFeaturesSupported(Cluster cluster, VDS vds) {
    Set<SupportedAdditionalClusterFeature> clusterSupportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId());
    Set<String> hostSupportedFeatures = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId());
    for (SupportedAdditionalClusterFeature feature : clusterSupportedFeatures) {
        if (feature.isEnabled() && !hostSupportedFeatures.contains(feature.getFeature().getName())) {
            Map<String, String> customLogValues = new HashMap<>();
            customLogValues.put("UnSupportedFeature", feature.getFeature().getName());
            reportNonOperationReason(NonOperationalReason.HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues);
            return;
        }
    }
}
Also used : SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature) HashMap(java.util.HashMap)

Aggregations

SupportedAdditionalClusterFeature (org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature)14 AdditionalFeature (org.ovirt.engine.core.common.businessentities.AdditionalFeature)6 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 HashMap (java.util.HashMap)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 Guid (org.ovirt.engine.core.compat.Guid)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Test (org.junit.Test)1 ClusterFeatures (org.ovirt.engine.api.model.ClusterFeatures)1