Sahina Bose has uploaded a new change for review.

Change subject: gluster: Add gluster hook to missing servers
......................................................................

gluster: Add gluster hook to missing servers

Add gluster hook based on engine's copy of hook
content and status to servers in cluster where the
hook is missing.

Change-Id: I6a9b47b18e6fffc43393fdcf09f09f714f734b3d
Signed-off-by: Sahina Bose <sab...@redhat.com>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java
A 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommandTest.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/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.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/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
12 files changed, 367 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/93/15093/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java
new file mode 100644
index 0000000..c2eaec9
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java
@@ -0,0 +1,170 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.SystemUtils;
+import org.ovirt.engine.core.bll.LockIdNameAttribute;
+import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
+import org.ovirt.engine.core.bll.interfaces.BackendInternal;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters;
+import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSStatus;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook;
+import org.ovirt.engine.core.common.constants.gluster.GlusterConstants;
+import org.ovirt.engine.core.common.utils.Pair;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterHookVDSParameters;
+import org.ovirt.engine.core.dal.VdcBllMessages;
+import org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil;
+
+/**
+ * BLL command to add gluster hook on servers where the hook is missing
+ */
+@NonTransactiveCommandAttribute
+@LockIdNameAttribute(isWait = true)
+public class AddGlusterHookCommand extends 
GlusterHookCommandBase<GlusterHookManageParameters> {
+    private GlusterHookEntity entity;
+
+    protected List<String> errors = new ArrayList<String>();
+
+    public AddGlusterHookCommand(GlusterHookManageParameters params) {
+        super(params);
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE);
+        addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_HOOK);
+    }
+
+    @Override
+    protected BackendInternal getBackend() {
+        return super.getBackend();
+    }
+
+    protected GlusterHookEntity getGlusterHook() {
+        if (entity == null) {
+            entity = 
getGlusterHooksDao().getById(getParameters().getHookId(),true);
+        }
+        return entity;
+    }
+
+    private List<GlusterServerHook> getMissingServerHooks() {
+        //get all destination servers - only serverhooks where hook is missing
+        List<GlusterServerHook> serverHooks = new 
ArrayList<GlusterServerHook>();
+        for (GlusterServerHook serverHook: getGlusterHook().getServerHooks()) {
+            if (serverHook.getStatus().equals(GlusterHookStatus.MISSING)) {
+                serverHooks.add(serverHook);
+            }
+        }
+        return serverHooks;
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
+        if (getMissingServerHooks().isEmpty()) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS);
+            return false;
+        }
+
+        for (GlusterServerHook serverHook: getMissingServerHooks()) {
+            VDS vds = getVdsDAO().get(serverHook.getServerId());
+            if (vds == null || vds.getStatus() != VDSStatus.Up) {
+                setVdsName(vds.getName());
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP);
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void executeCommand() {
+
+        entity = getGlusterHook();
+        addCustomValue(GlusterConstants.HOOK_NAME, entity.getName());
+
+        final boolean hookEnabled = entity.getStatus() == 
GlusterHookStatus.ENABLED ? true : false;
+
+        List<Callable<Pair<GlusterServerHook, VDSReturnValue>>> taskList = new 
ArrayList<Callable<Pair<GlusterServerHook, VDSReturnValue>>>();
+        for (final GlusterServerHook serverHook : getMissingServerHooks()) {
+            taskList.add(new Callable<Pair<GlusterServerHook, 
VDSReturnValue>>() {
+                @Override
+                public Pair<GlusterServerHook, VDSReturnValue> call() throws 
Exception {
+                    VDSReturnValue returnValue;
+                        returnValue =
+                               runVdsCommand(
+                                       VDSCommandType.AddGlusterHook,
+                                       new 
GlusterHookVDSParameters(serverHook.getServerId(),
+                                               entity.getGlusterCommand(),
+                                               entity.getStage(),
+                                               entity.getName(),
+                                               entity.getContent(),
+                                               entity.getChecksum(),
+                                               hookEnabled));
+                     return new Pair<GlusterServerHook, 
VDSReturnValue>(serverHook, returnValue);
+
+                }
+            });
+        }
+
+        setSucceeded(true);
+        if (!taskList.isEmpty()) {
+            List<Pair<GlusterServerHook, VDSReturnValue>> pairResults = 
ThreadPoolUtil.invokeAll(taskList);
+            for (Pair<GlusterServerHook, VDSReturnValue> pairResult : 
pairResults) {
+
+                VDSReturnValue retValue = pairResult.getSecond();
+                if (!retValue.getSucceeded() ) {
+                    errors.add(retValue.getVdsError().getMessage());
+                 }
+            }
+        } else {
+            setSucceeded(false);
+        }
+
+        if (errors.size() > 0) {
+            setSucceeded(false);
+            errorType =  AuditLogType.GLUSTER_HOOK_ADD_FAILED;
+            handleVdsErrors(getAuditLogTypeValue(), errors);
+            addCustomValue(GlusterConstants.FAILURE_MESSAGE , 
StringUtils.join(errors, SystemUtils.LINE_SEPARATOR));
+        }
+
+        if (getSucceeded()) {
+            entity.removeMissingConflict();
+            getGlusterHooksDao().updateGlusterHook(entity);
+        }
+
+    }
+
+
+    @Override
+    public Map<String, String> getJobMessageProperties() {
+        if (jobProperties == null) {
+            jobProperties = super.getJobMessageProperties();
+            if (getGlusterHook() != null) {
+                 jobProperties.put(GlusterConstants.HOOK_NAME, 
getGlusterHook().getName());
+            }
+        }
+
+        return jobProperties;
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        return getSucceeded() ? AuditLogType.GLUSTER_HOOK_ADDED : errorType;
+    }
+
+}
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java
index e0533e7..1ccc854 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java
@@ -159,7 +159,7 @@
                             newHook.setClusterId(clusterId);
                             newHook.setId(Guid.NewGuid());
                             log.infoFormat("Detected new hook {0} in server 
{1}, adding to engine hooks", key,server);
-                            logMessage(clusterId, key, 
AuditLogType.GLUSTER_HOOK_ADDED);
+                            logMessage(clusterId, key, 
AuditLogType.GLUSTER_HOOK_DETECTED_NEW);
 
                             updateContentTasksList(contentTasksList, newHook, 
server);
 
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommandTest.java
new file mode 100644
index 0000000..9005b5a
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommandTest.java
@@ -0,0 +1,171 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters;
+import org.ovirt.engine.core.common.businessentities.VDSStatus;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook;
+import org.ovirt.engine.core.common.errors.VDSError;
+import org.ovirt.engine.core.common.errors.VdcBllErrors;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSParametersBase;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import 
org.ovirt.engine.core.common.vdscommands.gluster.GlusterHookVDSParameters;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dal.VdcBllMessages;
+import org.ovirt.engine.core.dao.VdsDAO;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class AddGlusterHookCommandTest extends 
GlusterHookCommandTest<AddGlusterHookCommand> {
+    /**
+     * The command under test.
+     */
+    AddGlusterHookCommand cmd;
+
+    @Mock
+    private VdsDAO vdsDao;
+
+    private static final Guid SERVER_ID = Guid.NewGuid();
+
+    private void setUpMocksForAdd() {
+        setUpMocksForAdd(true);
+    }
+
+    private void setUpMocksForAdd(boolean hookFound) {
+        setUpMocksForAdd(hookFound, getHookEntityWithMissing());
+    }
+
+    private void setUpMocksForAdd(boolean hookFound, GlusterHookEntity hook) {
+        setUpMocksForAdd(hookFound, hook, VDSStatus.Up);
+    }
+
+    private void setUpMocksForAdd(VDSStatus status) {
+        setUpMocksForAdd(true, getHookEntityWithMissing(), status);
+    }
+
+    private GlusterHookEntity getHookEntityWithMissing() {
+        GlusterHookEntity hook = getHookEntity();
+        List<GlusterServerHook> serverHooks = new 
ArrayList<GlusterServerHook>();
+        serverHooks.add(getGlusterServerHook(0, GlusterHookStatus.MISSING));
+        serverHooks.add(getGlusterServerHook(1, GlusterHookStatus.MISSING));
+        serverHooks.add(getGlusterServerHook(2, GlusterHookStatus.MISSING));
+        hook.setServerHooks(serverHooks);
+        return hook;
+    }
+
+    private void setUpMocksForAdd(boolean hookFound, GlusterHookEntity hook, 
VDSStatus status) {
+        setupMocks(cmd,hookFound, hook);
+        doReturn(vdsDao).when(cmd).getVdsDAO();
+        when(vdsDao.get(any(Guid.class))).thenReturn(getServer(SERVER_ID, 
"gfs1", CLUSTER_ID,status));
+    }
+
+    private void mockBackend(boolean succeeded, VdcBllErrors errorCode) {
+        when(cmd.getBackend()).thenReturn(backend);
+        when(backend.getResourceManager()).thenReturn(vdsBrokerFrontend);
+
+        VDSReturnValue vdsReturnValue = new VDSReturnValue();
+        vdsReturnValue.setSucceeded(succeeded);
+        if (!succeeded) {
+            vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
+        }
+        
when(vdsBrokerFrontend.RunVdsCommand(eq(VDSCommandType.AddGlusterHook), 
argThat(anyHookVDS()))).thenReturn(vdsReturnValue);
+     }
+
+    private ArgumentMatcher<VDSParametersBase> anyHookVDS() {
+        return new ArgumentMatcher<VDSParametersBase>() {
+
+            @Override
+            public boolean matches(Object argument) {
+                if (!(argument instanceof GlusterHookVDSParameters)) {
+                    return false;
+                }
+                return true;
+            }
+        };
+    }
+
+    @Test
+    public void executeCommand() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(HOOK_ID)));
+        setUpMocksForAdd();
+        mockBackend(true, null);
+        cmd.executeCommand();
+        verify(hooksDao, 
times(1)).updateGlusterHook(any(GlusterHookEntity.class));
+        assertEquals(cmd.getAuditLogTypeValue(), 
AuditLogType.GLUSTER_HOOK_ADDED);
+    }
+
+
+    @Test
+    public void executeCommandWhenFailed() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(HOOK_ID)));
+        setUpMocksForAdd();
+        mockBackend(false,VdcBllErrors.GlusterHookAddFailed);
+        cmd.executeCommand();
+        verify(hooksDao, 
never()).updateGlusterHook(any(GlusterHookEntity.class));
+        assertEquals(cmd.getAuditLogTypeValue(), 
AuditLogType.GLUSTER_HOOK_ADD_FAILED);
+    }
+
+    @Test
+    public void canDoActionSucceeds() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(HOOK_ID)));
+        setUpMocksForAdd();
+        assertTrue(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsOnNullHookId() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(null)));
+        setUpMocksForAdd();
+        assertFalse(cmd.canDoAction());
+        
assertTrue(cmd.getReturnValue().getCanDoActionMessages().contains(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED.toString()));
+    }
+
+    @Test
+    public void canDoActionFailsOnNoHook() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(HOOK_ID)));
+        setUpMocksForAdd(false);
+        assertFalse(cmd.canDoAction());
+        
assertTrue(cmd.getReturnValue().getCanDoActionMessages().contains(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST.toString()));
+    }
+
+    @Test
+    public void canDoActionFailsOnNoConflictServers() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(HOOK_ID)));
+        GlusterHookEntity hook = getHookEntity();
+        setUpMocksForAdd(true,hook);
+        assertFalse(cmd.canDoAction());
+        
assertTrue(cmd.getReturnValue().getCanDoActionMessages().contains(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString()));
+    }
+
+    @Test
+    public void canDoActionFailsOnServerNotUp() {
+        cmd = spy(new AddGlusterHookCommand(new 
GlusterHookManageParameters(HOOK_ID)));
+        setUpMocksForAdd(VDSStatus.Down);
+        assertFalse(cmd.canDoAction());
+        
assertTrue(cmd.getReturnValue().getCanDoActionMessages().contains(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP.toString()));
+    }
+
+}
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 33bbe45..dca8cf8 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
@@ -247,8 +247,8 @@
     GLUSTER_HOOK_DISABLE_PARTIAL(4047),
     GLUSTER_HOOK_LIST_FAILED(4048),
     GLUSTER_HOOK_CONFLICT_DETECTED(4049),
