Eldan Shachar has uploaded a new change for review.

Change subject: userportal/webadmin: cluster parameters override - UI 
enhancements
......................................................................

userportal/webadmin: cluster parameters override - UI enhancements

- In the 'edit\add VM\Template\Pool' window, under the custom
  cluster-parameters comboboxes, added the name of the current
  cluster value instead of just 'Use Cluster Default'.

- Added a warning when saving a VM and the cpu-model isn't supported
  by the cluster.

- Added a warning when lowering the cluster cpu-level while there are
  VMs in it with a cpu-level which is higher than the new cluster value.

Change-Id: I2e1c458dc4e4b6e61d2a1b92327287166a12afa2
Bug-Url: https://bugzilla.redhat.com/838487
Signed-off-by: Eldan Shachar <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VerifyClusterSupportsVmCpuQuery.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VerifyClusterSupportsVmCpuParameters.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBox.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBoxEditor.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/vm/UserPortalListProvider.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/PoolModule.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/TemplateModule.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VirtualMachineModule.java
19 files changed, 413 insertions(+), 127 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/07/38407/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VerifyClusterSupportsVmCpuQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VerifyClusterSupportsVmCpuQuery.java
new file mode 100644
index 0000000..e3de3da
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VerifyClusterSupportsVmCpuQuery.java
@@ -0,0 +1,30 @@
+package org.ovirt.engine.core.bll;
+
+import org.ovirt.engine.core.common.businessentities.VM;
+import 
org.ovirt.engine.core.common.queries.VerifyClusterSupportsVmCpuParameters;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class VerifyClusterSupportsVmCpuQuery<P extends 
VerifyClusterSupportsVmCpuParameters> extends QueriesCommandBase<P> {
+    public VerifyClusterSupportsVmCpuQuery(P parameters) {
+        super(parameters);
+    }
+
+    @Override
+    protected void executeQueryCommand() {
+        List<VM> vmsForCluster = 
getDbFacade().getInstance().getVmDao().getAllForVdsGroup(getParameters().getVdsGroupId());
+
+        Map<String, String> highCpuVms = new HashMap<>();
+        for (VM vm : vmsForCluster) {
+            if (vm.getCustomCpuName() != null && 
!vm.getCustomCpuName().isEmpty()) {
+                String vmCpuName = 
CpuFlagsManagerHandler.getCpuNameByCpuId(vm.getCustomCpuName(), 
CpuFlagsManagerHandler.getLatestDictionaryVersion());
+                if (vmCpuName == null || 
CpuFlagsManagerHandler.compareCpuLevels(vmCpuName, 
getParameters().getNewCpuName(), 
CpuFlagsManagerHandler.getLatestDictionaryVersion()) > 0) {
+                    highCpuVms.put(vm.getName(), vm.getCustomCpuName());
+                }
+            }
+        }
+        getQueryReturnValue().setReturnValue(highCpuVms);
+    }
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
index a65a7b6..85614a2 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
@@ -239,6 +239,7 @@
     // License queries
     GetAllServerCpuList,
     GetSupportedCpuList(VdcQueryAuthType.User),
+    VerifyClusterSupportsVmCpu,
 
     // Multi Level Administration queries
     GetAllRoles(VdcQueryAuthType.User),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VerifyClusterSupportsVmCpuParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VerifyClusterSupportsVmCpuParameters.java
new file mode 100644
index 0000000..eb11325
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VerifyClusterSupportsVmCpuParameters.java
@@ -0,0 +1,27 @@
+package org.ovirt.engine.core.common.queries;
+
+import org.ovirt.engine.core.compat.Guid;
+
+public class VerifyClusterSupportsVmCpuParameters extends 
VdcQueryParametersBase {
+
+    private static final long serialVersionUID = -8663922280262494306L;
+
+    private Guid vdsGroupId;
+    private String newCpuName;
+
+    public VerifyClusterSupportsVmCpuParameters(Guid vdsGroupId, String 
newCpuName) {
+        this.vdsGroupId = vdsGroupId;
+        this.newCpuName = newCpuName;
+    }
+
+    public VerifyClusterSupportsVmCpuParameters() {
+    }
+
+    public Guid getVdsGroupId() {
+        return vdsGroupId;
+    }
+
+    public String getNewCpuName() {
+        return newCpuName;
+    }
+}
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java
index fbe2d76..93ce2ec 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java
@@ -559,7 +559,7 @@
     @DefaultStringValue("Emulated Machine override")
     String emulatedMachineLabel();
 
-    @DefaultStringValue("CPU Model override")
+    @DefaultStringValue("CPU Type override")
     String cpuModelLabel();
 
     @DefaultStringValue("Use cluster default")
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBox.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBox.java
index f838a5b..ea8a806 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBox.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBox.java
@@ -18,7 +18,7 @@
     public ListModelTypeAheadChangeableListBox(SuggestBoxRenderer<String> 
renderer, boolean autoAddToValidValues, String nullReplacementText) {
         super(renderer, autoAddToValidValues, new 
SuggestionMatcher.StartWithSuggestionMatcher());
         if (nullReplacementText == null) {
-            nullReplacementText = ""; //$NON-NLS-1$
+            this.nullReplacementText = ""; //$NON-NLS-1$
         } else {
             this.nullReplacementText = nullReplacementText;
         }
@@ -51,4 +51,12 @@
         super.showAllSuggestions();
         suggestBox.setText(lastText);
     }
+
+    protected void setNullReplacementString(String nullReplacementText) {
+        this.nullReplacementText = nullReplacementText;
+    }
+
+    protected String getNullReplacementString() {
+        return nullReplacementText;
+    }
 }
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBoxEditor.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBoxEditor.java
index 42d172f..0bd58c0 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBoxEditor.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadChangeableListBoxEditor.java
@@ -49,4 +49,12 @@
             return data; // for string objects the replacement value is the 
