Search in sources :

Example 6 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class VnicProfileModel method initCustomPropertySheet.

private void initCustomPropertySheet(Version dcCompatibilityVersion) {
    if (!customPropertiesVisible) {
        return;
    }
    GetDeviceCustomPropertiesParameters params = new GetDeviceCustomPropertiesParameters();
    params.setVersion(dcCompatibilityVersion);
    params.setDeviceType(VmDeviceGeneralType.INTERFACE);
    startProgress();
    Frontend.getInstance().runQuery(QueryType.GetDeviceCustomProperties, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
        if (returnValue != null) {
            Map<String, String> customPropertiesList = returnValue.getReturnValue();
            getCustomPropertySheet().setKeyValueMap(customPropertiesList);
            getCustomPropertySheet().setIsChangeable(!customPropertiesList.isEmpty());
            initCustomProperties();
        }
        stopProgress();
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Arrays(java.util.Arrays) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Guid(org.ovirt.engine.core.compat.Guid) GetDeviceCustomPropertiesParameters(org.ovirt.engine.core.common.queries.GetDeviceCustomPropertiesParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) VmDeviceGeneralType(org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) Network(org.ovirt.engine.core.common.businessentities.network.Network) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) NetworkFilter(org.ovirt.engine.core.common.businessentities.network.NetworkFilter) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) VersionQueryParameters(org.ovirt.engine.core.common.action.VersionQueryParameters) NetworkQoSModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkQoSModel) VnicProfileParameters(org.ovirt.engine.core.common.action.VnicProfileParameters) Objects(java.util.Objects) List(java.util.List) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) LengthValidation(org.ovirt.engine.ui.uicommonweb.validation.LengthValidation) GetDeviceCustomPropertiesParameters(org.ovirt.engine.core.common.queries.GetDeviceCustomPropertiesParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Map(java.util.Map)

Example 7 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class VmModelBehaviorBase method updateNumOfSockets.

protected void updateNumOfSockets() {
    Version version = getCompatibilityVersion();
    if (version == null) {
        return;
    }
    AsyncDataProvider.getInstance().getMaxNumOfVmSockets(asyncQuery(returnValue -> {
        maxNumOfSockets = returnValue;
        updataMaxVmsInPool();
    }), version.toString());
}
Also used : UsbPolicy(org.ovirt.engine.core.common.businessentities.UsbPolicy) TemplateWithVersion(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateWithVersion) Arrays(java.util.Arrays) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) VmType(org.ovirt.engine.core.common.businessentities.VmType) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator) Event(org.ovirt.engine.ui.uicompat.Event) ImagesDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.ImagesDataProvider) VmNumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.VmNumaSupportModel) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Map(java.util.Map) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) Version(org.ovirt.engine.core.compat.Version) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) VmNumaNode(org.ovirt.engine.core.common.businessentities.VmNumaNode) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) I18NNameValidation(org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation) StringHelper(org.ovirt.engine.core.compat.StringHelper) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) List(java.util.List) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) LatestVmTemplate(org.ovirt.engine.ui.uicommonweb.models.templates.LatestVmTemplate) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) TimeZoneType(org.ovirt.engine.core.common.TimeZoneType) Guid(org.ovirt.engine.core.compat.Guid) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) HashMap(java.util.HashMap) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ExistingBlankTemplateModelBehavior(org.ovirt.engine.ui.uicommonweb.models.templates.ExistingBlankTemplateModelBehavior) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) HashSet(java.util.HashSet) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Frontend(org.ovirt.engine.ui.frontend.Frontend) NumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.NumaSupportModel) InstanceTypeManager(org.ovirt.engine.ui.uicommonweb.models.vms.instancetypes.InstanceTypeManager) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) Quota(org.ovirt.engine.core.common.businessentities.Quota) VmCommonUtils(org.ovirt.engine.core.common.utils.VmCommonUtils) VM(org.ovirt.engine.core.common.businessentities.VM) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) MigrationSupport(org.ovirt.engine.core.common.businessentities.MigrationSupport) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) TemplateWithVersion(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateWithVersion) Version(org.ovirt.engine.core.compat.Version)

Example 8 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class ClusterVersionChangeValidation method validate.

@Override
public ValidationResult validate(Object value) {
    ValidationResult result = new ValidationResult();
    Version newClusterVersion = (Version) value;
    if (value == null || (hasActiveVm && !newClusterVersion.equals(oldClusterVersion))) {
        result.setSuccess(false);
        result.getReasons().add(ConstantsManager.getInstance().getConstants().cannotClusterVersionChangeWithActiveVm());
    }
    return result;
}
Also used : Version(org.ovirt.engine.core.compat.Version)