-    GLUSTER_HOOK_ADDED(4050),
-    GLUSTER_HOOK_REMOVED(4051),
+    GLUSTER_HOOK_DETECTED_NEW(4050),
+    GLUSTER_HOOK_DETECTED_DELETE(4051),
     GLUSTER_VOLUME_OPTION_MODIFIED(4052),
     GLUSTER_HOOK_GETCONTENT_FAILED(4053),
     GLUSTER_SERVICES_LIST_FAILED(4054),
@@ -258,6 +258,8 @@
     GLUSTER_SERVER_SERVICE_STATUS_CHANGED(4058),
     GLUSTER_HOOK_UPDATED(4059),
     GLUSTER_HOOK_UPDATE_FAILED(4060),
+    GLUSTER_HOOK_ADDED(4061),
+    GLUSTER_HOOK_ADD_FAILED(4062),
 
     USER_VDS_RESTART(41),
     USER_FAILED_VDS_RESTART(107),
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 a2a7389..a5dc7ec 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
@@ -82,7 +82,7 @@
         AddEventNotificationEntry(EventNotificationEntity.GlusterHook, 
AuditLogType.GLUSTER_HOOK_ENABLE_FAILED);
         AddEventNotificationEntry(EventNotificationEntity.GlusterHook, 
AuditLogType.GLUSTER_HOOK_DISABLE);
         AddEventNotificationEntry(EventNotificationEntity.GlusterHook, 
AuditLogType.GLUSTER_HOOK_DISABLE_FAILED);
-        AddEventNotificationEntry(EventNotificationEntity.GlusterHook, 
AuditLogType.GLUSTER_HOOK_ADDED);
+        AddEventNotificationEntry(EventNotificationEntity.GlusterHook, 
AuditLogType.GLUSTER_HOOK_DETECTED_NEW);
         AddEventNotificationEntry(EventNotificationEntity.GlusterHook, 
AuditLogType.GLUSTER_HOOK_CONFLICT_DETECTED);
 
         // DWH
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 cde8a4d..44a3b0f 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
@@ -236,6 +236,7 @@
     EnableGlusterHook(1414, ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
     DisableGlusterHook(1415, ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
     UpdateGlusterHook(1416,ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
+    
AddGlusterHook(1417,ActionGroup.MANIPULATE_GLUSTER_HOOK,QuotaDependency.NONE),
 
     // External events
     AddExternalEvent(1500, ActionGroup.INJECT_EXTERNAL_EVENTS, 
QuotaDependency.NONE),
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 1a2041d..12767ce 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
@@ -119,8 +119,8 @@
         severities.put(AuditLogType.GLUSTER_HOOK_DISABLE_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_HOOK_LIST_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_HOOK_CONFLICT_DETECTED, 
AuditLogSeverity.WARNING);
-        severities.put(AuditLogType.GLUSTER_HOOK_ADDED, 
AuditLogSeverity.NORMAL);
-        severities.put(AuditLogType.GLUSTER_HOOK_REMOVED, 
AuditLogSeverity.NORMAL);
+        severities.put(AuditLogType.GLUSTER_HOOK_DETECTED_NEW, 
AuditLogSeverity.NORMAL);
+        severities.put(AuditLogType.GLUSTER_HOOK_DETECTED_DELETE, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.GLUSTER_HOOK_GETCONTENT_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_SERVICES_LIST_FAILED, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.GLUSTER_SERVICE_TYPE_ADDED_TO_CLUSTER, 
AuditLogSeverity.NORMAL);
@@ -129,6 +129,7 @@
         severities.put(AuditLogType.GLUSTER_SERVER_SERVICE_STATUS_CHANGED, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.GLUSTER_HOOK_UPDATED, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.GLUSTER_HOOK_UPDATE_FAILED, 
AuditLogSeverity.ERROR);
+        severities.put(AuditLogType.GLUSTER_HOOK_ADD_FAILED, 
AuditLogSeverity.ERROR);
     }
 
     private static void initDefaultSeverities() {
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 e3f65c2..ada50b7 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -860,7 +860,7 @@
 SSH_AUTHENTICATION_FAILED=SSH Authentication failed. Please make sure password 
is correct.
 GLUSTER_NOT_SUPPORTED=Cannot ${action} ${type}. Gluster service is not 
supported in compatibility version ${compatibilityVersion}.
 ACTION_TYPE_FAILED_SERVER_PART_OF_ANOTHER_CLUSTER=Cannot ${action} ${type}. 
Server ${server} is already part of another cluster.
-ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS=Cannot ${action} ${type}. 
There are no conflicting servers to update hook.
+ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS=Cannot ${action} ${type}. 
There are no conflicting servers to add or update hook.
 ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP=Cannot ${action} ${type}. The server 
${VdsName} is not UP.
 
 # External Events Errors Messages
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 cd3c9dd..5425708 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -607,8 +607,8 @@
 GLUSTER_HOOK_DISABLE_PARTIAL=Gluster Hook ${GlusterHookName} disabled on some 
of the servers on cluster ${VdsGroupName}. ${FailureMessage}
 GLUSTER_HOOK_LIST_FAILED=Failed to retrieve hook list from ${VdsName} of 
Cluster ${VdsGroupName}.
 GLUSTER_HOOK_CONFLICT_DETECTED=Detected conflict in hook ${HookName} of 
Cluster ${VdsGroupName}.
-GLUSTER_HOOK_ADDED=Detected new hook ${HookName} in Cluster ${VdsGroupName}.
-GLUSTER_HOOK_REMOVED=Detected removal of hook ${HookName} in Cluster 
${VdsGroupName}.
+GLUSTER_HOOK_DETECTED_NEW=Detected new hook ${HookName} in Cluster 
${VdsGroupName}.
+GLUSTER_HOOK_DETECTED_DELETE=Detected removal of hook ${HookName} in Cluster 
${VdsGroupName}.
 GLUSTER_HOOK_GETCONTENT_FAILED=Failed to read content of hook ${HookName} in 
Cluster ${VdsGroupName}.
 GLUSTER_SERVICES_LIST_FAILED=Could not fetch statuses of services from server 
${VdsName}. Updating statuses of all services on this server to UNKNOWN.
 GLUSTER_SERVICE_TYPE_ADDED_TO_CLUSTER=Service type ${ServiceType} was not 
mapped to cluster ${VdsGroupName}. Mapped it now.
@@ -618,3 +618,5 @@
 WATCHDOG_EVENT=Watchdog event (${wdaction}) triggered on ${VmName} at 
${wdevent} (host time).
 GLUSTER_HOOK_UPDATED=Gluster Hook ${GlusterHookName} updated on conflicting 
servers.
 GLUSTER_HOOK_UPDATE_FAILED=Failed to update Gluster Hook ${GlusterHookName} on 
conflicting servers. ${FailureMessage}
+GLUSTER_HOOK_ADDED=Gluster Hook ${GlusterHookName} added on conflicting 
servers.
+GLUSTER_HOOK_ADD_FAILED=Failed to add Gluster Hook ${GlusterHookName} on 
conflicting servers. ${FailureMessage}
\ No newline at end of file
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 4d28dbd..bb87072 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -95,6 +95,7 @@
 job.EnableGlusterHook=Enabling Gluster Hook ${GlusterHookName}
 job.DisableGlusterHook=Disabling Gluster Hook ${GlusterHookName}
 job.UpdateGlusterHook=Updating Gluster Hook ${GlusterHookName} on conflicting 
servers in Cluster ${Cluster}
+job.AddGlusterHook=Adding Gluster Hook ${GlusterHookName} on conflicting 
servers in Cluster ${Cluster}
 
 # Step types
 step.VALIDATING=Validating
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 597035b..053a601 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
@@ -277,6 +277,10 @@
     String AuditLogType___GLUSTER_HOOK_UPDATED();
 
     String AuditLogType___GLUSTER_HOOK_UPDATE_FAILED();
+    
+    String AuditLogType___GLUSTER_HOOK_ADDED();
+
+    String AuditLogType___GLUSTER_HOOK_ADD_FAILED();
 
     String VdcActionType___ActivateVds();
 
@@ -586,6 +590,8 @@
        String VdcActionType___DisableGlusterHook();
 
        String VdcActionType___UpdateGlusterHook();
+       
+       String VdcActionType___AddGlusterHook();
 
        String VdcActionType___ConnectStorageToVds();
 
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 7d23685..405b0f2 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
@@ -135,6 +135,9 @@
 AuditLogType___GLUSTER_HOOK_DISABLE_FAILED=Failed to Disable Gluster Hook
 AuditLogType___GLUSTER_HOOK_UPDATED=Updated GLuster Hook
 AuditLogType___GLUSTER_HOOK_UPDATE_FAILED=Failed to update Gluster Hook on 
conflicting servers
+AuditLogType___GLUSTER_HOOK_ADDED=Added GLuster Hook
+AuditLogType___GLUSTER_HOOK_ADD_FAILED=Failed to add Gluster Hook on 
conflicting servers
+
 
 VdcActionType___ActivateVds=Activate Host
 VdcActionType___RecoveryStoragePool=Reinitialize Data Center
@@ -264,6 +267,7 @@
 VdcActionType___EnableGlusterHook=Enable Gluster Hook
 VdcActionType___DisableGlusterHook=Disable Gluster Hook
 VdcActionType___UpdateGlusterHook=Update Gluster Hook
+VdcActionType___AddGlusterHook=Add Gluster Hook
 VdcActionType___ActivateStorageDomain=Activate Storage Domain
 VdcActionType___FenceVdsManualy=Fence Host Manually
 VdcActionType___AddEmptyStoragePool=New Data Center


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

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

Reply via email to