Search in sources :

Example 1 with Step

use of org.ovirt.engine.core.common.job.Step in project ovirt-engine by oVirt.

the class TaskStatusColumn method getTooltip.

@Override
public SafeHtml getTooltip(EntityModel jobOrStep) {
    JobExecutionStatus jobExecutionStatus = null;
    if (jobOrStep.getEntity() instanceof Job) {
        jobExecutionStatus = ((Job) jobOrStep.getEntity()).getStatus();
    } else if (jobOrStep.getEntity() instanceof Step) {
        jobExecutionStatus = ((Step) jobOrStep.getEntity()).getStatus();
    } else {
        return null;
    }
    String tooltipContent = EnumTranslator.getInstance().translate(jobExecutionStatus);
    return SafeHtmlUtils.fromString(tooltipContent);
}
Also used : JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) Step(org.ovirt.engine.core.common.job.Step) Job(org.ovirt.engine.core.common.job.Job)

Example 2 with Step

use of org.ovirt.engine.core.common.job.Step in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderCommand method createConversionStepContext.

protected CommandContext createConversionStepContext(StepEnum step) {
    CommandContext commandCtx = null;
    try {
        Map<String, String> values = Collections.singletonMap(VdcObjectType.VM.name().toLowerCase(), getVmName());
        Step conversionStep = executionHandler.addSubStep(getExecutionContext(), getExecutionContext().getJob().getStep(StepEnum.EXECUTING), step, ExecutionMessageDirector.resolveStepMessage(step, values));
        ExecutionContext ctx = new ExecutionContext();
        ctx.setStep(conversionStep);
        ctx.setMonitored(true);
        commandCtx = cloneContext().withoutCompensationContext().withExecutionContext(ctx).withoutLock();
    } catch (RuntimeException e) {
        log.error("Failed to create command context of converting VM '{}': {}", getVmName(), e.getMessage());
        log.debug("Exception", e);
    }
    return commandCtx;
}
Also used : ExecutionContext(org.ovirt.engine.core.bll.job.ExecutionContext) CommandContext(org.ovirt.engine.core.bll.context.CommandContext) Step(org.ovirt.engine.core.common.job.Step)

Example 3 with Step

use of org.ovirt.engine.core.common.job.Step in project ovirt-engine by oVirt.

the class GlusterAsyncCommandBase method endStepJob.

protected void endStepJob(JobExecutionStatus status, Map<String, String> stepMessageMap, boolean exitStatus) {
    GlusterAsyncTask asyncTask = getGlusterVolume().getAsyncTask();
    // Gluster Task will be associated with only one step ( REBALANCING_VOLUME or REMOVING_BRICK)
    Step step = stepDao.getStepsByExternalId(asyncTask.getTaskId()).get(0);
    step.setStatus(status);
    step.setEndTime(new Date());
    step.setDescription(ExecutionMessageDirector.resolveStepMessage(getStepType(), stepMessageMap));
    jobRepository.updateStep(step);
    ExecutionContext finalContext = executionHandler.createFinalizingContext(step.getId());
    executionHandler.endTaskStepAndJob(finalContext, exitStatus);
}
Also used : ExecutionContext(org.ovirt.engine.core.bll.job.ExecutionContext) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) Step(org.ovirt.engine.core.common.job.Step) Date(java.util.Date)

Example 4 with Step

use of org.ovirt.engine.core.common.job.Step in project ovirt-engine by oVirt.

the class LiveMigrateDiskCommand method createStepsContext.

private CommandContext createStepsContext(StepEnum step) {
    Step addedStep = executionHandler.addSubStep(getExecutionContext(), getExecutionContext().getJob().getStep(StepEnum.EXECUTING), step, ExecutionMessageDirector.resolveStepMessage(step, Collections.emptyMap()));
    ExecutionContext ctx = new ExecutionContext();
    ctx.setStep(addedStep);
    ctx.setMonitored(true);
    CommandContext commandCtx = ExecutionHandler.createDefaultContextForTasks(getContext(), null).withExecutionContext(ctx);
    return commandCtx;
}
Also used : ExecutionContext(org.ovirt.engine.core.bll.job.ExecutionContext) CommandContext(org.ovirt.engine.core.bll.context.CommandContext) Step(org.ovirt.engine.core.common.job.Step)

Example 5 with Step

use of org.ovirt.engine.core.common.job.Step in project ovirt-engine by oVirt.

the class EndExternalStepCommandTest method makeExternalTestStep.

private Step makeExternalTestStep(Guid id, Guid stepId) {
    Step step = new Step();
    step.setId(stepId);
    step.setJobId(id);
    step.setDescription("Sample Step");
    step.setExternal(true);
    return step;
}
Also used : Step(org.ovirt.engine.core.common.job.Step)

Aggregations

Step (org.ovirt.engine.core.common.job.Step)52 ExecutionContext (org.ovirt.engine.core.bll.job.ExecutionContext)14 Guid (org.ovirt.engine.core.compat.Guid)12 HashMap (java.util.HashMap)8 Job (org.ovirt.engine.core.common.job.Job)8 Date (java.util.Date)7 Test (org.junit.Test)6 CommandContext (org.ovirt.engine.core.bll.context.CommandContext)6 ArrayList (java.util.ArrayList)5 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)5 List (java.util.List)4 VdcObjectType (org.ovirt.engine.core.common.VdcObjectType)4 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)4 StepSubjectEntity (org.ovirt.engine.core.common.job.StepSubjectEntity)4 Map (java.util.Map)3 StepEnum (org.ovirt.engine.core.common.job.StepEnum)3 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Inject (javax.inject.Inject)2