Eldan Shachar has uploaded a new change for review.

Change subject: core/restapi/webadmin: Support clearing the cluster's emulated 
machine
......................................................................

core/restapi/webadmin: Support clearing the cluster's emulated machine

Added option to clear the cluster's emulated machine when all of its
hosts are down. Support was added to UI & REST.

Change-Id: I3e1f70cbbe46fa54edda3f0aa9e56bfd576b8266
Bug-Url: https://bugzilla.redhat.com/1058751
Signed-off-by: Eldan Shachar <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsGroupOperationParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ClusterResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.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/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabClusterView.java
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
16 files changed, 180 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/37115/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
index b7919f0..3ca6772 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
@@ -103,6 +103,10 @@
             getParameters().getVdsGroup().setEmulatedMachine(null);
         }
 
+        if (getParameters().isForceResetEmulatedMachine()) {
+            getParameters().getVdsGroup().setDetectEmulatedMachine(true);
+        }
+
         getVdsGroupDAO().update(getParameters().getVdsGroup());
 
         if (oldGroup.getStoragePoolId() == null && 
getVdsGroup().getStoragePoolId() != null) {
@@ -382,6 +386,15 @@
             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_RNG_SOURCE_NOT_SUPPORTED);
             result = false;
         }
+        if (result && getParameters().isForceResetEmulatedMachine()) {
+            for (VDS vds : allForVdsGroup) {
+                if (vds.getStatus() == VDSStatus.Up) {
+                    
addCanDoActionMessage(VdcBllMessages.VDS_GROUP_HOSTS_MUST_BE_DOWN);
+                    result = false;
+                    break;
+                }
+            }
+        }
         return result;
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsGroupOperationParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsGroupOperationParameters.java
index 2c5416c..86a90aa 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsGroupOperationParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdsGroupOperationParameters.java
@@ -8,6 +8,7 @@
     private static final long serialVersionUID = -2184123302248929010L;
     @Valid
     private VDSGroup _vdsGroup;
