Search in sources :

Example 6 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class GlusterHookSyncJob method saveHookContent.

private void saveHookContent(List<Callable<Pair<GlusterHookEntity, VDSReturnValue>>> contentTasksList) {
    if (contentTasksList.isEmpty()) {
        return;
    }
    List<Pair<GlusterHookEntity, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(contentTasksList);
    for (Pair<GlusterHookEntity, VDSReturnValue> pairResult : pairResults) {
        final GlusterHookEntity hook = pairResult.getFirst();
        if (!pairResult.getSecond().getSucceeded()) {
            log.info("Failed to get content of hook '{}' with error: {}", hook.getHookKey(), pairResult.getSecond().getVdsError().getMessage());
            logMessage(hook.getClusterId(), hook.getHookKey(), AuditLogType.GLUSTER_HOOK_GETCONTENT_FAILED);
            continue;
        }
        final String content = (String) pairResult.getSecond().getReturnValue();
        hooksDao.updateGlusterHookContent(hook.getId(), hook.getChecksum(), content);
    }
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) Pair(org.ovirt.engine.core.common.utils.Pair) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 7 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class GlusterHooksListReturn method getHook.

private GlusterHookEntity getHook(Map<String, Object> map) {
    GlusterHookEntity hook = new GlusterHookEntity();
    hook.setName(map.get(NAME).toString());
    hook.setGlusterCommand(map.get(COMMAND).toString());
    hook.setStage(map.get(LEVEL).toString());
    hook.setChecksum(map.get(CHECKSUM).toString());
    hook.setContentType(GlusterHookContentType.fromMimeType(map.get(CONTENT_TYPE).toString()));
    hook.setStatus(map.get(HOOK_STATUS).toString());
    return hook;
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity)

Example 8 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class SubTabClusterGlusterHookView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    getTable().addColumn(new GlusterHookSyncStatusColumn(), constants.empty(), // $NON-NLS-1$
    "10px");
    AbstractTextColumn<GlusterHookEntity> nameColumn = new AbstractTextColumn<GlusterHookEntity>() {

        @Override
        public String getValue(GlusterHookEntity object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameHook(), "200px");
    AbstractTextColumn<GlusterHookEntity> statusColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookStatus>() {

        @Override
        protected GlusterHookStatus getRawValue(GlusterHookEntity object) {
            return object.getStatus();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusHook(), "150px");
    AbstractTextColumn<GlusterHookEntity> glusterCommandColumn = new AbstractTextColumn<GlusterHookEntity>() {

        @Override
        public String getValue(GlusterHookEntity object) {
            return object.getGlusterCommand();
        }
    };
    getTable().addColumn(glusterCommandColumn, constants.glusterVolumeEventHook(), // $NON-NLS-1$;
    "100px");
    AbstractTextColumn<GlusterHookEntity> stageColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookStage>() {

        @Override
        protected GlusterHookStage getRawValue(GlusterHookEntity object) {
            return object.getStage();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(stageColumn, constants.stageHook(), "100px");
    AbstractTextColumn<GlusterHookEntity> contentTypeColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookContentType>() {

        @Override
        protected GlusterHookContentType getRawValue(GlusterHookEntity object) {
            return object.getContentType();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(contentTypeColumn, constants.contentTypeHook(), "150px");
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterHookSyncStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.GlusterHookSyncStatusColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)

Example 9 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class GlusterHookCommandTest method getHookEntity.

protected GlusterHookEntity getHookEntity() {
    GlusterHookEntity hook = new GlusterHookEntity();
    hook.setClusterId(CLUSTER_ID);
    hook.setId(HOOK_ID);
    hook.setServerHooks(getGlusterServerHooks());
    return hook;
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity)

Example 10 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class AddGlusterHookCommandTest method getHookEntityWithMissing.

private GlusterHookEntity getHookEntityWithMissing() {
    GlusterHookEntity hook = getHookEntity();
    List<GlusterServerHook> serverHooks = new ArrayList<>();
    serverHooks.add(getGlusterServerHook(0, GlusterHookStatus.MISSING));
    serverHooks.add(getGlusterServerHook(1, GlusterHookStatus.MISSING));
    serverHooks.add(getGlusterServerHook(2, GlusterHookStatus.MISSING));
    hook.setServerHooks(serverHooks);
    return hook;
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) ArrayList(java.util.ArrayList)

Aggregations

GlusterHookEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity)34 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)11 GlusterServerHook (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook)8 Guid (org.ovirt.engine.core.compat.Guid)6 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)5 GlusterHookParameters (org.ovirt.engine.core.common.action.gluster.GlusterHookParameters)5 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)5 List (java.util.List)4 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)4 ActionType (org.ovirt.engine.core.common.action.ActionType)3 GlusterClusterParameters (org.ovirt.engine.core.common.action.gluster.GlusterClusterParameters)3 GlusterHookManageParameters (org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 GlusterHookContentType (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType)3 GlusterHookStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus)3 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)3 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)3