Search in sources :

Example 1 with HSMTaskGuidBaseVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters in project ovirt-engine by oVirt.

the class SPMRevertTaskVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    VDSReturnValue returnValue = resourceManager.runVdsCommand(VDSCommandType.HSMRevertTask, new HSMTaskGuidBaseVDSCommandParameters(getCurrentIrsProxy().getCurrentVdsId(), getParameters().getTaskId()));
    if (returnValue != null && !returnValue.getSucceeded()) {
        getVDSReturnValue().setVdsError(returnValue.getVdsError());
        getVDSReturnValue().setSucceeded(false);
    }
}
Also used : VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) HSMTaskGuidBaseVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters)

Example 2 with HSMTaskGuidBaseVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters in project ovirt-engine by oVirt.

the class SpmStartVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    result = getBroker().spmStart(getParameters().getStoragePoolId().toString(), getParameters().getPrevId(), getParameters().getPrevLVER(), getParameters().getRecoveryMode().getValue(), String.valueOf(getParameters().getSCSIFencing()).toLowerCase(), Config.getValue(ConfigValues.MaxNumberOfHostsInStoragePool), getParameters().getStoragePoolFormatType().getValue());
    proceedProxyReturnValue();
    Guid taskId = new Guid(result.uuid);
    AsyncTaskStatus taskStatus;
    log.info("spmStart polling started: taskId '{}'", taskId);
    do {
        // TODO: make configurable
        ThreadUtils.sleep(1000L);
        taskStatus = (AsyncTaskStatus) resourceManager.runVdsCommand(VDSCommandType.HSMGetTaskStatus, new HSMTaskGuidBaseVDSCommandParameters(vdsId, taskId)).getReturnValue();
        log.debug("spmStart polling - task status: '{}'", taskStatus.getStatus());
    } while (taskStatus.getStatus() != AsyncTaskStatusEnum.finished && taskStatus.getStatus() != AsyncTaskStatusEnum.unknown);
    log.info("spmStart polling ended: taskId '{}' task status '{}'", taskId, taskStatus.getStatus());
    if (!taskStatus.getTaskEndedSuccessfully()) {
        log.error("Start SPM Task failed - result: '{}', message: {}", taskStatus.getResult(), taskStatus.getMessage());
    }
    SpmStatusResult spmStatus = (SpmStatusResult) resourceManager.runVdsCommand(VDSCommandType.SpmStatus, new SpmStatusVDSCommandParameters(vdsId, getParameters().getStoragePoolId())).getReturnValue();
    if (spmStatus != null) {
        log.info("spmStart polling ended, spm status: {}", spmStatus.getSpmStatus());
    } else {
        log.error("spmStart polling ended, failed to get the spm status");
    }
    try {
        resourceManager.runVdsCommand(VDSCommandType.HSMClearTask, new HSMTaskGuidBaseVDSCommandParameters(vdsId, taskId));
    } catch (Exception e) {
        log.error("Could not clear spmStart task '{}', continuing with SPM selection: {}", taskId, e.getMessage());
        log.debug("Exception", e);
    }
    setReturnValue(spmStatus);
}
Also used : SpmStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SpmStatusVDSCommandParameters) SpmStatusResult(org.ovirt.engine.core.common.businessentities.SpmStatusResult) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) Guid(org.ovirt.engine.core.compat.Guid) HSMTaskGuidBaseVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters)

Example 3 with HSMTaskGuidBaseVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters in project ovirt-engine by oVirt.

the class SPMClearTaskVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    VDSReturnValue returnValue = resourceManager.runVdsCommand(VDSCommandType.HSMClearTask, new HSMTaskGuidBaseVDSCommandParameters(getCurrentIrsProxy().getCurrentVdsId(), getParameters().getTaskId()));
    if (returnValue != null && !returnValue.getSucceeded()) {
        getVDSReturnValue().setVdsError(returnValue.getVdsError());
        getVDSReturnValue().setSucceeded(false);
    }
}
Also used : VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) HSMTaskGuidBaseVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters)

Aggregations

HSMTaskGuidBaseVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.HSMTaskGuidBaseVDSCommandParameters)3 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)2 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 SpmStatusResult (org.ovirt.engine.core.common.businessentities.SpmStatusResult)1 SpmStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SpmStatusVDSCommandParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1