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);
}
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());
}
}
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);
}
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;
}
}
}
Aggregations