Ramesh N has uploaded a new change for review.

Change subject: engine: <WIP> BLL Command to Start Remove Gluster volume brick
......................................................................

engine: <WIP> BLL Command to Start Remove Gluster volume brick

Start remove gluster volume brick is an asynchronous operation started from the 
console.
IT starts migarting all the data in the brick(s) being removed before the 
removing
the brick completly. On completion of the migration, user has to commit the 
remove
operation to finally remove the brick from volume.

Calling this command starts an async task in gluster. Gluster returns a task-id
that is used to monitor status of the task and update the UI.
StartRebalanceGlusterVolumeCommand extends from GlusterAsyncCommandBase that 
handles
return of task information from Gluster and updating corresponding step.

Change-Id: Ie3ee4620b75b4b714087dbf1dec3720661a5ce6b
Signed-off-by: Ramesh Nachimuthu <rnach...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommand.java
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBrickCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/job/StepEnum.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDao.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
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/models/gluster/VolumeBrickListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
M 
frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M packaging/dbscripts/gluster_volumes_sp.sql
20 files changed, 217 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/18923/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommand.java
index 1802194..d4ef00b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRebalanceGlusterVolumeCommand.java
@@ -32,7 +32,6 @@
         super.setActionMessageParameters();
     }
 
-
     @Override
     protected boolean canDoAction() {
         GlusterVolumeEntity glusterVolume = getGlusterVolume();
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBrickCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBrickCommand.java
new file mode 100644
index 0000000..bd5fa55
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StartRemoveGlusterVolumeBrickCommand.java
@@ -0,0 +1,163 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.ovirt.engine.core.bll.LockIdNameAttribute;
+import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
+import org.ovirt.engine.core.common.AuditLogType;
+import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters;
+import org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.job.StepEnum;
+import org.ovirt.engine.core.common.validation.group.gluster.RemoveBrick;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeRemoveBricksVDSParameters;
+
+/**
+ * BLL command to Start Remove Bricks from Gluster volume. Before removing the 
brick, it will migrate all content from
+ * brick in an async task.
+ */
+@NonTransactiveCommandAttribute
+@LockIdNameAttribute(isReleaseAtEndOfExecute = false)
+public class StartRemoveGlusterVolumeBrickCommand extends 
GlusterAsyncCommandBase<GlusterVolumeRemoveBricksParameters> {
+    private List<GlusterBrickEntity> bricks = new 
ArrayList<GlusterBrickEntity>();;
+
+    public 
StartRemoveGlusterVolumeBrickCommand(GlusterVolumeRemoveBricksParameters 
params) {
+        super(params);
+    }
+
+    @Override
+    protected List<Class<?>> getValidationGroups() {
+        addValidationGroup(RemoveBrick.class);
+        return super.getValidationGroups();
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        super.setActionMessageParameters();
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__START_REMOVE);
+        addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_BRICK);
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+        if (getParameters().getBricks() == null || 
getParameters().getBricks().size() == 0) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED);
+            return false;
+        }
+        if (getGlusterVolume().getBricks().size() == 1 ||
+                getGlusterVolume().getBricks().size() <= 
getParameters().getBricks().size()) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REMOVE_ALL_BRICKS_FROM_VOLUME);
+            return false;
+        }
+        if (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE
+                || getGlusterVolume().getVolumeType() == 
GlusterVolumeType.DISTRIBUTED_REPLICATE) {
+            if (getParameters().getReplicaCount() < 
getGlusterVolume().getReplicaCount() - 1) {
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_MORE_THAN_ONE);
+                return false;
+            } else if (getParameters().getReplicaCount() > 
getGlusterVolume().getReplicaCount()) {
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT);
+                return false;
+            }
+        }
+        return validateBricks(getParameters().getBricks());
+    }
+
+    @Override
+    protected void executeCommand() {
+        int replicaCount =
+                (getGlusterVolume().getVolumeType() == 
GlusterVolumeType.REPLICATE
+                || getGlusterVolume().getVolumeType() == 
GlusterVolumeType.DISTRIBUTED_REPLICATE)
+                        ? getParameters().getReplicaCount()
+                        : 0;
+
+        startSubStep();
+        VDSReturnValue returnValue =
+                runVdsCommand(
+                        VDSCommandType.StartRemoveGlusterVolumeBrick,
+                        new 
GlusterVolumeRemoveBricksVDSParameters(upServer.getId(),
+                                getGlusterVolumeName(), bricks, replicaCount, 
false));
+        setSucceeded(returnValue.getSucceeded());
+        if (!getSucceeded()) {
+            
handleVdsError(AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED, 
returnValue.getVdsError()
+                    .getMessage());
+            return;
+        }
+        GlusterAsyncTask glusterTask = (GlusterAsyncTask) 
returnValue.getReturnValue();
+        handleTaskReturn(glusterTask);
+        updateBricksWithTaskID(glusterTask);
+        getReturnValue().setActionReturnValue(returnValue.getReturnValue());
+    }
+
+    private void updateBricksWithTaskID(GlusterAsyncTask asyncTask) {
+        for (GlusterBrickEntity brickEntity : getParameters().getBricks()) {
+            getGlusterBrickDao().updateBrickTask(brickEntity.getId(), 
asyncTask.getTaskId());
+        }
+        getGlusterVolumeDao().updateVolumeTask(getGlusterVolumeId(), 
asyncTask.getTaskId());
+    }
+
+    /**
+     * Checks that all brick ids passed are valid, also populating the class 
level bricks list with populated brick
+     * objects obtained from the volume.
+     *
+     * @param bricks
+     *            The bricks to validate
+     * @return true if all bricks have valid ids, else false
+     */
+    private boolean validateBricks(List<GlusterBrickEntity> bricks) {
+        GlusterVolumeEntity volume = getGlusterVolume();
+        for (GlusterBrickEntity brick : bricks) {
+            if (brick.getServerName() != null && brick.getBrickDirectory() != 
null) {
+                // brick already contains required info.
+                this.bricks.add(brick);
+                continue;
+            }
+
+            if (brick.getId(false) == null) {
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED);
+                return false;
+            }
+
+            GlusterBrickEntity brickFromVolume = 
volume.getBrickWithId(brick.getId());
+            if (brickFromVolume == null) {
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_BRICK_INVALID);
+                return false;
+            } else {
+                this.bricks.add(brickFromVolume);
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        if (getSucceeded()) {
+            return AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS;
+        } else {
+            return errorType == null ? 
AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED : errorType;
+        }
+    }
+
+    @Override
+    protected StepEnum getStepType() {
+        return StepEnum.REMOVING_GLUSTER_VOLUME_BIRCK;
+    }
+
+    @Override
+    protected void freeLock() {
+        // We have to keep the lock acquired on gluster volume if start remove 
brick was success, otherwsie we should
+        // release all the locks.
+        if (!getSucceeded()) {
+            super.freeLock();
+        }
+    }
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index e22f1bc..72ad5d8 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -282,6 +282,8 @@
     GLUSTER_HOST_UUID_NOT_FOUND(4075),
     GLUSTER_VOLUME_BRICK_ADDED(4076),
     GLUSTER_CLUSTER_SERVICE_STATUS_ADDED(4077),
