use of org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel in project ovirt-engine by oVirt.
the class PoolListModel method displayHighPerformanceConfirmationPopup.
protected void displayHighPerformanceConfirmationPopup() {
final PoolModel model = (PoolModel) getWindow();
if (model == null || model.getProgress() != null) {
return;
}
VmHighPerformanceConfigurationModel confirmModel = new VmHighPerformanceConfigurationModel();
// Handle CPU Pinning topology
final boolean isVmAssignedToSpecificHosts = !model.getIsAutoAssign().getEntity();
final boolean isVmCpuPinningSet = model.getCpuPinning().getIsChangable() && model.getCpuPinning().getEntity() != null && !model.getCpuPinning().getEntity().isEmpty();
confirmModel.addRecommendationForCpuPinning(isVmAssignedToSpecificHosts, isVmCpuPinningSet);
// Handle Huge Pages
KeyValueModel keyValue = model.getCustomPropertySheet();
// $NON-NLS-1$
final boolean isVmHugePagesSet = keyValue != null && keyValue.getUsedKeys().contains("hugepages");
confirmModel.addRecommendationForHugePages(isVmHugePagesSet);
// Handle KSM (Kernel Same Page Merging)
confirmModel.addRecommendationForKsm(model.getSelectedCluster().isEnableKsm(), model.getSelectedCluster().getName());
if (!confirmModel.getRecommendationsList().isEmpty()) {
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().configurationChangesForHighPerformancePoolTitle());
confirmModel.setHelpTag(HelpTag.configuration_changes_for_high_performance_pool);
// $NON-NLS-1$
confirmModel.setHashName("configuration_changes_for_high_performance_pool");
confirmModel.getCommands().add(// $NON-NLS-1$
new UICommand("OnSave_Phase2", PoolListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
confirmModel.getCommands().add(// $NON-NLS-1$
UICommand.createCancelUiCommand("CancelConfirmation", PoolListModel.this));
setConfirmWindow(null);
setConfirmWindow(confirmModel);
} else {
savePoolPostValidation();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel in project ovirt-engine by oVirt.
the class TemplateModule method getTemplateListProvider.
// Main List Model
@Provides
@Singleton
public MainModelProvider<VmTemplate, TemplateListModel> getTemplateListProvider(EventBus eventBus, final Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<TemplateEditPresenterWidget> popupProvider, final Provider<VmExportPopupPresenterWidget> exportPopupProvider, final Provider<VmPopupPresenterWidget> createVmPopupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<TemplateListModel> modelProvider, final Provider<VmDiskPopupPresenterWidget> newDiskPopupProvider, final Provider<SingleSelectionVmDiskAttachPopupPresenterWidget> attachDiskPopupProvider, final Provider<VmHighPerformanceConfigurationPresenterWidget> highPerformanceConfigurationProvider) {
MainViewModelProvider<VmTemplate, TemplateListModel> result = new MainViewModelProvider<VmTemplate, TemplateListModel>(eventBus, defaultConfirmPopupProvider) {
@Override
public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(TemplateListModel source, UICommand lastExecutedCommand, Model windowModel) {
TemplateListModel model = getModel();
if (lastExecutedCommand == model.getEditCommand()) {
return popupProvider.get();
} else if (lastExecutedCommand == getModel().getExportCommand()) {
return exportPopupProvider.get();
} else if (lastExecutedCommand == getModel().getCreateVmFromTemplateCommand()) {
if (windowModel instanceof AttachDiskModel) {
return attachDiskPopupProvider.get();
} else if ((windowModel instanceof NewDiskModel) || (windowModel instanceof EditDiskModel)) {
return newDiskPopupProvider.get();
} else {
return createVmPopupProvider.get();
}
} else {
return super.getModelPopup(source, lastExecutedCommand, windowModel);
}
}
@Override
public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(TemplateListModel source, UICommand lastExecutedCommand) {
if (lastExecutedCommand == getModel().getRemoveCommand()) {
return removeConfirmPopupProvider.get();
} else if ("OnSave".equals(lastExecutedCommand.getName())) {
// $NON-NLS-1$
return defaultConfirmPopupProvider.get();
} else if (// $NON-NLS-1$
"OnSaveVm".equals(lastExecutedCommand.getName()) && source.getConfirmWindow() instanceof VmHighPerformanceConfigurationModel) {
return highPerformanceConfigurationProvider.get();
} else {
return super.getConfirmModelPopup(source, lastExecutedCommand);
}
}
};
result.setModelProvider(modelProvider);
return result;
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel in project ovirt-engine by oVirt.
the class VmBaseListModel method displayHighPerformanceConfirmationPopup.
protected void displayHighPerformanceConfirmationPopup() {
final UnitVmModel model = (UnitVmModel) getWindow();
if (model == null || model.getProgress() != null) {
return;
}
VmHighPerformanceConfigurationModel confirmModel = new VmHighPerformanceConfigurationModel();
// Handle CPU Pinning topology
final boolean isVmAssignedToSpecificHosts = !model.getIsAutoAssign().getEntity();
final boolean isVmCpuPinningSet = model.getCpuPinning().getIsChangable() && model.getCpuPinning().getEntity() != null && !model.getCpuPinning().getEntity().isEmpty();
confirmModel.addRecommendationForCpuPinning(isVmAssignedToSpecificHosts, isVmCpuPinningSet);
// Handle NUMA
final boolean isVmVirtNumaSet = model.getNumaEnabled().getEntity() && model.getNumaNodeCount().getEntity() > 0;
final boolean isVmVirtNumaPinned = model.getVmNumaNodes() != null && !model.getVmNumaNodes().isEmpty() && model.getVmNumaNodes().stream().filter(x -> !x.getVdsNumaNodeList().isEmpty()).count() > 0;
confirmModel.addRecommendationForVirtNumaSetAndPinned(isVmVirtNumaSet, isVmVirtNumaPinned);
// Handle Huge Pages
KeyValueModel keyValue = model.getCustomPropertySheet();
// $NON-NLS-1$
final boolean isVmHugePagesSet = keyValue != null && keyValue.getUsedKeys().contains("hugepages");
confirmModel.addRecommendationForHugePages(isVmHugePagesSet);
// Handle KSM (Kernel Same Page Merging)
confirmModel.addRecommendationForKsm(model.getSelectedCluster().isEnableKsm(), model.getSelectedCluster().getName());
// If there are recommendations to display and it is not a Pool VM then display the popup
if (!confirmModel.getRecommendationsList().isEmpty() && !model.isVmAttachedToPool()) {
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().configurationChangesForHighPerformanceVmTitle());
confirmModel.setHelpTag(HelpTag.configuration_changes_for_high_performance_vm);
// $NON-NLS-1$
confirmModel.setHashName("configuration_changes_for_high_performance_vm");
confirmModel.getCommands().add(// $NON-NLS-1$
new UICommand("SaveOrUpdateVM", VmBaseListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
confirmModel.getCommands().add(// $NON-NLS-1$
UICommand.createCancelUiCommand("CancelConfirmation", VmBaseListModel.this));
setConfirmWindow(null);
setConfirmWindow(confirmModel);
} else {
saveOrUpdateVM(model);
}
}
Aggregations