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