Search in sources :

Example 1 with VmHighPerformanceConfigurationModel

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();
    }
}
Also used : VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 2 with VmHighPerformanceConfigurationModel

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;
}
Also used : MainViewModelProvider(org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) EditDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.EditDiskModel) NewDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.NewDiskModel) TemplateInterfaceListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateInterfaceListModel) TemplateEventListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateEventListModel) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) NewDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.NewDiskModel) TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) TemplateVmListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateVmListModel) TemplateStorageListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateStorageListModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) EditDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.EditDiskModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) TemplateDiskListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateDiskListModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) TemplateGeneralModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateGeneralModel) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 3 with VmHighPerformanceConfigurationModel

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);
    }
}
Also used : ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) FullUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder) FrontendActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult) VmType(org.ovirt.engine.core.common.businessentities.VmType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) AddVmParameters(org.ovirt.engine.core.common.action.AddVmParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) Map(java.util.Map) VmInterfaceCreatingManager(org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceCreatingManager) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StringHelper(org.ovirt.engine.core.compat.StringHelper) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) List(java.util.List) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) HasDiskWindow(org.ovirt.engine.ui.uicommonweb.models.vms.HasDiskWindow) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) Frontend(org.ovirt.engine.ui.frontend.Frontend) ExportOvaModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportOvaModel) BalloonEnabled(org.ovirt.engine.ui.uicommonweb.models.vms.BalloonEnabled) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) VmBasedWidgetSwitchModeCommand(org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand) IconUtils(org.ovirt.engine.ui.uicommonweb.IconUtils) VM(org.ovirt.engine.core.common.businessentities.VM) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VmSpecificUnitToVmBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.VmSpecificUnitToVmBuilder) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Aggregations

UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)3 VmHighPerformanceConfigurationModel (org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel)3 Model (org.ovirt.engine.ui.uicommonweb.models.Model)2 Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 AddVmParameters (org.ovirt.engine.core.common.action.AddVmParameters)1 VmManagementParametersBase (org.ovirt.engine.core.common.action.VmManagementParametersBase)1 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)1 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)1