+    START_REMOVING_GLUSTER_VOLUME_BRICKS(4078),
+    START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED(4079),
 
     USER_FORCE_SELECTED_SPM(159),
     USER_VDS_RESTART(41),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
index ed9d456..d126451 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
@@ -67,6 +67,10 @@
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_ADD_BRICK_FAILED);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED);
+        AddEventNotificationEntry(EventNotificationEntity.GlusterVolume,
+                AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS);
+        AddEventNotificationEntry(EventNotificationEntity.GlusterVolume,
+                AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_REBALANCE_START);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_REBALANCE_START_FAILED);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_REPLACE_BRICK_FAILED);
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
index 0eb69d1..d1bf4ca 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
@@ -258,6 +258,7 @@
     
RemoveGlusterHook(1418,ActionGroup.MANIPULATE_GLUSTER_HOOK,QuotaDependency.NONE),
     RefreshGlusterHooks(1419, ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
     ManageGlusterService(1420, ActionGroup.MANIPULATE_GLUSTER_SERVICE, 
QuotaDependency.NONE),
+    StartRemoveGlusterVolumeBrick(1421, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
     // Cluster Policy
     AddClusterPolicy(1450, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, 
QuotaDependency.NONE),
     EditClusterPolicy(1451, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, 
false, QuotaDependency.NONE),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java
index f2ec846..2cfbdfb 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java
@@ -7,6 +7,7 @@
 
 public enum GlusterTaskType {
     REBALANCE_VOLUME(StepEnum.REBALANCING_VOLUME),
+    REMOVING_GLUSTER_VOLUME_BIRCK(StepEnum.REMOVING_GLUSTER_VOLUME_BIRCK),
     ;
 
     private StepEnum step;
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 4237462..de9ee81 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
@@ -82,6 +82,7 @@
     VAR__ACTION__LOGON,
     VAR__ACTION__LOGOFF,
     VAR__ACTION__REBALANCE_START,
+    VAR__ACTION__START_REMOVE,
     VAR__ACTION__ASSIGN,
     VAR__ACTION__START_PROFILE,
     VAR__ACTION__STOP_PROFILE,
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/job/StepEnum.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/job/StepEnum.java
index 6f9a6b5..87cb70b 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/job/StepEnum.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/job/StepEnum.java
@@ -23,6 +23,7 @@
     // Gluster
     SETTING_GLUSTER_OPTION,
     REBALANCING_VOLUME,
+    REMOVING_GLUSTER_VOLUME_BIRCK,
 
     /**
      * Maps VDSM tasks type to {@code StepEnum} so it can be resolvable as 
readable description
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
index 3471ef4..4ac4513 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
@@ -90,6 +90,8 @@
         severities.put(AuditLogType.GLUSTER_VOLUME_DELETE_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, 
AuditLogSeverity.ERROR);
+        severities.put(AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS, 
AuditLogSeverity.NORMAL);
+        
severities.put(AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_VOLUME_REBALANCE_START, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.GLUSTER_VOLUME_REBALANCE_START_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_VOLUME_ADD_BRICK, 
AuditLogSeverity.NORMAL);
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDao.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDao.java
index 1258690..f6d01d5 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDao.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDao.java
@@ -31,4 +31,6 @@
     public List<GlusterBrickEntity> getGlusterVolumeBricksByServerId(Guid 
serverId);
 
     public GlusterBrickEntity getBrickByServerIdAndDirectory(Guid serverId, 
String brickDirectory);
+
+    public void updateBrickTask(Guid brickId, Guid taskId);
 }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java
index d859808..1bd618e 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java
@@ -55,13 +55,13 @@
     public void updateBrickStatus(Guid brickId, GlusterStatus status) {
         getCallsHandler().executeModification("UpdateGlusterVolumeBrickStatus",
                 getCustomMapSqlParameterSource()
-                .addValue("id", brickId)
-                .addValue("status", EnumUtils.nameOrNull(status)));
+                        .addValue("id", brickId)
+                        .addValue("status", EnumUtils.nameOrNull(status)));
     }
 
     @Override
     public void updateBrickStatuses(List<GlusterBrickEntity> bricks) {
-        for(GlusterBrickEntity brick : bricks) {
+        for (GlusterBrickEntity brick : bricks) {
             updateBrickStatus(brick.getId(), brick.getStatus());
         }
     }
@@ -87,7 +87,6 @@
                 "GetBricksByGlusterVolumeGuid", brickRowMapper,
                 getCustomMapSqlParameterSource().addValue("volume_id", 
volumeId));
     }
-
 
     private MapSqlParameterSource createBrickParams(GlusterBrickEntity brick) {
         return getCustomMapSqlParameterSource().addValue("id", brick.getId())
@@ -118,6 +117,7 @@
             brick.setBrickDirectory(rs.getString("brick_dir"));
             brick.setBrickOrder(rs.getInt("brick_order"));
             brick.setStatus(GlusterStatus.valueOf(rs.getString("status")));
+            brick.getAsyncTask().setTaskId(getGuidDefaultEmpty(rs, "task_id"));
             return brick;
         }
 
@@ -158,4 +158,13 @@
     protected RowMapper<GlusterBrickEntity> createEntityRowMapper() {
         return brickRowMapper;
     }
+
+    @Override
+    public void updateBrickTask(Guid brickId, Guid taskId) {
+        
getCallsHandler().executeModification("UpdateGlusterVolumeBrickAsyncTask",
+                getCustomMapSqlParameterSource().
+                        addValue("id", brickId).
+                        addValue("task_id", taskId));
+    }
+
 }
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 20f6172..636094f 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -293,6 +293,7 @@
 VAR__ACTION__LOGOFF=$action log off
 VAR__ACTION__ASSIGN=$action assign
 VAR__ACTION__REBALANCE_START=$action rebalance
+VAR__ACTION__START_REMOVE=$action start removing 
 VAR__ACTION__START_PROFILE=$action start profiling
 VAR__ACTION__STOP_PROFILE=$action stop profiling
 VAR__ACTION__ENABLE=$action enable
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index 24b4736..319d8e7 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -610,12 +610,14 @@
 GLUSTER_VOLUME_OPTIONS_RESET_FAILED=Could not reset Gluster Volume 
${glusterVolumeName} Options.
 GLUSTER_VOLUME_DELETE=Gluster Volume ${glusterVolumeName} deleted.
 GLUSTER_VOLUME_DELETE_FAILED=Could not delete Gluster Volume 
${glusterVolumeName}.
-GLUSTER_VOLUME_REMOVE_BRICKS=Gluster Volume ${glusterVolumeName} Bricks 
removed.
+GLUSTER_VOLUME_REMOVE_BRICKS=Bricks removed from Gluster Volume 
${glusterVolumeName}.
 GLUSTER_VOLUME_REMOVE_BRICKS_FAILED=Could not remove Gluster Volume 
${glusterVolumeName} Bricks.
 GLUSTER_VOLUME_ADD_BRICK= ${NoOfBricks} volume brick(s) added to volume 
${glusterVolumeName}.
 GLUSTER_VOLUME_ADD_BRICK_FAILED=Gluster Volume ${glusterVolumeName} add brick 
failed.
 GLUSTER_VOLUME_REBALANCE_START=Gluster Volume ${glusterVolumeName} rebalance 
started.
 GLUSTER_VOLUME_REBALANCE_START_FAILED=Could not start Gluster Volume 
${glusterVolumeName} rebalance.
+START_REMOVING_GLUSTER_VOLUME_BRICKS=Started removing brick from Gluser Volume 
${glusterVolumeName}
+START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED=Could not remove brick from Gluser 
Volume ${glusterVolumeName}
 GLUSTER_VOLUME_REPLACE_BRICK_FAILED=Replace Gluster Volume Brick failed
 GLUSTER_VOLUME_REPLACE_BRICK_START=Gluster Volume ${glusterVolumeName} Replace 
Brick started.
 GLUSTER_VOLUME_REPLACE_BRICK_START_FAILED=Could not start Gluster Volume 
${glusterVolumeName} Replace Brick.
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
index 5db9257..a4595a8 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -132,6 +132,7 @@
 # Gluster step types
 step.SETTING_GLUSTER_OPTION=Setting option ${Key}=${Value} on volume 
${GlusterVolume} of cluster ${Cluster}
 step.REBALANCING_VOLUME=Rebalancing Gluster Volume ${GlusterVolume} in Cluster 
${Cluster}.( ${Status} ${info})
+step.REMOVING_GLUSTER_VOLUME_BIRCK = Removing Bricks from Gluster Volume 
${GlusterVolume} in Cluster ${Cluster}.( ${Status} ${info})
 
 # Non-monitored job:
 job.AddVmInterface=Adding Network Interface ${InterfaceName} to VM ${VM}
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 7278f28..ac44adb 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
@@ -805,6 +805,9 @@
     @DefaultStringValue("$action rebalance")
     String VAR__ACTION__REBALANCE_START();
 
+    @DefaultStringValue("$action start removing")
+    String VAR__ACTION__START_REMOVE();
+
     @DefaultStringValue("$action start profiling")
     String VAR__ACTION__START_PROFILE();
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java
index 40cfc4f..238e6ad 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java
@@ -697,7 +697,7 @@
 
         model.startProgress(null);
 
-        Frontend.RunAction(VdcActionType.GlusterVolumeRemoveBricks, parameter, 
new IFrontendActionAsyncCallback() {
+        Frontend.RunAction(VdcActionType.StartRemoveGlusterVolumeBrick, 
parameter, new IFrontendActionAsyncCallback() {
 
             @Override
             public void executed(FrontendActionAsyncResult result) {
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
index f8d9c6e..4a2b54b 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
@@ -258,6 +258,10 @@
 
     String AuditLogType___GLUSTER_VOLUME_REMOVE_BRICKS_FAILED();
 
+    String AuditLogType___START_REMOVING_GLUSTER_VOLUME_BRICKS();
+
+    String AuditLogType___START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED();
+
     String AuditLogType___GLUSTER_VOLUME_ADD_BRICK();
 
     String AuditLogType___GLUSTER_VOLUME_ADD_BRICK_FAILED();
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
index 35e9e08..96f5ed9 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
+++ 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
@@ -125,6 +125,8 @@
 AuditLogType___GLUSTER_VOLUME_DELETE_FAILED=Gluster Volume could not be deleted
 AuditLogType___GLUSTER_VOLUME_REMOVE_BRICKS=Gluster Volume Bricks Removed
 AuditLogType___GLUSTER_VOLUME_REMOVE_BRICKS_FAILED=Gluster Volume Bricks could 
not be removed
+AuditLogType___START_REMOVING_GLUSTER_VOLUME_BRICKS=Started removing Gluster 
Volume Bricks
+AuditLogType___START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED=Could not remove 
Gluster volume bricks
 AuditLogType___GLUSTER_VOLUME_ADD_BRICK=Gluster Volume brick(s) added
 AuditLogType___GLUSTER_VOLUME_ADD_BRICK_FAILED=Failed to add brick(s) on 
Gluster Volume
 AuditLogType___GLUSTER_VOLUME_REBALANCE_START=Gluster Volume Rebalance started
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 223c2be..cefb4ed 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
@@ -296,6 +296,7 @@
 VAR__ACTION__LOGON=$action log on
 VAR__ACTION__LOGOFF=$action log off
 VAR__ACTION__REBALANCE_START=$action rebalance
+VAR__ACTION__START_REMOVE=$action start removing
 VAR__ACTION__START_PROFILE=$action start profiling
 VAR__ACTION__STOP_PROFILE=$action stop profiling
 VAR__ACTION__ASSIGN=$action assign
diff --git a/packaging/dbscripts/gluster_volumes_sp.sql 
b/packaging/dbscripts/gluster_volumes_sp.sql
index e729753..6988053 100644
--- a/packaging/dbscripts/gluster_volumes_sp.sql
+++ b/packaging/dbscripts/gluster_volumes_sp.sql
@@ -444,6 +444,17 @@
 END; $procedure$
 LANGUAGE plpgsql;
 
+Create or replace FUNCTION UpdateGlusterVolumeBrickAsyncTask(v_id UUID, 
v_task_id UUID)
+    RETURNS VOID
+    AS $procedure$
+BEGIN
+    UPDATE  gluster_volume_bricks
+    SET     task_id = v_task_id,
+            _update_date = LOCALTIMESTAMP
+    WHERE   id = v_id;
+END; $procedure$
+LANGUAGE plpgsql;
+
 Create or replace FUNCTION UpdateGlusterVolumeStatusByName(v_cluster_id UUID,
                                                     v_vol_name VARCHAR(1000),
                                                     v_status VARCHAR(32))


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3ee4620b75b4b714087dbf1dec3720661a5ce6b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ramesh N <rnach...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to