Search in sources :

Example 16 with Version

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

the class AsyncDataProvider method initMigrationPolicies.

private void initMigrationPolicies() {
    AsyncQuery<Map<Version, List<MigrationPolicy>>> aQuery = new AsyncQuery<>(returnValue -> migrationPoliciesByVersion = returnValue);
    aQuery.converterCallback = returnValue -> {
        if (returnValue == null) {
            return new HashMap<>();
        }
        Map<Version, List<MigrationPolicy>> policiesByVersion = (Map<Version, List<MigrationPolicy>>) returnValue;
        for (List<MigrationPolicy> policies : policiesByVersion.values()) {
            Collections.sort(policies, Comparator.comparing((MigrationPolicy m) -> !NoMigrationPolicy.ID.equals(m.getId())).thenComparing(MigrationPolicy::getName));
        }
        return policiesByVersion;
    };
    Frontend.getInstance().runQuery(QueryType.GetAllMigrationPolicies, new QueryParametersBase(), aQuery);
}
Also used : HashMap(java.util.HashMap) Version(org.ovirt.engine.core.compat.Version) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) StorageServerConnectionQueryParametersBase(org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase) ArrayList(java.util.ArrayList) List(java.util.List) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) Map(java.util.Map) HashMap(java.util.HashMap)

Example 17 with Version

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

the class HostConfigureLocalStoragePopupView method initialize.

private void initialize() {
    dataCenterVersionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Version>() {

        @Override
        public String renderNullSafe(Version object) {
            return object.getValue();
        }
    });
    clusterCpuTypeEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<ServerCpu>() {

        @Override
        public String renderNullSafe(ServerCpu object) {
            return object.getCpuName();
        }
    });
    // Optimization options.
    // $NON-NLS-1$
    optimizationNoneEditor = new EntityModelRadioButtonEditor("1");
    // $NON-NLS-1$
    optimizationForServerEditor = new EntityModelRadioButtonEditor("1");
    // $NON-NLS-1$
    optimizationForDesktopEditor = new EntityModelRadioButtonEditor("1");
    // $NON-NLS-1$
    optimizationCustomEditor = new EntityModelRadioButtonEditor("1");
    optimizationCustomEditor.setVisible(false);
    countThreadsAsCoresEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    memoryOptimizationInfo = new InfoIcon(templates.italicText(constants.clusterPopupMemoryOptimizationInfo()));
    memoryOptimizationInfo.setTooltipMaxWidth(TooltipWidth.W520);
    cpuThreadsInfo = new InfoIcon(templates.italicText(constants.clusterPopupCpuThreadsInfo()));
    cpuThreadsInfo.setTooltipMaxWidth(TooltipWidth.W620);
}
Also used : Version(org.ovirt.engine.core.compat.Version) InfoIcon(org.ovirt.engine.ui.common.widget.dialog.InfoIcon) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)

Example 18 with Version

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

the class GetVGInfoVDSCommand method executeVdsBrokerCommand.

@SuppressWarnings("unchecked")
@Override
protected void executeVdsBrokerCommand() {
    _result = getBroker().getVGInfo(getParameters().getVGID());
    proceedProxyReturnValue();
    // build temp data
    String vgName = (String) _result.vgInfo.get("name");
    Object[] temp = (Object[]) _result.vgInfo.get("pvlist");
    Map<String, Object>[] pvList = new Map[0];
    if (temp != null) {
        pvList = new Map[temp.length];
        for (int i = 0; i < temp.length; i++) {
            pvList[i] = (Map<String, Object>) temp[i];
            pvList[i].put("vgName", vgName);
        }
    }
    Version compatibilityVersion = storagePoolDao.getForVds(getParameters().getVdsId()).getCompatibilityVersion();
    setReturnValue(GetDeviceListVDSCommand.parseLUNList(pvList, compatibilityVersion));
}
Also used : Version(org.ovirt.engine.core.compat.Version) Map(java.util.Map)

Example 19 with Version

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

the class GetDeviceListVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    int storageType = getParameters().getStorageType().getValue();
    Set<String> lunsIdList = getParameters().getLunIds();
    String[] lunsIdArray = lunsIdList != null ? lunsIdList.toArray(new String[lunsIdList.size()]) : null;
    _result = getBroker().getDeviceList(storageType, lunsIdArray, getParameters().isCheckStatus());
    proceedProxyReturnValue();
    Version compatibilityVersion = storagePoolDao.getForVds(getParameters().getVdsId()).getCompatibilityVersion();
    setReturnValue(parseLUNList(_result.lunList, compatibilityVersion));
}
Also used : Version(org.ovirt.engine.core.compat.Version)

Example 20 with Version

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

the class DataCenterListModel method onSave.

public void onSave() {
    final DataCenterModel dcModel = (DataCenterModel) getWindow();
    if (!dcModel.validate()) {
        return;
    }
    if ((dcModel.getIsNew() || dcModel.getEntity() == null) && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
        promptNoQuotaInDCMessage();
    } else if (!dcModel.getIsNew() && getSelectedItem() != null && !dcModel.getVersion().getSelectedItem().equals(getSelectedItem().getCompatibilityVersion())) {
        final ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().changeDataCenterCompatibilityVersionTitle());
        confirmModel.setHelpTag(HelpTag.change_data_center_compatibility_version);
        // $NON-NLS-1$
        confirmModel.setHashName("change_data_center_compatibility_version");
        final StoragePool sp = getSelectedItem();
        startProgress();
        IdQueryParameters params = new IdQueryParameters(sp.getId());
        Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
            List<StorageDomain> storages = returnValue.getReturnValue();
            StorageDomain storage = null;
            for (StorageDomain sd : storages) {
                if (sd.getStorageDomainType().isDataDomain()) {
                    storage = sd;
                }
            }
            StorageFormatType newFormat = null;
            StorageFormatType oldFormat = null;
            if (storage != null) {
                newFormat = VersionStorageFormatUtil.getForVersion(dcModel.getVersion().getSelectedItem());
                oldFormat = VersionStorageFormatUtil.getForVersion(sp.getCompatibilityVersion());
            }
            if (newFormat == oldFormat) {
                confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutChangeDcCompatibilityVersionMsg());
            } else {
                Version v = VersionStorageFormatUtil.getEarliestVersionSupported(newFormat);
                confirmModel.setMessage(ConstantsManager.getInstance().getMessages().youAreAboutChangeDcCompatibilityVersionWithUpgradeMsg(v.getValue()));
            }
            stopProgress();
        }));
        // $NON-NLS-1$
        UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSaveInternal", this);
        confirmModel.getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
        confirmModel.getCommands().add(tempVar2);
    } else if (getSelectedItem() != null && getSelectedItem().getQuotaEnforcementType() != QuotaEnforcementTypeEnum.HARD_ENFORCEMENT && dcModel.getQuotaEnforceTypeListModel().getSelectedItem() == QuotaEnforcementTypeEnum.HARD_ENFORCEMENT) {
        checkForQuotaInDC(dcModel.getEntity(), this);
    } else if (dcModel.getIsNew()) {
        // New data center, check for name uniqueness.
        validateDataCenterName(dcModel);
    } else {
        onSaveInternal();
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Version(org.ovirt.engine.core.compat.Version) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

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