Example 9 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class ClusterPopupPresenterWidget method init.

@Override
public void init(final ClusterModel model) {
    super.init(model);
    model.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        String propName = args.propertyName;
        if ("AllowClusterWithVirtGlusterEnabled".equals(propName)) {
            // $NON-NLS-1$
            getView().allowClusterWithVirtGlusterEnabled(model.getAllowClusterWithVirtGlusterEnabled());
        }
    });
    String spiceProxyInConfig = (String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.SpiceProxyDefault);
    String spiceProxyMessage = StringHelper.isNullOrEmpty(spiceProxyInConfig) ? messages.noSpiceProxyDefined() : spiceProxyInConfig;
    getView().setSpiceProxyOverrideExplanation(messages.consoleOverrideSpiceProxyMessage(messages.consoleOverrideDefinedInGlobalConfig(), spiceProxyMessage));
    getModel().getVersion().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
        final Version selectedVersion = getModel().getVersion().getSelectedItem();
        if (selectedVersion == null) {
            return;
        }
        if (AsyncDataProvider.getInstance().isMigrationPoliciesSupported(selectedVersion)) {
            getView().getMigrationBandwidthLimitTypeEditor().setEnabled(true);
            updateCustomMigrationBandwidthLimitEnabledState(model, null);
        } else {
            final String supportedVersions = String.join(", ", // $NON-NLS-1$
            AsyncDataProvider.getInstance().getMigrationPoliciesSupportedVersions());
            final String message = messages.onlyAvailableInCompatibilityVersions(supportedVersions);
            getView().getMigrationBandwidthLimitTypeEditor().disable(message);
            getView().getMigrationBandwidthLimitTypeEditor().setEnabled(false);
            updateCustomMigrationBandwidthLimitEnabledState(model, message);
        }
    });
    getModel().getMigrationBandwidthLimitType().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updateCustomMigrationBandwidthLimitEnabledState(model, null));
    model.getMacPoolModel().getEntityChangedEvent().addListener((ev, sender, args) -> getView().updateMacPool(model.getMacPoolModel()));
    final UICommand addMacPoolCommand = model.getAddMacPoolCommand();
    if (addMacPoolCommand == null) {
        getView().makeMacPoolButtonInvisible();
    } else {
        getView().getMacPoolButton().setCommand(addMacPoolCommand);
        registerHandler(getView().getMacPoolButton().addClickHandler(event -> getView().getMacPoolButton().getCommand().execute(model)));
    }
}
Also used : ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) AbstractTabbedModelBoundPopupPresenterWidget(org.ovirt.engine.ui.common.presenter.AbstractTabbedModelBoundPopupPresenterWidget) MacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.MacPoolModel) EventBus(com.google.gwt.event.shared.EventBus) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) HasUiCommandClickHandlers(org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Inject(com.google.inject.Inject) MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) ApplicationMessages(org.ovirt.engine.ui.webadmin.ApplicationMessages) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) StringHelper(org.ovirt.engine.core.compat.StringHelper) Optional(java.util.Optional) HasEnabledWithHints(org.ovirt.engine.ui.common.widget.HasEnabledWithHints) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Version(org.ovirt.engine.core.compat.Version) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 10 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class AddVmCommand method validate.

