Sahina Bose has uploaded a new change for review.

Change subject: gluster: Command to update gluster hook on servers
......................................................................

gluster: Command to update gluster hook on servers

This patch adds a command to update hook content
on servers where the content's different.
Either the engine content or content from a server
is used - depending on parameters -
to update content on servers.
If content from server is used, the engine's copy
of hook content is updated as well.

Change-Id: Ibccccbbed1e07d471dc472c41843f46767b9e083
Signed-off-by: Sahina Bose <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java
A 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommandTest.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/action/VdcActionType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterResolveHookParameters.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.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/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.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
13 files changed, 439 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/14935/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java
new file mode 100644
index 0000000..5ce75b9
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java
@@ -0,0 +1,196 @@
+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.GlusterResolveHookParameters;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType;
+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.errors.VdcBLLException;
+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.compat.Guid;
+import org.ovirt.engine.core.dal.VdcBllMessages;
+import org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil;
+
+/**
+ * BLL command to add gluster hook on missing servers
+ */
+@NonTransactiveCommandAttribute
+@LockIdNameAttribute(isWait = true)
+public class UpdateGlusterHookCommand extends 
GlusterHookCommandBase<GlusterResolveHookParameters> {
+    private GlusterHookEntity entity;
+
+    protected List<String> errors = new ArrayList<String>();
+
+    public UpdateGlusterHookCommand(GlusterResolveHookParameters 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 with status 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 (Guid.isNullOrEmpty(getParameters().getHookId())) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED);
+            return false;
+        }
+
+        if (getGlusterHook() == null) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST);
+            return false;
+        }
+
+        if (getMissingServerHooks().isEmpty()) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS);
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void executeCommand() {
+        //check source to copy hook from - if engine copy or server copy
+        final Boolean copyfromEngine = (getParameters().getSourceServerId() == 
null) ?  true : false;
+
+        entity = getGlusterHook();
+        addCustomValue(GlusterConstants.HOOK_NAME, entity.getName());
+
+        final String hookContent;
+        final String hookChecksum;
+        final GlusterHookContentType hookContentType;
+        if (copyfromEngine) {
+            hookContent = entity.getContent();
+            hookChecksum = entity.getChecksum();
+            hookContentType = entity.getContentType();
+        } else {
+            //use a server's copy
+            GlusterServerHook sourceServerHook = 
getGlusterHooksDao().getGlusterServerHook(entity.getId(), 
getParameters().getSourceServerId());
+            VDSReturnValue retValue = 
runVdsCommand(VDSCommandType.GetGlusterHookContent,
+                                        new 
GlusterHookVDSParameters(getParameters().getSourceServerId(),
+                                                entity.getGlusterCommand(),
+                                                entity.getStage(),
+                                                entity.getName()));
+            if (!retValue.getSucceeded()) {
+                // throw exception as we cannot continue without content
+                log.errorFormat("Failed to get content from server with id {0} 
with error {1}", getParameters().getSourceServerId(), 
retValue.getExceptionString());
+                throw new VdcBLLException(retValue.getVdsError().getCode(), 
retValue.getVdsError().getMessage());
+            }
+            hookContent = (String) retValue.getReturnValue();
+            hookChecksum = sourceServerHook.getChecksum();
+            hookContentType = sourceServerHook.getContentType();
+        }
+
+
+        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.UpdateGlusterHook,
+                                       new 
GlusterHookVDSParameters(serverHook.getServerId(),
+                                               entity.getGlusterCommand(),
+                                               entity.getStage(),
+                                               entity.getName(),
+                                               hookContent,
+                                               hookChecksum));
+                     return new Pair<GlusterServerHook, 
VDSReturnValue>(serverHook, returnValue);
+
+                }
+            });
+        }
+
+        setSucceeded(true);
+        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());
+             }
+        }
+
+        if (errors.size() > 0) {
+            setSucceeded(false);
+            errorType =  AuditLogType.GLUSTER_HOOK_UPDATE_FAILED;
+            handleVdsErrors(getAuditLogTypeValue(), errors);
+            addCustomValue(GlusterConstants.FAILURE_MESSAGE , 
StringUtils.join(errors, SystemUtils.LINE_SEPARATOR));
+        }
+
+        if (getSucceeded() && !copyfromEngine) {
+            //update server's content copy
+            entity.setChecksum(hookChecksum);
+            entity.setContent(hookContent);
+            entity.setContentType(hookContentType);
+            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_UPDATED : errorType;
+    }
+
+}
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommandTest.java
new file mode 100644
index 0000000..1121c9e
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommandTest.java
@@ -0,0 +1,160 @@
+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.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.Collections;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.ovirt.engine.core.common.AuditLogType;
+import 
org.ovirt.engine.core.common.action.gluster.GlusterResolveHookParameters;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus;
+import org.ovirt.engine.core.common.errors.VDSError;
+import org.ovirt.engine.core.common.errors.VdcBLLException;
+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;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class UpdateGlusterHookCommandTest extends 
GlusterHookCommandTest<UpdateGlusterHookCommand> {
+    /**
+     * The command under test.
+     */
+    UpdateGlusterHookCommand cmd;
+
+    private static final String CONTENT = "TestContent";
+    private static final Guid SERVER_ID = Guid.NewGuid();
+
+    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.UpdateGlusterHook), 
argThat(anyHookVDS()))).thenReturn(vdsReturnValue);
+     }
+
+    private void mockForReadContent(boolean succeeded, VdcBllErrors errorCode) 
{
+        when(hooksDao.getGlusterServerHook(HOOK_ID, 
SERVER_ID)).thenReturn(getGlusterServerHook(0,GlusterHookStatus.ENABLED));
+        mockBackend(succeeded, errorCode);
+        VDSReturnValue vdsReturnValue = new VDSReturnValue();
+        vdsReturnValue.setReturnValue(CONTENT);
+        vdsReturnValue.setSucceeded(succeeded);
+        if (!succeeded) {
+            vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
+        }
+        
when(vdsBrokerFrontend.RunVdsCommand(eq(VDSCommandType.GetGlusterHookContent), 
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 UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID)));
+        setupMocks(cmd);
+        mockBackend(true, null);
+        cmd.executeCommand();
+        verify(hooksDao, 
never()).updateGlusterHook(any(GlusterHookEntity.class));
+        assertEquals(cmd.getAuditLogTypeValue(), 
AuditLogType.GLUSTER_HOOK_UPDATED);
+    }
+
+    @Test
+    public void executeCommandWhenServerIdPresent() {
+        cmd = spy(new UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID,SERVER_ID)));
+        setupMocks(cmd);
+        mockForReadContent(true, null);
+        cmd.executeCommand();
+        verify(hooksDao, 
times(1)).updateGlusterHook(any(GlusterHookEntity.class));
+        assertEquals(cmd.getAuditLogTypeValue(), 
AuditLogType.GLUSTER_HOOK_UPDATED);
+    }
+
+    @Test
+    public void executeCommandWhenFailed() {
+        cmd = spy(new UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID)));
+        setupMocks(cmd);
+        mockBackend(false,VdcBllErrors.GlusterHookUpdateFailed);
+        cmd.executeCommand();
+        verify(hooksDao, 
never()).updateGlusterHook(any(GlusterHookEntity.class));
+        assertEquals(cmd.getAuditLogTypeValue(), 
AuditLogType.GLUSTER_HOOK_UPDATE_FAILED);
+    }
+
+    @Test
+    public void executeCommandFailedWhenServerIdPresent() {
+        cmd = spy(new UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID,SERVER_ID)));
+        setupMocks(cmd);
+        mockForReadContent(false, VdcBllErrors.GlusterHookNotFound);
+        try {
+            cmd.executeCommand();
+        }catch (VdcBLLException e) {
+            assertEquals(e.getErrorCode(), VdcBllErrors.GlusterHookNotFound);
+        }
+        verify(hooksDao, 
never()).updateGlusterHook(any(GlusterHookEntity.class));
+    }
+
+    @Test
+    public void canDoActionSucceeds() {
+        cmd = spy(new UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID)));
+        setupMocks(cmd);
+        assertTrue(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsOnNullHookId() {
+        cmd = spy(new UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(null)));
+        setupMocks(cmd);
+        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 UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID)));
+        setupMocks(cmd,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 UpdateGlusterHookCommand(new 
GlusterResolveHookParameters(HOOK_ID)));
+        GlusterHookEntity hook = getHookEntity();
+        hook.setServerHooks(Collections.singletonList(getGlusterServerHook(0, 
GlusterHookStatus.MISSING)));
+        setupMocks(cmd,true,hook);
+        assertFalse(cmd.canDoAction());
+        
assertTrue(cmd.getReturnValue().getCanDoActionMessages().contains(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.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 bd6792b..d5062e2 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
@@ -250,6 +250,8 @@
     GLUSTER_HOOK_ADDED(4050),
     GLUSTER_HOOK_REMOVED(4051),
     GLUSTER_VOLUME_OPTION_MODIFIED(4052),
+    GLUSTER_HOOK_UPDATED(4053),
+    GLUSTER_HOOK_UPDATE_FAILED(4054),
 
     USER_VDS_RESTART(41),
     USER_FAILED_VDS_RESTART(107),
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 7fa88f5..6b246ea 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
@@ -235,6 +235,7 @@
     AddGlusterFsStorageDomain(1413, ActionGroup.CREATE_STORAGE_DOMAIN, 
QuotaDependency.NONE),
     EnableGlusterHook(1414, ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
     DisableGlusterHook(1415, ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
+    UpdateGlusterHook(1416,ActionGroup.MANIPULATE_GLUSTER_HOOK, 
QuotaDependency.NONE),
 
     // External events
     AddExternalEvent(1500, ActionGroup.INJECT_EXTERNAL_EVENTS, 
QuotaDependency.NONE),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterResolveHookParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterResolveHookParameters.java
new file mode 100644
index 0000000..c8ee674
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterResolveHookParameters.java
@@ -0,0 +1,61 @@
+package org.ovirt.engine.core.common.action.gluster;
+
+import javax.validation.constraints.NotNull;
+
+import org.ovirt.engine.core.common.action.VdcActionParametersBase;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus;
+import org.ovirt.engine.core.compat.Guid;
+
+/**
+ * Parameter class with Gluster cluster id, hook id as parameters. <br>
+ * This will be used by enable and disable gluster hook commands. <br>
+ */
+public class GlusterResolveHookParameters extends VdcActionParametersBase {
+    private static final long serialVersionUID = 3398376087476446699L;
+
+    @NotNull(message = "VALIDATION.GLUSTER.GLUSTER_HOOK_ID.NOT_NULL")
+    private Guid hookId;
+
+    private Guid sourceServerId;
+
+    private GlusterHookStatus hookStatus;
+
+    public GlusterResolveHookParameters(Guid hookId) {
+        super();
+        setHookId(hookId);
+    }
+
+    public GlusterResolveHookParameters(Guid hookId,
+            Guid sourceServerId) {
+        super();
+        this.hookId = hookId;
+        this.sourceServerId = sourceServerId;
+    }
+
+
+    public Guid getHookId() {
+        return hookId;
+    }
+
+    public void setHookId(Guid hookId) {
+        this.hookId = hookId;
+    }
+
+    public Guid getSourceServerId() {
+        return sourceServerId;
+    }
+
+    public void setSourceServerId(Guid sourceServerId) {
+        this.sourceServerId = sourceServerId;
+    }
+
+    public GlusterHookStatus getHookStatus() {
+        return hookStatus;
+    }
+
+    public void setHookStatus(GlusterHookStatus hookStatus) {
+        this.hookStatus = hookStatus;
+    }
+
+
+}
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
index 871d56e..63da3e1 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
@@ -719,6 +719,7 @@
     SSH_AUTHENTICATION_FAILED,
     GLUSTER_NOT_SUPPORTED,
     ACTION_TYPE_FAILED_SERVER_PART_OF_ANOTHER_CLUSTER,
+    ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS,
 
     VM_INTERFACE_NOT_EXIST,
     ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_DEVICE,
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 4764883..7c78049 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
@@ -111,6 +111,8 @@
         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_UPDATED, 
AuditLogSeverity.NORMAL);
+        severities.put(AuditLogType.GLUSTER_HOOK_UPDATE_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 83e0762..734e151 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -851,6 +851,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.
 
 # External Events Errors Messages
 VAR__TYPE__EXTERNAL_EVENT=$type External Event
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 d252d53..faeadde 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -603,4 +603,6 @@
 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_UPDATED=Gluster Hook ${GlusterHookName} updated on conflicting 
servers.
+GLUSTER_HOOK_UPDATE_FAILED=Failed to update Gluster Hook ${GlusterHookName} on 
conflicting servers. ${FailureMessage}
 
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 4917cfc..57a908f 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -91,6 +91,7 @@
 job.RemoveEventSubscription=Removing subscriber ${Address} from event type 
${EventType}
 job.EnableGlusterHook=Enabling Gluster Hook ${GlusterHookName}
 job.DisableGlusterHook=Disabling Gluster Hook ${GlusterHookName}
+job.UpdateGlusterHook=Updating Gluster Hook ${GlusterHookName} on conflicting 
servers in Cluster ${Cluster}
 
 # Step types
 step.VALIDATING=Validating
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 6486b9e..3436b0c 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
@@ -2256,4 +2256,7 @@
 
     @Constants.DefaultStringValue("Failed to run LDAP query, please check 
server logs for more info.")
     String FAILED_TO_RUN_LDAP_QUERY();
+
+    @DefaultStringValue("Cannot ${action} ${type}. There are no conflicting 
servers to update hook.")
+    String ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS();
 }
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 46d53ad..a686e64 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
@@ -274,6 +274,10 @@
 
     String AuditLogType___GLUSTER_HOOK_DISABLE_FAILED();
 
+    String AuditLogType___GLUSTER_HOOK_UPDATED();
+
+    String AuditLogType___GLUSTER_HOOK_UPDATE_FAILED();
+
     String VdcActionType___ActivateVds();
 
        String VdcActionType___RecoveryStoragePool();
@@ -581,6 +585,8 @@
 
        String VdcActionType___DisableGlusterHook();
 
+       String VdcActionType___UpdateGlusterHook();
+
        String VdcActionType___ConnectStorageToVds();
 
        String VdcObjectType___AdElements();
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 f9d5cf2..317a009 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
@@ -133,6 +133,8 @@
 AuditLogType___GLUSTER_HOOK_ENABLE_FAILED=Failed to Enable Gluster Hook
 AuditLogType___GLUSTER_HOOK_DISABLE=Gluster Hook Disabled
 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
 
 VdcActionType___ActivateVds=Activate Host
 VdcActionType___RecoveryStoragePool=Reinitialize Data Center
@@ -261,6 +263,7 @@
 vdcActionType___StopGlusterVolumeProfile=Stop Gluster Volume Profile
 VdcActionType___EnableGlusterHook=Enable Gluster Hook
 VdcActionType___DisableGlusterHook=Disable Gluster Hook
+VdcActionType___UpdateGlusterHook=Update Gluster Hook
 VdcActionType___ActivateStorageDomain=Activate Storage Domain
 VdcActionType___FenceVdsManualy=Fence Host Manually
 VdcActionType___AddEmptyStoragePool=New Data Center


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

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

Reply via email to