object itself (null safe)
         }
     }
+
+    public void setNullReplacementString(String nullReplacementString) {
+        
super.getContentWidget().setNullReplacementString(nullReplacementString);
+    }
+
+    public String getNullReplacementString() {
+        return super.getContentWidget().getNullReplacementString();
+    }
 }
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
index d3b2867..1df96df 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java
@@ -1235,7 +1235,7 @@
                     @Override
                     public String getDisplayStringNullSafe(String data) {
                         if (data == null || data.trim().isEmpty()) {
-                            data = constants.clusterDefaultOption();
+                            data = emulatedMachine.getNullReplacementString();
                         }
                         return typeAheadNameTemplateNullSafe(data);
                     }
@@ -1250,7 +1250,7 @@
                     @Override
                     public String getDisplayStringNullSafe(String data) {
                         if (data == null || data.trim().isEmpty()) {
-                            data = constants.clusterDefaultOption();
+                            data = customCpu.getNullReplacementString();
                         }
                         return typeAheadNameTemplateNullSafe(data);
                     }
@@ -1693,6 +1693,24 @@
                 rngPanel.setVisible(object.getIsRngEnabled().getEntity());
             }
         });
+
+        
object.getDataCenterWithClustersList().getSelectedItemChangedEvent().addListener(new
 IEventListener<EventArgs>() {
+            @Override
+            public void eventRaised(Event<? extends EventArgs> ev, Object 
sender, EventArgs args) {
+                DataCenterWithCluster dataCenterWithCluster = 
object.getDataCenterWithClustersList().getSelectedItem();
+                String newClusterEmulatedMachine;
+                String newClusterCpuModel;
+                if (dataCenterWithCluster == null) {
+                    newClusterEmulatedMachine = ""; //$NON-NLS-1$
+                    newClusterCpuModel = ""; //$NON-NLS-1$
+                } else {
+                    newClusterEmulatedMachine = 
(dataCenterWithCluster.getCluster().getEmulatedMachine() == null) ? "" : 
dataCenterWithCluster.getCluster().getEmulatedMachine(); //$NON-NLS-1$
+                    newClusterCpuModel = 
(dataCenterWithCluster.getCluster().getCpuName() == null) ? "" : 
dataCenterWithCluster.getCluster().getCpuName(); //$NON-NLS-1$
+                }
+                
emulatedMachine.setNullReplacementString(constants.clusterDefaultOption() + "(" 
+ newClusterEmulatedMachine + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+                
customCpu.setNullReplacementString(constants.clusterDefaultOption() + "(" + 
newClusterCpuModel + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        });
     }
 
     /**
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index aed9124..c0009a3 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
@@ -121,6 +121,7 @@
 import org.ovirt.engine.core.common.queries.GetVmTemplateParameters;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
 import org.ovirt.engine.core.common.queries.InterfaceAndIdQueryParameters;
+import 
org.ovirt.engine.core.common.queries.VerifyClusterSupportsVmCpuParameters;
 import 
org.ovirt.engine.core.common.queries.MultilevelAdministrationsQueriesParameters;
 import org.ovirt.engine.core.common.queries.NameQueryParameters;
 import org.ovirt.engine.core.common.queries.OsQueryParameters;
@@ -3966,6 +3967,23 @@
         Frontend.getInstance().runQuery(VdcQueryType.GetSupportedCpuList, new 
GetSupportedCpuListParameters(cpuName), aQuery);
     }
 
+    public void VerifyClusterSupportsVmCpu(AsyncQuery aQuery, Guid vdsGroupId, 
String newCpuName) {
+        aQuery.converterCallback = new IAsyncConverter() {
+            @Override
+            public Object Convert(Object source, AsyncQuery _asyncQuery)
+            {
+                if (source != null)
+                {
+                    return source;
+                }
+
+                return new HashMap();
+            }
+        };
+
+        
Frontend.getInstance().runQuery(VdcQueryType.VerifyClusterSupportsVmCpu, new 
VerifyClusterSupportsVmCpuParameters(vdsGroupId, newCpuName), aQuery);
+    }
+
     private static class AsIsAsyncConverter implements IAsyncConverter {
         @Override
         public Object Convert(Object source, AsyncQuery _asyncQuery) {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
index 8f1eedc..6719985 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
@@ -254,6 +254,8 @@
 
     edit_next_run_configuration("edit_next_run_configuration", 
HelpTagType.COMMON, "'VMs' main tab -> 'Edit VM' dialog [replaces the old 'Edit 
Desktop' (edit_desktop) and 'Edit Server' (edit_server)]"), //$NON-NLS-1$ 
//$NON-NLS-2$
 
+    edit_unsupported_cpu("edit_unsupported_cpu", HelpTagType.COMMON, "'VMs' 
main tab -> 'Edit VM' dialog [replaces the old 'Edit Desktop' (edit_desktop) 
and 'Edit Server' (edit_server)]"), //$NON-NLS-1$ //$NON-NLS-2$
+
     monitor("monitor", HelpTagType.UNKNOWN), //$NON-NLS-1$
 
     move_disk("move_disk", HelpTagType.WEBADMIN, "VMs Tab > Virtual Disks 
Sub-Tab > Move Virtual Disk"), //$NON-NLS-1$ //$NON-NLS-2$
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
index c7a431b..22232db 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
@@ -598,28 +598,65 @@
 
         // cancel confirm window if there is one
         cancelConfirmation();
+        ServerCpu vdsCpu = getVdsGroupServerCpu(model, getSelectedItem());
+        if (vdsCpu != null && model.getCPU().getSelectedItem().getLevel() < 
vdsCpu.getLevel()) {
+            AsyncQuery _asyncQuery = new AsyncQuery();
+            _asyncQuery.setModel(model);
+            _asyncQuery.asyncCallback = new INewAsyncCallback() {
+                @Override
+                public void onSuccess(Object model, Object result)
+                {
+                    ClusterModel clusterModel = (ClusterModel) model;
+                    final Map<String, String> highCpuVms = (Map<String, 
String>)result;
+                    AsyncQuery _asyncQuery = new AsyncQuery();
+                    _asyncQuery.setModel(clusterModel);
+                    _asyncQuery.asyncCallback = new INewAsyncCallback() {
+                        @Override
+                        public void onSuccess(Object model, Object result) {
+                            Integer activeVms = (Integer) result;
 
-        AsyncQuery _asyncQuery = new AsyncQuery();
-        _asyncQuery.setModel(model);
-        _asyncQuery.asyncCallback = new INewAsyncCallback() {
-            @Override
-            public void onSuccess(Object model, Object result)
-            {
-                ClusterModel clusterModel = (ClusterModel) model;
-                Integer activeVms = (Integer) result;
+                            StringBuilder message = new StringBuilder();
+                            if (!highCpuVms.isEmpty()) {
+                                message.append(ConstantsManager.getInstance()
+                                        .getConstants()
+                                        .changeCpuLevelCustomVmCpusMessage());
+                                for (Map.Entry<String, String> highCpu : 
highCpuVms.entrySet()) {
+                                    message.append("* \""); //$NON-NLS-1$
+                                    message.append(highCpu.getKey()); 
//$NON-NLS-1$
+                                    message.append("\" - "); //$NON-NLS-1$
+                                    message.append(highCpu.getValue());
+                                    message.append(" CPU\n"); //$NON-NLS-1$
+                                }
 
-                ServerCpu vdsCpu = getVdsGroupServerCpu(clusterModel, 
getSelectedItem());
-                if (activeVms > 0 && vdsCpu != null && 
clusterModel.getCPU().getSelectedItem().getLevel() < vdsCpu.getLevel()) {
-                    cpuLevelConfirmationWindow();
-                } else {
-                    onSaveInternal();
+                            }
+                            if (activeVms > 0) {
+                                message.append(ConstantsManager.getInstance()
+                                        .getConstants()
+                                        .changeCpuLevelWhileRunningMessage());
+                            }
+                            if (message.length() == 0) {
+                                onSaveInternal();
+                            } else {
+                                message.append(ConstantsManager.getInstance()
+                                        .getConstants()
+                                        .changeCpuLevelWarningMessage());
+                                cpuLevelConfirmationWindow(message.toString());
+                            }
+                        }
+                    };
+                    AsyncDataProvider.getInstance()
+                            .getNumberOfActiveVmsInCluster(_asyncQuery, 
getSelectedItem().getId());
                 }
-            }
-        };
-        
AsyncDataProvider.getInstance().getNumberOfActiveVmsInCluster(_asyncQuery, 
getSelectedItem().getId());
+            };
+            
AsyncDataProvider.getInstance().VerifyClusterSupportsVmCpu(_asyncQuery,
+                    getSelectedItem().getId(),
+                    model.getCPU().getSelectedItem().getCpuName());
+        } else {
+            onSaveInternal();
+        }
     }
 
-    private void cpuLevelConfirmationWindow() {
+    private void cpuLevelConfirmationWindow(String message) {
         ConfirmationModel confirmModel = new ConfirmationModel();
         setConfirmWindow(confirmModel);
         confirmModel.setTitle(ConstantsManager.getInstance()
@@ -627,9 +664,7 @@
                 .changeCpuLevel());
         confirmModel.setHelpTag(HelpTag.change_cpu_level);
         confirmModel.setHashName("change_cpu_level"); //$NON-NLS-1$
-        confirmModel.setMessage(ConstantsManager.getInstance()
-                .getConstants()
-                .changeCpuLevelConfirmation());
+        confirmModel.setMessage(message);
 
         UICommand tempVar = 
UICommand.createDefaultOkUiCommand("OnSaveInternal", this); //$NON-NLS-1$
         getConfirmWindow().getCommands().add(tempVar);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java
index 35fa9a3..856d900 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java
@@ -69,6 +69,8 @@
 
     private UICommand privateNewCommand;
 
+    private VmPool privateCurrentPool;
+
     public UICommand getNewCommand()
     {
         return privateNewCommand;
@@ -378,7 +380,7 @@
                 }, model);
     }
 
-    public void onSave()
+    public void preSave()
     {
         final PoolModel model = (PoolModel) getWindow();
 
@@ -398,8 +400,7 @@
             return;
         }
 
-        final VmPool pool = model.getIsNew() ? new VmPool() : (VmPool) 
Cloner.clone(getSelectedItem());
-
+        setCurrentPool(model.getIsNew() ? new VmPool() : (VmPool) 
Cloner.clone(getSelectedItem()));
         final String name = model.getName().getEntity();
 
         // Check name unicitate.
@@ -410,7 +411,7 @@
                         Boolean isUnique = (Boolean) returnValue;
 
                         if ((model.getIsNew() && !isUnique)
-                                || (!model.getIsNew() && !isUnique && 
name.compareToIgnoreCase(pool.getName()) != 0)) {
+                                || (!model.getIsNew() && !isUnique && 
name.compareToIgnoreCase(getCurrentPool().getName()) != 0)) {
                             model.getName()
                                     .getInvalidityReasons()
                                     
.add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
@@ -418,83 +419,110 @@
                             model.setValidTab(TabName.GENERAL_TAB, false);
                             return;
                         }
+                        String selectedCpu = 
model.getCustomCpu().getSelectedItem();
+                        if (selectedCpu != null && !selectedCpu.isEmpty()  && 
!model.getCustomCpu().getItems().contains(selectedCpu)) {
+                            ConfirmationModel confirmModel = new 
ConfirmationModel();
+                            
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuTitle());
+                            
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuMessage());
+                            
confirmModel.setHelpTag(HelpTag.edit_unsupported_cpu);
+                            confirmModel.setHashName("edit_unsupported_cpu"); 
//$NON-NLS-1$
 
-                        // Save changes.
-                        pool.setName(model.getName().getEntity());
-                        
pool.setVmPoolDescription(model.getDescription().getEntity());
-                        pool.setVdsGroupId(model.getSelectedCluster().getId());
-                        pool.setComment(model.getComment().getEntity());
-                        
pool.setPrestartedVms(model.getPrestartedVms().getEntity());
-                        
pool.setMaxAssignedVmsPerUser(model.getMaxAssignedVmsPerUser().getEntity());
+                            confirmModel.getCommands().add(new 
UICommand("OnSave_Phase2", PoolListModel.this) //$NON-NLS-1$
+                                    
.setTitle(ConstantsManager.getInstance().getConstants().ok())
+                                    .setIsDefault(true));
 
-                        EntityModel<VmPoolType> poolTypeSelectedItem = 
model.getPoolType().getSelectedItem();
-                        pool.setVmPoolType(poolTypeSelectedItem.getEntity());
+                            
confirmModel.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation",
 PoolListModel.this)); //$NON-NLS-1$
 
-                        if (model.getSpiceProxyEnabled().getEntity()) {
-                            
pool.setSpiceProxy(model.getSpiceProxy().getEntity());
+                            setConfirmWindow(confirmModel);
+                        } else {
+                            onSave();
                         }
 
-                        VM vm = buildVmOnSave(model);
-                        
vm.setVmInit(model.getVmInitModel().buildCloudInitParameters(model));
-                        
vm.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
-
-                        
vm.setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest());
-                        vm.setStateless(false);
-                        
vm.setInstanceTypeId(model.getInstanceTypes().getSelectedItem().getId());
-
-                        AddVmPoolWithVmsParameters param =
-                                new AddVmPoolWithVmsParameters(pool, vm, 
model.getNumOfDesktops().getEntity(), 0);
-
-                        param.setStorageDomainId(Guid.Empty);
-                        
param.setDiskInfoDestinationMap(model.getDisksAllocationModel()
-                                                                
.getImageToDestinationDomainMap());
-                        
param.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
-                        
param.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
-
-                        
param.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
-                        param.setRngDevice(model.getIsRngEnabled().getEntity() 
? model.generateRngDevice() : null);
-
-                        
param.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
-                        
param.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
-
-                        BuilderExecutor.build(model, param, new 
UnitToGraphicsDeviceParamsBuilder());
-
-                        if (model.getQuota().getSelectedItem() != null) {
-                            
vm.setQuotaId(model.getQuota().getSelectedItem().getId());
-                        }
-
-                        model.startProgress(null);
-
-                        if (model.getIsNew())
-                        {
-                            
Frontend.getInstance().runMultipleAction(VdcActionType.AddVmPoolWithVms,
-                                    new 
ArrayList<VdcActionParametersBase>(Arrays.asList(new VdcActionParametersBase[] 
{ param })),
-                                    new IFrontendMultipleActionAsyncCallback() 
{
-                                        @Override
-                                        public void 
executed(FrontendMultipleActionAsyncResult result) {
-                                            cancel();
-                                            stopProgress();
-                                        }
-                                    },
-                                    this);
-                        }
-                        else
-                        {
-                            
Frontend.getInstance().runMultipleAction(VdcActionType.UpdateVmPoolWithVms,
-                                    new 
ArrayList<VdcActionParametersBase>(Arrays.asList(new VdcActionParametersBase[] 
{ param })),
-                                    new IFrontendMultipleActionAsyncCallback() 
{
-                                        @Override
-                                        public void 
executed(FrontendMultipleActionAsyncResult result) {
-                                            cancel();
-                                            stopProgress();
-                                        }
-                                    },
-                                    this);
-                        }
 
                     }
                 }),
                 name);
+    }
+
+    public void onSave() {
+
+        final PoolModel model = (PoolModel) getWindow();
+
+        VmPool pool = getCurrentPool();
+
+
+        // Save changes.
+        pool.setName(model.getName().getEntity());
+        pool.setVmPoolDescription(model.getDescription().getEntity());
+        pool.setVdsGroupId(model.getSelectedCluster().getId());
+        pool.setComment(model.getComment().getEntity());
+        pool.setPrestartedVms(model.getPrestartedVms().getEntity());
+        
pool.setMaxAssignedVmsPerUser(model.getMaxAssignedVmsPerUser().getEntity());
+
+        EntityModel<VmPoolType> poolTypeSelectedItem = 
model.getPoolType().getSelectedItem();
+        pool.setVmPoolType(poolTypeSelectedItem.getEntity());
+
+        if (model.getSpiceProxyEnabled().getEntity()) {
+            pool.setSpiceProxy(model.getSpiceProxy().getEntity());
+        }
+
+        VM vm = buildVmOnSave(model);
+        vm.setVmInit(model.getVmInitModel().buildCloudInitParameters(model));
+        
vm.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
+
+        
vm.setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest());
+        vm.setStateless(false);
+        
vm.setInstanceTypeId(model.getInstanceTypes().getSelectedItem().getId());
+
+        AddVmPoolWithVmsParameters param =
+                new AddVmPoolWithVmsParameters(pool, vm, 
model.getNumOfDesktops().getEntity(), 0);
+
+        param.setStorageDomainId(Guid.Empty);
+        param.setDiskInfoDestinationMap(model.getDisksAllocationModel()
+                .getImageToDestinationDomainMap());
+        param.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
+        param.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
+
+        param.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
+        param.setRngDevice(model.getIsRngEnabled().getEntity() ? 
model.generateRngDevice() : null);
+
+        param.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
+        
param.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
+
+        BuilderExecutor.build(model, param, new 
UnitToGraphicsDeviceParamsBuilder());
+
+        if (model.getQuota().getSelectedItem() != null) {
+            vm.setQuotaId(model.getQuota().getSelectedItem().getId());
+        }
+
+        model.startProgress(null);
+
+        if (model.getIsNew())
+        {
+            
Frontend.getInstance().runMultipleAction(VdcActionType.AddVmPoolWithVms,
+                    new ArrayList<VdcActionParametersBase>(Arrays.asList(new 
VdcActionParametersBase[] { param })),
+                    new IFrontendMultipleActionAsyncCallback() {
+                        @Override
+                        public void executed(FrontendMultipleActionAsyncResult 
result) {
+                            cancel();
+                            stopProgress();
+                        }
+                    },
+                    this);
+        }
+        else
+        {
+            
Frontend.getInstance().runMultipleAction(VdcActionType.UpdateVmPoolWithVms,
+                    new ArrayList<VdcActionParametersBase>(Arrays.asList(new 
VdcActionParametersBase[] { param })),
+                    new IFrontendMultipleActionAsyncCallback() {
+                        @Override
+                        public void executed(FrontendMultipleActionAsyncResult 
result) {
+                            cancel();
+                            stopProgress();
+                        }
+                    },
+                    this);
+        }
     }
 
     protected static VM buildVmOnSave(PoolModel model) {
@@ -575,11 +603,20 @@
         }
         if ("OnSave".equals(command.getName())) //$NON-NLS-1$
         {
+            preSave();
+        }
+        if ("OnSave_Phase2".equals(command.getName())) //$NON-NLS-1$
+        {
             onSave();
+            setConfirmWindow(null);
         }
         if ("OnRemove".equals(command.getName())) //$NON-NLS-1$
         {
             onRemove();
+        }
+        if ("CancelConfirmation".equals(command.getName())) //$NON-NLS-1$
+        {
+            cancelConfirmation();
         }
     }
 
@@ -588,4 +625,16 @@
         return "PoolListModel"; //$NON-NLS-1$
     }
 
+    public VmPool getCurrentPool() {
+        return privateCurrentPool;
+    }
+
+    public void setCurrentPool(VmPool privateCurrentPool) {
+        this.privateCurrentPool = privateCurrentPool;
+    }
+
+    private void cancelConfirmation()
+    {
+        setConfirmWindow(null);
+    }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java
index 4143779..7cea583 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java
@@ -561,14 +561,14 @@
 
     private void onSave()
     {
-        UnitVmModel model = (UnitVmModel) getWindow();
+        final UnitVmModel model = (UnitVmModel) getWindow();
 
         if (!model.validate())
         {
             return;
         }
 
-        String name = model.getName().getEntity();
+        final String name = model.getName().getEntity();
 
         if (((TemplateVmModelBehavior) 
model.getBehavior()).getVmTemplate().isBaseTemplate()) {
 
@@ -579,16 +579,44 @@
 
                             TemplateListModel templateListModel = 
(TemplateListModel) target;
                             boolean isNameUnique = (Boolean) returnValue;
-                            
templateListModel.postNameUniqueCheck(isNameUnique);
+
+                            VmTemplate selectedItem = 
((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate();
+
+                            if (!isNameUnique && 
name.compareToIgnoreCase(selectedItem.getName()) != 0) {
+                                model.getName()
+                                        .getInvalidityReasons()
+                                        .add(ConstantsManager.getInstance()
+                                                .getConstants()
+                                                
.nameMustBeUniqueInvalidReason());
+                                model.getName().setIsValid(false);
+                                model.setValidTab(TabName.GENERAL_TAB, false);
+                                return;
+                            }
 
                         }
                     }), name);
+        }
+        String selectedCpu = model.getCustomCpu().getSelectedItem();
+        if (selectedCpu != null && !selectedCpu.isEmpty()  && 
!model.getCustomCpu().getItems().contains(selectedCpu)) {
+            ConfirmationModel confirmModel = new ConfirmationModel();
+            
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuTitle());
+            
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuMessage());
+            confirmModel.setHelpTag(HelpTag.edit_unsupported_cpu);
+            confirmModel.setHashName("edit_unsupported_cpu"); //$NON-NLS-1$
+
+            confirmModel.getCommands().add(new 
UICommand("postNameUniqueCheck", TemplateListModel.this) //$NON-NLS-1$
+                    
.setTitle(ConstantsManager.getInstance().getConstants().ok())
+                    .setIsDefault(true));
+
+            
confirmModel.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation",
 TemplateListModel.this)); //$NON-NLS-1$
+
+            setConfirmWindow(confirmModel);
         } else {
-            postNameUniqueCheck(true);
+            postNameUniqueCheck();
         }
     }
 
-    public void postNameUniqueCheck(boolean isNameUnique)
+    public void postNameUniqueCheck()
     {
         final UnitVmModel model = (UnitVmModel) getWindow();
 
@@ -600,18 +628,6 @@
         VmTemplate selectedItem = ((TemplateVmModelBehavior) 
model.getBehavior()).getVmTemplate();
         final VmTemplate template = (VmTemplate) Cloner.clone(selectedItem);
 
-        String name = model.getName().getEntity();
-
-        // Check name unicitate.
-        if (!isNameUnique && name.compareToIgnoreCase(template.getName()) != 0)
-        {
-            model.getName()
-                    .getInvalidityReasons()
-                    
.add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
-            model.getName().setIsValid(false);
-            model.setValidTab(TabName.GENERAL_TAB, false);
-            return;
-        }
 
         // Save changes.
         buildTemplateOnSave(model, template);
@@ -825,6 +841,10 @@
         {
             onSave();
         }
+        else if ("postNameUniqueCheck".equals(command.getName())) { 
//$NON-NLS-1$
+            postNameUniqueCheck();
+            setConfirmWindow(null);
+        }
         else if ("OnRemove".equals(command.getName())) //$NON-NLS-1$
         {
             onRemove();
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java
index 318fbea..28638f7 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java
@@ -509,6 +509,10 @@
             updateExistingVm(UserPortalListModel.this, 
model.getApplyCpuLater().getEntity());
             setConfirmWindow(null);
         }
+        else if ("postVmNameUniqueCheck".equals(command.getName())) { // 
$NON-NLS-1$
+            postVmNameUniqueCheck();
+            setConfirmWindow(null);
+        }
     }
 
     private void cloneVm() {
@@ -1009,7 +1013,24 @@
                             unitModel.setValidTab(TabName.GENERAL_TAB, false);
                             stopProgress(target);
                         } else {
-                            
userPortalListModel.postVmNameUniqueCheck(userPortalListModel);
+                            String selectedCpu = 
model.getCustomCpu().getSelectedItem();
+                            if (selectedCpu != null && !selectedCpu.isEmpty()  
&& !model.getCustomCpu().getItems().contains(selectedCpu)) {
+                                ConfirmationModel confirmModel = new 
ConfirmationModel();
+                                
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuTitle());
+                                
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuMessage());
+                                
confirmModel.setHelpTag(HelpTag.edit_unsupported_cpu);
+                                
confirmModel.setHashName("edit_unsupported_cpu"); //$NON-NLS-1$
+
+                                confirmModel.getCommands().add(new 
UICommand("postVmNameUniqueCheck", UserPortalListModel.this) //$NON-NLS-1$
+                                        
.setTitle(ConstantsManager.getInstance().getConstants().ok())
+                                        .setIsDefault(true));
+
+                                
confirmModel.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation",
 UserPortalListModel.this)); //$NON-NLS-1$
+
+                                setConfirmWindow(confirmModel);
+                            } else {
+                                userPortalListModel.postVmNameUniqueCheck();
+                            }
                         }
 
                     }
@@ -1026,7 +1047,7 @@
         }
     }
 
-    public void postVmNameUniqueCheck(final UserPortalListModel 
userPortalListModel)
+    public void postVmNameUniqueCheck()
     {
         final UnitVmModel model = (UnitVmModel) getWindow();
 
@@ -1043,7 +1064,7 @@
         }
         else
         {
-            final VM selectedItem = (VM) ((UserPortalItemModel) 
userPortalListModel.getSelectedItem()).getEntity();
+            final VM selectedItem = (VM) (getSelectedItem()).getEntity();
             
gettempVm().setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest());
 
             if (selectedItem.isRunningOrPaused()) {
@@ -1069,13 +1090,13 @@
                             setConfirmWindow(confirmModel);
                         }
                         else {
-                            updateExistingVm(userPortalListModel, false);
+                            updateExistingVm((UserPortalListModel)thisModel, 
false);
                         }
                     }
                 }));
             }
             else {
-                updateExistingVm(userPortalListModel, false);
+                updateExistingVm(this, false);
             }
         }
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
index 6ffd0dd..0eabf2c 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
@@ -1942,7 +1942,24 @@
                             .getInvalidityReasons().clear();
                     model.getName().setIsValid(true);
                     model.setValidTab(TabName.GENERAL_TAB, true);
-                    onSave();
+                    String selectedCpu = 
model.getCustomCpu().getSelectedItem();
+                    if (selectedCpu != null && !selectedCpu.isEmpty()  && 
!model.getCustomCpu().getItems().contains(selectedCpu)) {
+                        ConfirmationModel confirmModel = new 
ConfirmationModel();
+                        
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuTitle());
+                        
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuMessage());
+                        confirmModel.setHelpTag(HelpTag.edit_unsupported_cpu);
+                        confirmModel.setHashName("edit_unsupported_cpu"); 
//$NON-NLS-1$
+
+                        confirmModel.getCommands().add(new 
UICommand("OnSave_Phase2", VmListModel.this) //$NON-NLS-1$
+                                
.setTitle(ConstantsManager.getInstance().getConstants().ok())
+                                .setIsDefault(true));
+
+                        
confirmModel.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation",
 VmListModel.this)); //$NON-NLS-1$
+
+                        setConfirmWindow(confirmModel);
+                    } else {
+                        onSave();
+                    }
                 }
             }
         }), name);
@@ -2464,6 +2481,11 @@
         {
             preSave();
         }
+        else if ("OnSave_Phase2".equals(command.getName())) //$NON-NLS-1$
+        {
+            onSave();
+            cancelConfirmation();
+        }
         else if ("OnRemove".equals(command.getName())) //$NON-NLS-1$
         {
             onRemove();
@@ -2490,6 +2512,7 @@
         }
         else if ("OnNewTemplate".equals(command.getName())) //$NON-NLS-1$
         {
+
             onNewTemplate();
         }
         else if ("OnMigrate".equals(command.getName())) //$NON-NLS-1$
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
index c56059c..b88833d 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
@@ -91,8 +91,14 @@
     @DefaultStringValue("Change Cluster CPU level")
     String changeCpuLevel();
 
-    @DefaultStringValue("There are running VMs. Lowering the Cluster CPU level 
might prevent migration of these VMs to some of the Hosts in the Cluster. Are 
you sure you want to continue?")
-    String changeCpuLevelConfirmation();
+    @DefaultStringValue("\n - The cluster contains VMs which are currently 
running. \n")
+    String changeCpuLevelWhileRunningMessage();
+
+    @DefaultStringValue(" - The following VMs have a custom CPU level which is 
not supported by the new cluster CPU level:\n")
+    String changeCpuLevelCustomVmCpusMessage();
+
+    @DefaultStringValue("\nLowering the Cluster CPU level might prevent 
migration of these VMs to some of the hosts in the Cluster. Are you sure you 
want to continue?")
+    String changeCpuLevelWarningMessage();
 
     @DefaultStringValue("General")
     String generalTitle();
@@ -161,6 +167,12 @@
     @DefaultStringValue("Next Restart Configuration")
     String editNextRunConfigurationTitle();
 
+    @DefaultStringValue("Unsupported CPU type for current cluster")
+    String vmUnsupportedCpuTitle();
+
+    @DefaultStringValue("The selected CPU type is not supported by the VM 
cluster, this may cause scheduling limitations and prevent this vm from running 
on certain hosts. Are you sure you want to proceed?")
+    String vmUnsupportedCpuMessage();
+
     @DefaultStringValue("Data Centers")
     String dataCentersTitle();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/vm/UserPortalListProvider.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/vm/UserPortalListProvider.java
index 0c83cae..b43d70f 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/vm/UserPortalListProvider.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/model/vm/UserPortalListProvider.java
@@ -10,6 +10,7 @@
 import org.ovirt.engine.ui.uicommonweb.models.Model;
 import org.ovirt.engine.ui.uicommonweb.models.userportal.UserPortalListModel;
 import 
org.ovirt.engine.ui.uicommonweb.models.vms.SpiceToGuestWithNonRespAgentModel;
+import org.ovirt.engine.ui.uicommonweb.models.vms.VmNextRunConfigurationModel;
 import org.ovirt.engine.ui.uicommonweb.models.vms.VncInfoModel;
 import 
org.ovirt.engine.ui.userportal.section.main.presenter.popup.vm.CloneVmPopupPresenterWidget;
 import 
org.ovirt.engine.ui.userportal.section.main.presenter.popup.vm.VmChangeCDPopupPresenterWidget;
@@ -36,6 +37,7 @@
     private final Provider<DefaultConfirmationPopupPresenterWidget> 
spiceToGuestWithNonRespAgentPopupProvider;
     private final Provider<CloneVmPopupPresenterWidget> cloneVmProvider;
     private final Provider<VmNextRunConfigurationPresenterWidget> 
nextRunProvider;
+    private final Provider<DefaultConfirmationPopupPresenterWidget> 
defaultPopupProvider;
 
     @Inject
     public UserPortalListProvider(EventBus eventBus,
@@ -62,6 +64,7 @@
         this.spiceToGuestWithNonRespAgentPopupProvider = 
spiceToGuestWithNonRespAgentPopupProvider;
         this.cloneVmProvider = cloneVmProvider;
         this.nextRunProvider = nextRunProvider;
+        this.defaultPopupProvider = defaultConfirmPopupProvider;
     }
 
     @Override
@@ -97,8 +100,10 @@
         if (lastExecutedCommand == getModel().getRemoveCommand()) {
             return removeConfirmPopupProvider.get();
         }
-        else if ("OnSave".equals(lastExecutedCommand.getName())) { 
//$NON-NLS-1$
+        else if (source.getConfirmWindow() instanceof 
VmNextRunConfigurationModel) {
             return nextRunProvider.get();
+        } else if ("OnSave".equals(lastExecutedCommand.getName())) { 
//$NON-NLS-1$
+            return defaultPopupProvider.get();
         } else {
             return super.getConfirmModelPopup(source, lastExecutedCommand);
         }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/PoolModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/PoolModule.java
index 437a395..10fdb53 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/PoolModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/PoolModule.java
@@ -38,7 +38,7 @@
     @Provides
     @Singleton
     public MainModelProvider<VmPool, PoolListModel> 
getPoolListProvider(EventBus eventBus,
-            Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider,
+            final Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider,
             final Provider<RemoveConfirmationPopupPresenterWidget> 
removeConfirmPopupProvider,
             final Provider<PoolNewPopupPresenterWidget> poolPopupProvider,
             final Provider<PoolEditPopupPresenterWidget> poolEditPopupProvider,
@@ -64,7 +64,11 @@
                             UICommand lastExecutedCommand) {
                         if (lastExecutedCommand == 
getModel().getRemoveCommand()) {
                             return removeConfirmPopupProvider.get();
-                        } else {
+                        } else if 
("OnSave".equals(lastExecutedCommand.getName())) { //$NON-NLS-1$
+                            return defaultConfirmPopupProvider.get();
+                        }
+
+                        else {
                             return super.getConfirmModelPopup(source, 
lastExecutedCommand);
                         }
                     }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/TemplateModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/TemplateModule.java
index 1b85ed3..d24ec3e 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/TemplateModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/TemplateModule.java
@@ -50,7 +50,7 @@
     @Provides
     @Singleton
     public MainModelProvider<VmTemplate, TemplateListModel> 
getTemplateListProvider(EventBus eventBus,
-            Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider,
+            final Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider,
             final Provider<TemplateEditPresenterWidget> popupProvider,
             final Provider<VmExportPopupPresenterWidget> exportPopupProvider,
             final Provider<RemoveConfirmationPopupPresenterWidget> 
removeConfirmPopupProvider,
@@ -79,6 +79,8 @@
                             UICommand lastExecutedCommand) {
                         if (lastExecutedCommand == 
getModel().getRemoveCommand()) {
                             return removeConfirmPopupProvider.get();
+                        } else if 
("OnSave".equals(lastExecutedCommand.getName())) { //$NON-NLS-1$
+                            return defaultConfirmPopupProvider.get();
                         } else {
                             return super.getConfirmModelPopup(source, 
lastExecutedCommand);
                         }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VirtualMachineModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VirtualMachineModule.java
index 168306a..8282ea7 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VirtualMachineModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VirtualMachineModule.java
@@ -34,6 +34,7 @@
 import org.ovirt.engine.ui.uicommonweb.models.vms.VmGeneralModel;
 import org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceListModel;
 import org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel;
+import org.ovirt.engine.ui.uicommonweb.models.vms.VmNextRunConfigurationModel;
 import org.ovirt.engine.ui.uicommonweb.models.vms.VmSessionsModel;
 import org.ovirt.engine.ui.uicommonweb.models.vms.VmSnapshotListModel;
 import org.ovirt.engine.ui.uicommonweb.models.vms.VncInfoModel;
@@ -81,7 +82,7 @@
     @Provides
     @Singleton
     public MainModelProvider<VM, VmListModel<Void>> getVmListProvider(EventBus 
eventBus,
-            Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider,
+            final Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider,
             final Provider<AssignTagsPopupPresenterWidget> 
assignTagsPopupProvider,
             final Provider<VmMakeTemplatePopupPresenterWidget> 
makeTemplatePopupProvider,
             final Provider<VmRunOncePopupPresenterWidget> runOncePopupProvider,
@@ -154,8 +155,10 @@
                             return removeConfirmPopupProvider.get();
                         } else if (source.getConfirmWindow() instanceof 
ImportCloneModel) {
                             return importClonePopupProvider.get();
-                        } else if 
("OnSave".equals(lastExecutedCommand.getName())) { //$NON-NLS-1$
+                        } else if (source.getConfirmWindow() instanceof 
VmNextRunConfigurationModel) {
                             return nextRunProvider.get();
+                        } else if 
("OnSave".equals(lastExecutedCommand.getName())) { //$NON-NLS-1$
+                            return defaultConfirmPopupProvider.get();
                         } else {
                             return super.getConfirmModelPopup(source, 
lastExecutedCommand);
                         }


-- 
To view, visit https://gerrit.ovirt.org/38407
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e1c458dc4e4b6e61d2a1b92327287166a12afa2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eldan Shachar <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to