@Override
protected boolean validate() {
    if (getCluster() == null) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY);
    }
    if (getVmTemplate() == null) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST);
    }
    if (getVmTemplate().isDisabled()) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED);
    }
    StoragePoolValidator spValidator = new StoragePoolValidator(getStoragePool());
    if (!validate(spValidator.exists())) {
        return false;
    }
    if (!isExternalVM() && !validate(spValidator.isInStatus(StoragePoolStatus.Up))) {
        return false;
    }
    if (!isTemplateInValidDc()) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC);
    }
    if (!isDisksVolumeFormatValid()) {
        return false;
    }
    Version customCompatibilityVersionFromParams = getParameters().getVmStaticData().getCustomCompatibilityVersion();
    if (customCompatibilityVersionFromParams != null && !isCompatibilityVersionSupportedByCluster(customCompatibilityVersionFromParams)) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_CUSTOM_COMPATIBILITY_VERSION_NOT_SUPPORTED, String.format("$Ccv %s", customCompatibilityVersionFromParams));
    }
    // A VM cannot be added in a cluster without a defined architecture
    if (getCluster().getArchitecture() == ArchitectureType.undefined) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_CLUSTER_UNDEFINED_ARCHITECTURE);
    }
    if (verifySourceDomains() && buildAndCheckDestStorageDomains()) {
        chooseDisksSourceDomains();
    } else {
        return false;
    }
    if (getParameters().getVmStaticData().getVmType() == VmType.HighPerformance && !FeatureSupported.isHighPerformanceTypeSupported(getEffectiveCompatibilityVersion())) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_HIGH_PERFORMANCE_IS_NOT_SUPPORTED, String.format("$Version %s", getEffectiveCompatibilityVersion()));
    }
    if (isBalloonEnabled() && !osRepository.isBalloonEnabled(getParameters().getVmStaticData().getOsId(), getEffectiveCompatibilityVersion())) {
        addValidationMessageVariable("clusterArch", getCluster().getArchitecture());
        return failValidation(EngineMessage.BALLOON_REQUESTED_ON_NOT_SUPPORTED_ARCH);
    }
    if (isSoundDeviceEnabled() && !osRepository.isSoundDeviceEnabled(getParameters().getVmStaticData().getOsId(), getEffectiveCompatibilityVersion())) {
        addValidationMessageVariable("clusterArch", getCluster().getArchitecture());
        return failValidation(EngineMessage.SOUND_DEVICE_REQUESTED_ON_NOT_SUPPORTED_ARCH);
    }
    if (!validateQuota(getParameters().getVmStaticData().getQuotaId())) {
        return false;
    }
    // otherwise..
    storageToDisksMap = ImagesHandler.buildStorageToDiskMap(getImagesToCheckDestinationStorageDomains(), diskInfoDestinationMap);
    if (!validateAddVmCommand()) {
        return false;
    }
    VM vmFromParams = getParameters().getVm();
    // check if the selected template is compatible with Cluster architecture.
    if (!getVmTemplate().getId().equals(VmTemplateHandler.BLANK_VM_TEMPLATE_ID) && getCluster().getArchitecture() != getVmTemplate().getClusterArch()) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_TEMPLATE_IS_INCOMPATIBLE);
    }
    if (StringUtils.isEmpty(vmFromParams.getName())) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_NAME_MAY_NOT_BE_EMPTY);
    }
    // check that VM name is not too long
    if (!isVmNameValidLength(vmFromParams)) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG);
    }
    // check for Vm Payload
    if (getParameters().getVmPayload() != null) {
        if (!checkPayload(getParameters().getVmPayload())) {
            return false;
        }
        // otherwise, we save the content in base64 string
        for (Map.Entry<String, String> entry : getParameters().getVmPayload().getFiles().entrySet()) {
            entry.setValue(new String(BASE_64.encode(entry.getValue().getBytes()), StandardCharsets.UTF_8));
        }
    }
    // check for Vm Watchdog Model
    if (getParameters().getWatchdog() != null) {
        if (!validate(new VmWatchdogValidator(vmFromParams.getOs(), getParameters().getWatchdog(), getEffectiveCompatibilityVersion()).isValid())) {
            return false;
        }
    }
    // check if the OS type is supported
    if (!validate(vmHandler.isOsTypeSupported(vmFromParams.getOs(), getCluster().getArchitecture()))) {
        return false;
    }
    if (!validate(vmHandler.isCpuSupported(vmFromParams.getVmOsId(), getEffectiveCompatibilityVersion(), getCluster().getCpuName()))) {
        return false;
    }
    // Check if the graphics and display from parameters are supported
    if (!validate(vmHandler.isGraphicsAndDisplaySupported(getParameters().getVmStaticData().getOsId(), vmHandler.getResultingVmGraphics(getVmDeviceUtils().getGraphicsTypesOfEntity(getVmTemplateId()), getParameters().getGraphicsDevices()), vmFromParams.getDefaultDisplayType(), getEffectiveCompatibilityVersion()))) {
        return false;
    }
    if (!validate(vmHandler.validateSmartCardDevice(getParameters().getVmStaticData()))) {
        return false;
    }
    if (!FeatureSupported.isMigrationSupported(getCluster().getArchitecture(), getEffectiveCompatibilityVersion()) && vmFromParams.getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) {
        return failValidation(EngineMessage.VM_MIGRATION_IS_NOT_SUPPORTED);
    }
    // check cpuPinning if the check haven't failed yet
    if (!validate(isCpuPinningValid(vmFromParams.getCpuPinning(), vmFromParams.getStaticData()))) {
        return false;
    }
    if (vmFromParams.isUseHostCpuFlags() && vmFromParams.getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) {
        return failValidation(EngineMessage.VM_HOSTCPU_MUST_BE_PINNED_TO_HOST);
    }
    if (vmFromParams.isUseHostCpuFlags() && (ArchitectureType.ppc == getCluster().getArchitecture().getFamily())) {
        return failValidation(EngineMessage.USE_HOST_CPU_REQUESTED_ON_UNSUPPORTED_ARCH);
    }
    if (!validateMemoryAlignment(getParameters().getVmStaticData())) {
        return false;
    }
    if (getInstanceTypeId() != null && getInstanceType() == null) {
        // invalid instance type
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST);
    }
    if (imageTypeId != null && getImageType() == null) {
        // invalid image type
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST);
    }
    if (!validate(VmValidator.validateCpuSockets(getParameters().getVmStaticData(), getEffectiveCompatibilityVersion()))) {
        return false;
    }
    if (!isCpuSharesValid(vmFromParams)) {
        return failValidation(EngineMessage.QOS_CPU_SHARES_OUT_OF_RANGE);
    }
    if (!VmCpuCountHelper.validateCpuCounts(vmFromParams)) {
        return failValidation(EngineMessage.TOO_MANY_CPU_COMPONENTS);
    }
    if (Boolean.TRUE.equals(getParameters().isVirtioScsiEnabled())) {
        // Verify OS compatibility
        if (!validate(vmHandler.isOsTypeSupportedForVirtioScsi(vmFromParams.getOs(), getEffectiveCompatibilityVersion()))) {
            return false;
        }
    }
    if (vmFromParams.getMinAllocatedMem() > vmFromParams.getMemSizeMb()) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_MIN_MEMORY_CANNOT_EXCEED_MEMORY_SIZE);
    }
    if (!setAndValidateDiskProfiles()) {
        return false;
    }
    if (!setAndValidateCpuProfile()) {
        return false;
    }
    if (getVmId() != null && vmStaticDao.get(getVmId()) != null) {
        return failValidation(EngineMessage.VM_ID_EXISTS);
    }
    List<CinderDisk> cinderDisks = DisksFilter.filterCinderDisks(diskInfoDestinationMap.values());
    CinderDisksValidator cinderDisksValidator = new CinderDisksValidator(cinderDisks);
    if (!validate(cinderDisksValidator.validateCinderDiskLimits())) {
        return false;
    }
    if (getParameters().getVmLargeIcon() != null && !validate(IconValidator.validate(IconValidator.DimensionsType.LARGE_CUSTOM_ICON, getParameters().getVmLargeIcon()))) {
        return false;
    }
    if (getSmallIconId() != null && // icon id is ignored if large icon is sent
    getParameters().getVmLargeIcon() == null && !validate(IconValidator.validateIconId(getSmallIconId(), "Small"))) {
        return false;
    }
    if (getLargeIconId() != null && // icon id is ignored if large icon is sent
    getParameters().getVmLargeIcon() == null && !validate(IconValidator.validateIconId(getLargeIconId(), "Large"))) {
        return false;
    }
    if (!validate(getNumaValidator().checkVmNumaNodesIntegrity(getParameters().getVm(), getParameters().getVm().getvNumaNodeList()))) {
        return false;
    }
    if (getCluster().isInUpgradeMode()) {
        getParameters().getVm().setClusterCompatibilityVersion(getCluster().getCompatibilityVersion());
        if (!validate(getClusterUpgradeValidator().isVmReadyForUpgrade(getParameters().getVm()))) {
            return false;
        }
    }
    if (!validate(vmHandler.validateMaxMemorySize(getParameters().getVmStaticData(), getEffectiveCompatibilityVersion()))) {
        return false;
    }
    if (shouldAddLease(getParameters().getVmStaticData()) && !canAddLease()) {
        return false;
    }
    List<EngineMessage> msgs = openStackMetadataAdapter.validate(getParameters().getVmStaticData().getVmInit());
    if (!CollectionUtils.isEmpty(msgs)) {
        return failValidation(msgs);
    }
    return true;
}
Also used : StoragePoolValidator(org.ovirt.engine.core.bll.validator.storage.StoragePoolValidator) VmWatchdogValidator(org.ovirt.engine.core.bll.validator.VmWatchdogValidator) Version(org.ovirt.engine.core.compat.Version) VM(org.ovirt.engine.core.common.businessentities.VM) CinderDisksValidator(org.ovirt.engine.core.bll.validator.storage.CinderDisksValidator) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) Map(java.util.Map) HashMap(java.util.HashMap) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage)

Aggregations

Version (org.ovirt.engine.core.compat.Version)102 ArrayList (java.util.ArrayList)24 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)20 Guid (org.ovirt.engine.core.compat.Guid)20 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)17 Map (java.util.Map)16 List (java.util.List)15 HashSet (java.util.HashSet)14 VDS (org.ovirt.engine.core.common.businessentities.VDS)14 HashMap (java.util.HashMap)13 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)12 VM (org.ovirt.engine.core.common.businessentities.VM)11 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)11 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)11 Arrays (java.util.Arrays)10 MigrationPolicy (org.ovirt.engine.core.common.migration.MigrationPolicy)10 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)10 Collection (java.util.Collection)9 Collections (java.util.Collections)9 ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)9