+    private boolean forceResetEmulatedMachine = false;
 
     public VdsGroupOperationParameters(VDSGroup group) {
         super(group.getId());
@@ -30,4 +31,12 @@
 
     public VdsGroupOperationParameters() {
     }
+
+    public void setForceResetEmulatedMachine(boolean isResetEmulatedMachine) {
+        this.forceResetEmulatedMachine = isResetEmulatedMachine;
+    }
+
+    public boolean isForceResetEmulatedMachine() {
+        return this.forceResetEmulatedMachine;
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index c748e41..fcd6ff2 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -748,7 +748,8 @@
     
VDS_GROUP_CPU_HIGH_UTILIZATION_PERCENTAGE_MUST_BE_DEFINED_WHEN_USING_EVENLY_DISTRIBUTED(ErrorType.BAD_PARAMETERS),
     
VDS_GROUP_BOTH_LOW_AND_HIGH_CPU_UTILIZATION_PERCENTAGE_MUST_BE_DEFINED_WHEN_USING_POWER_SAVING(
             ErrorType.BAD_PARAMETERS),
-    VDS_GROUP_AT_LEAST_ONE_SERVICE_MUST_BE_ENABLED(ErrorType.BAD_PARAMETERS),
+    VDS_GROUP_HOSTS_MUST_BE_DOWN(ErrorType.BAD_PARAMETERS),
+    VDS_GROUP_AT_LEAST_ONE_SERVICE_MUST_BE_ENABLED(ErrorType.CONFLICT),
     
VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED(ErrorType.CONFLICT),
     
VDS_GROUP_CANNOT_DISABLE_VIRT_WHEN_CLUSTER_CONTAINS_VMS(ErrorType.CONFLICT),
     
VDS_GROUP_CANNOT_DISABLE_GLUSTER_WHEN_CLUSTER_CONTAINS_VOLUMES(ErrorType.CONFLICT),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 5e9cddf..2c5240b 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -463,6 +463,7 @@
 VDS_GROUP_CPU_TYPE_CANNOT_BE_NULL=Cannot add Cluster. CPU type must be 
specified
 VDS_GROUP_CANNOT_DO_ACTION_NAME_IN_USE=Cannot ${action} Cluster. Cluster name 
is already in use.
 VDS_GROUP_CANNOT_SET_TRUSTED_ATTESTATION_SERVER_NOT_CONFIGURED=Attestation 
server should be configured correctly.
+VDS_GROUP_HOSTS_MUST_BE_DOWN=Cannot update Cluster. Clusters hosts must be 
down in order to perform this action.
 NETWORK_NAME_ALREADY_EXISTS=Cannot ${action} ${type}. Network name already 
exists.
 ACTION_TYPE_FAILED_VNIC_PROFILE_NOT_EXISTS=Cannot ${action} ${type}. The 
specified VM network interface profile doesn't exist.
 ACTION_TYPE_FAILED_VNIC_PROFILE_NAME_IN_USE=Cannot ${action} ${type}. The VM 
network interface profile's name is already used by an existing profile for the 
same network.\n-Please choose a different name.
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ClusterResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ClusterResource.java
index 831d865..c8e1227 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ClusterResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ClusterResource.java
@@ -16,9 +16,14 @@
 
 package org.ovirt.engine.api.resource;
 
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
 
+import org.ovirt.engine.api.model.Action;
+import org.ovirt.engine.api.model.Actionable;
 import org.ovirt.engine.api.model.Cluster;
 import org.ovirt.engine.api.resource.gluster.GlusterHooksResource;
 import org.ovirt.engine.api.resource.gluster.GlusterVolumesResource;
@@ -43,4 +48,11 @@
 
     @Path("cpuprofiles")
     public AssignedCpuProfilesResource getCpuProfilesResource();
+
+    @POST
+    @Consumes({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
+    @Actionable
+    @Path("resetemulatedmachine")
+    public Response resetEmulatedMachine(Action action);
+
 }
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
index b384f23..5a67d30 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
@@ -1960,6 +1960,15 @@
     urlparams:
       max: {context: matrix, type: 'xs:int', value: 'max results', required: 
false}
     headers: {}
+- name: /clusters/{cluster:id}/resetemulatedmachine|rel=resetemulatedmachine
+  request:
+    body:
+      parameterType: Action
+      signatures: []
+    urlparams: {}
+    headers:
+      Content-Type: {value: application/xml|json, required: true}
+      Correlation-Id: {value: 'any string', required: false}
 - name: /clusters/{cluster:id}/networks/{network:id}|rel=get
   description: get the details of the specified network in the cluster
   request:
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java
index 4ad4677..185997f 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java
@@ -3,6 +3,7 @@
 
 import static 
org.ovirt.engine.api.restapi.resource.BackendClustersResource.SUB_COLLECTIONS;
 
+import org.ovirt.engine.api.model.Action;
 import org.ovirt.engine.api.model.Cluster;
 import org.ovirt.engine.api.resource.AffinityGroupsResource;
 import org.ovirt.engine.api.resource.AssignedCpuProfilesResource;
@@ -20,10 +21,14 @@
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.queries.GetPermissionsForObjectParameters;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
+import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
 import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.compat.Guid;
 
-public class BackendClusterResource extends 
AbstractBackendSubResource<Cluster, VDSGroup> implements
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class BackendClusterResource extends 
AbstractBackendActionableResource<Cluster, VDSGroup> implements
         ClusterResource {
 
     public BackendClusterResource(String id) {
@@ -89,4 +94,19 @@
     public AssignedCpuProfilesResource getCpuProfilesResource() {
         return inject(new BackendAssignedCpuProfilesResource(id));
     }
+
+    @Override
+    public Response resetEmulatedMachine(Action action) {
+        VdcQueryReturnValue result = runQuery(VdcQueryType.GetVdsGroupById, 
new IdQueryParameters(guid));
+        if (result != null && result.getSucceeded() && result.getReturnValue() 
!= null) {
+            VdsGroupOperationParameters param = new 
VdsGroupOperationParameters((VDSGroup)result.getReturnValue());
+            param.setForceResetEmulatedMachine(true);
+            return doAction(VdcActionType.UpdateVdsGroup, param, action);
+
+        } else {
+            throw new 
WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
+                    .entity("Couldn't locate a cluster with the specified id.")
+                    .build());
+        }
+    }
 }
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index 01a49e9..bd60c90 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -1300,6 +1300,9 @@
     @DefaultStringValue("Cannot Cannot add Cluster. CPU type must be 
specified.")
     String VDS_GROUP_CPU_TYPE_CANNOT_BE_NULL();
 
+    @DefaultStringValue("Cannot update Cluster. Clusters hosts must be down in 
order to perform this action.")
+    String VDS_GROUP_HOSTS_MUST_BE_DOWN();
+
     @DefaultStringValue("Cannot ${action} ${type}. Network name already 
exists.")
     String NETWORK_NAME_ALREADY_EXISTS();
 
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 f018dc1..c6042ad 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
@@ -362,6 +362,8 @@
 
     remove_cluster("remove_cluster", HelpTagType.WEBADMIN, "Cluster Tab > 
Remove"), //$NON-NLS-1$ //$NON-NLS-2$
 
+    reset_emulated_machine_cluster("reset_emulated_machine_cluster", 
HelpTagType.WEBADMIN, "Cluster Tab > Reset Emulated Machine"), //$NON-NLS-1$ 
//$NON-NLS-2$
+
     remove_cluster_policy("remove_cluster_policy", HelpTagType.WEBADMIN, 
"'Configure' dialog -> 'Scheduling Policy' section -> 'Remove Scheduling 
Policy' dialog"), //$NON-NLS-1$ //$NON-NLS-2$
 
     remove_data_center("remove_data_center", HelpTagType.WEBADMIN, "Data 
Center Tab > Remove Data Center(s)"), //$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 9b87ba0..564d6fb 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
@@ -112,6 +112,18 @@
         privateGuideCommand = value;
     }
 
+    private UICommand privateResetEmulatedMachineCommand;
+
+    public UICommand getResetEmulatedMachineCommand()
+    {
+        return privateResetEmulatedMachineCommand;
+    }
+
+    private void setResetEmulatedMachineCommand(UICommand value)
+    {
+        privateResetEmulatedMachineCommand = value;
+    }
+
     private UICommand privateAddMultipleHostsCommand;
 
     public UICommand getAddMultipleHostsCommand()
@@ -210,6 +222,7 @@
         setEditCommand(new UICommand("Edit", this)); //$NON-NLS-1$
         setRemoveCommand(new UICommand("Remove", this)); //$NON-NLS-1$
         setGuideCommand(new UICommand("Guide", this)); //$NON-NLS-1$
+        setResetEmulatedMachineCommand(new UICommand("ResetEmulatedMachine", 
this)); //$NON-NLS-1$
         setAddMultipleHostsCommand(new UICommand("AddHosts", this)); 
//$NON-NLS-1$
 
         updateActionAvailability();
@@ -487,6 +500,68 @@
         
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
         tempVar2.setIsCancel(true);
         model.getCommands().add(tempVar2);
+    }
+
+    public void resetEmulatedMachine()
+    {
+        if (getWindow() != null)
+        {
+            return;
+        }
+
+        ConfirmationModel model = new ConfirmationModel();
+        setWindow(model);
+        
model.setTitle(ConstantsManager.getInstance().getConstants().resetClusterEmulatedMachineTitle());
+        
model.setMessage(ConstantsManager.getInstance().getConstants().resetClusterEmulatedMachineMessage());
+        model.setHelpTag(HelpTag.reset_emulated_machine_cluster);
+        model.setHashName("reset_cluster_emulated_machine"); //$NON-NLS-1$
+
+        ArrayList<String> list = new ArrayList<String>();
+        for (VDSGroup vdsGroup : Linq.<VDSGroup> cast(getSelectedItems()))
+        {
+            list.add(vdsGroup.getName());
+        }
+        model.setItems(list);
+
+        UICommand applyCommand = new 
UICommand("OnResetClusterEmulatedMachine", this); //$NON-NLS-1$
+        
applyCommand.setTitle(ConstantsManager.getInstance().getConstants().ok());
+        applyCommand.setIsDefault(true);
+        model.getCommands().add(applyCommand);
+        UICommand cancelCommand = new UICommand("Cancel", this); //$NON-NLS-1$
+        
cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().cancel());
+        cancelCommand.setIsCancel(true);
+        model.getCommands().add(cancelCommand);
+    }
+
+    public void onResetClusterEmulatedMachine() {
+        ConfirmationModel model = (ConfirmationModel) getWindow();
+
+        if (model.getProgress() != null)
+        {
+            return;
+        }
+
+        ArrayList<VdcActionParametersBase> prms = new 
ArrayList<VdcActionParametersBase>();
+        for (Object vdsGroup : getSelectedItems())
+        {
+            VdsGroupOperationParameters currentParam = new 
VdsGroupOperationParameters(((VDSGroup) vdsGroup));
+            currentParam.setForceResetEmulatedMachine(true);
+            prms.add(currentParam);
+        }
+
+        model.startProgress(null);
+
+        Frontend.getInstance().runMultipleAction(VdcActionType.UpdateVdsGroup, 
prms,
+                new IFrontendMultipleActionAsyncCallback() {
+                    @Override
+                    public void executed(FrontendMultipleActionAsyncResult 
result) {
+
+                        ConfirmationModel localModel = (ConfirmationModel) 
result.getState();
+                        localModel.stopProgress();
+                        cancel();
+
+                    }
+                }, model);
     }
 
     public void onRemove()
@@ -1022,6 +1097,9 @@
 
         getRemoveCommand().setIsExecutionAllowed(getSelectedItems() != null && 
getSelectedItems().size() > 0);
 
+        getResetEmulatedMachineCommand().setIsExecutionAllowed(
+                getSelectedItems() != null && getSelectedItems().size() > 0);
+
         // System tree dependent actions.
         boolean isAvailable =
                 !(getSystemTreeSelectedItem() != null &&
@@ -1060,6 +1138,13 @@
         {
             guide();
         }
+        else if (command == getResetEmulatedMachineCommand())
+        {
+            resetEmulatedMachine();
+        }
+        else if ("OnResetClusterEmulatedMachine".equals(command.getName())) { 
//$NON-NLS-1$
+            onResetClusterEmulatedMachine();
+        }
         else if ("OnSave".equals(command.getName())) //$NON-NLS-1$
         {
             onSave();
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 6cc150e..7432202 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
@@ -74,6 +74,12 @@
     @DefaultStringValue("Remove Cluster(s)")
     String removeClusterTitle();
 
+    @DefaultStringValue("Reset Cluster(s) Emulated Machine")
+    String resetClusterEmulatedMachineTitle();
+
+    @DefaultStringValue("Are you sure you want to reset the Emulated-Machine 
of the following clusters?")
+    String resetClusterEmulatedMachineMessage();
+
     @DefaultStringValue("Change Cluster Compatibility Version")
     String changeClusterCompatibilityVersionTitle();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 03e3fe9..f024606 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -424,6 +424,7 @@
 VDS_GROUP_CANNOT_ADD_COMPATIBILITY_VERSION_WITH_LOWER_STORAGE_POOL=Cannot add 
Cluster with Compatibility Version that is lower than the Data Center 
Compatibility Version.\n\
        -Please upgrade your Cluster to a later Compatibility version first.
 VDS_GROUP_CPU_TYPE_CANNOT_BE_NULL=Cannot add Cluster. CPU type must be 
specified.
+VDS_GROUP_HOSTS_MUST_BE_DOWN=Cannot update Cluster. Clusters hosts must be 
down in order to perform this action.
 VDS_GROUP_CANNOT_DO_ACTION_NAME_IN_USE=Cannot ${action} Cluster. Cluster name 
is already in use.
 NETWORK_NAME_ALREADY_EXISTS=Cannot ${action} ${type}. Network name already 
exists.
 ACTION_TYPE_FAILED_NAME_ALREADY_USED=Cannot ${action} ${type}. The ${type} 
name is already in use, please choose a unique name and try again.
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index f3e6b7b..5b1fe1f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -1402,6 +1402,9 @@
     @DefaultStringValue("Guide Me")
     String guideMeCluster();
 
+    @DefaultStringValue("Reset Emulated Machine")
+    String resetClusterEmulatedMachine();
+
     @DefaultStringValue("Used Memory/Total")
     String usedMemoryTotalCluster();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
index f3de85c..e7e9f74 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
@@ -65,6 +65,7 @@
             final Provider<ClusterPopupPresenterWidget> popupProvider,
             final Provider<GuidePopupPresenterWidget> guidePopupProvider,
             final Provider<RemoveConfirmationPopupPresenterWidget> 
removeConfirmPopupProvider,
+            final Provider<DefaultConfirmationPopupPresenterWidget> 
resetEmulatedMachineConfirmPopupProvider,
             final Provider<ReportPresenterWidget> reportWindowProvider,
             final Provider<MultipleHostsPopupPresenterWidget> 
addMultipleHostsPopupProvider,
             final Provider<ClusterListModel> clusterProvider,
@@ -91,6 +92,8 @@
                     UICommand lastExecutedCommand) {
                 if (lastExecutedCommand == getModel().getRemoveCommand()) {
                     return removeConfirmPopupProvider.get();
+                } else if (lastExecutedCommand == 
getModel().getResetEmulatedMachineCommand()) {
+                    return resetEmulatedMachineConfirmPopupProvider.get();
                 } else {
                     return super.getConfirmModelPopup(source, 
lastExecutedCommand);
                 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabClusterView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabClusterView.java
index 88c0b10..e8cf296 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabClusterView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabClusterView.java
@@ -8,6 +8,7 @@
 import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
 import org.ovirt.engine.ui.common.uicommon.model.MainModelProvider;
 import org.ovirt.engine.ui.common.widget.action.ActionButtonDefinition;
+import org.ovirt.engine.ui.common.widget.action.CommandLocation;
 import org.ovirt.engine.ui.common.widget.table.column.TextColumnWithTooltip;
 import org.ovirt.engine.ui.uicommonweb.ReportInit;
 import org.ovirt.engine.ui.uicommonweb.UICommand;
@@ -158,6 +159,14 @@
                 return getMainModel().getGuideCommand();
             }
         });
+
+        getTable().addActionButton(new 
WebAdminButtonDefinition<VDSGroup>(constants.resetClusterEmulatedMachine(),
+                CommandLocation.OnlyFromContext) {
+            @Override
+            protected UICommand resolveCommand() {
+                return getMainModel().getResetEmulatedMachineCommand();
+            }
+        });
     }
 
     public void updateReportsAvailability(ApplicationConstants constants) {
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 5eb6b4c..d819ddc 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -465,6 +465,7 @@
        -Please upgrade your Cluster to a later Compatibility version first.
 VDS_GROUP_CPU_TYPE_CANNOT_BE_NULL=Cannot add Cluster. CPU type must be 
specified.
 VDS_GROUP_CANNOT_DO_ACTION_NAME_IN_USE=Cannot ${action} Cluster. Cluster name 
is already in use.
+VDS_GROUP_HOSTS_MUST_BE_DOWN=Cannot update Cluster. Clusters hosts must be 
down in order to perform this action.
 NETWORK_NAME_ALREADY_EXISTS=Cannot ${action} ${type}. Network name already 
exists.
 ACTION_TYPE_FAILED_VNIC_PROFILE_NOT_EXISTS=Cannot ${action} ${type}. The 
specified VM network interface profile doesn't exist.
 ACTION_TYPE_FAILED_VNIC_PROFILE_NAME_IN_USE=Cannot ${action} ${type}. The VM 
network interface profile's name is already used by an existing profile for the 
same network.\n-Please choose a different name.


-- 
To view, visit http://gerrit.ovirt.org/37115
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e1f70cbbe46fa54edda3f0aa9e56bfd576b8266
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