Search in sources :

Example 16 with AsyncTaskCreationInfo

use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.

the class CopyImageGroupCommand method performStorageOperation.

private boolean performStorageOperation() {
    Guid sourceDomainId = getParameters().getSourceDomainId() != null ? getParameters().getSourceDomainId() : getDiskImage().getStorageIds().get(0);
    if (isUsingSPDMFlow()) {
        CopyImageGroupWithDataCommandParameters p = new CopyImageGroupWithDataCommandParameters(getStorageDomain().getStoragePoolId(), sourceDomainId, getParameters().getStorageDomainId(), getParameters().getImageGroupID(), getParameters().getImageId(), getParameters().getImageGroupID(), getParameters().getImageId(), getVolumeFormatForDomain(), getParameters().getUseCopyCollapse());
        p.setParentParameters(getParameters());
        p.setParentCommand(getActionType());
        p.setEndProcedure(EndProcedure.COMMAND_MANAGED);
        p.setJobWeight(getParameters().getJobWeight());
        runInternalAction(ActionType.CopyImageGroupWithData, p);
        return true;
    } else {
        VDSReturnValue vdsReturnValue;
        Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
        if (getParameters().getUseCopyCollapse()) {
            vdsReturnValue = runVdsCommand(VDSCommandType.CopyImage, postDeleteActionHandler.fixParameters(new CopyImageVDSCommandParameters(getStorageDomain().getStoragePoolId(), sourceDomainId, getParameters().getContainerId(), getParameters().getImageGroupID(), getParameters().getImageId(), getParameters().getDestImageGroupId(), getParameters().getDestinationImageId(), "", getParameters().getStorageDomainId(), getParameters().getCopyVolumeType(), getVolumeFormatForDomain(), getParameters().getVolumeType(), isWipeAfterDelete(), getStorageDomain().getDiscardAfterDelete(), getParameters().getForceOverride())));
        } else {
            vdsReturnValue = runVdsCommand(VDSCommandType.MoveImageGroup, postDeleteActionHandler.fixParameters(new MoveImageGroupVDSCommandParameters(getDiskImage() != null ? getDiskImage().getStoragePoolId() : getStorageDomain().getStoragePoolId(), sourceDomainId, getDiskImage() != null ? getDiskImage().getId() : getParameters().getImageGroupID(), getParameters().getStorageDomainId(), getParameters().getContainerId(), ImageOperation.Copy, isWipeAfterDelete(), storageDomainDao.get(sourceDomainId).getDiscardAfterDelete(), getParameters().getForceOverride())));
        }
        if (vdsReturnValue.getSucceeded()) {
            AsyncTaskCreationInfo taskCreationInfo = vdsReturnValue.getCreationInfo();
            getTaskIdList().add(createTask(taskId, taskCreationInfo, getParameters().getParentCommand(), VdcObjectType.Storage, sourceDomainId, getParameters().getStorageDomainId()));
        }
        return vdsReturnValue.getSucceeded();
    }
}
Also used : MoveImageGroupVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.MoveImageGroupVDSCommandParameters) CopyImageVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.CopyImageVDSCommandParameters) AsyncTaskCreationInfo(org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo) Guid(org.ovirt.engine.core.compat.Guid) CopyImageGroupWithDataCommandParameters(org.ovirt.engine.core.common.action.CopyImageGroupWithDataCommandParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 17 with AsyncTaskCreationInfo

use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.

the class CopyImageVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    storageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getDstStorageDomainId());
    setReturnValue(Guid.Empty);
    log.info("-- executeIrsBrokerCommand: calling 'copyImage' with two new parameters: description and UUID. Parameters:");
    log.info("++ sdUUID={}", getParameters().getStorageDomainId());
    log.info("++ spUUID={}", getParameters().getStoragePoolId());
    log.info("++ vmGUID={}", getParameters().getVmId());
    log.info("++ srcImageGUID={}", getParameters().getImageGroupId());
    log.info("++ srcVolUUID={}", getParameters().getImageId());
    log.info("++ dstImageGUID={}", getParameters().getdstImageGroupId());
    log.info("++ dstVolUUID={}", getParameters().getDstImageId());
    log.info("++ descr={}", getParameters().getImageDescription());
    log.info("++ dstSdUUID={}", getParameters().getDstStorageDomainId());
    // NOTE: The 'uuidReturn' variable will contain the taskID and not the
    // created image id!
    uuidReturn = copyImage(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getVmId().toString(), getParameters().getImageGroupId().toString(), getParameters().getImageId().toString(), getParameters().getdstImageGroupId().toString(), getParameters().getDstImageId().toString(), getParameters().getImageDescription(), getParameters().getDstStorageDomainId().toString(), getParameters().getCopyVolumeType().getValue(), getParameters().getVolumeFormat().getValue(), getParameters().getPreallocate().getValue(), String.valueOf(getParameters().getPostZero()).toLowerCase(), getParameters().isDiscard(), String.valueOf(getParameters().getForce()).toLowerCase());
    proceedProxyReturnValue();
    Guid taskID = new Guid(uuidReturn.uuid);
    createdImageId = getParameters().getDstImageId().toString();
    setReturnValue(taskID);
    getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.copyImage, getParameters().getStoragePoolId()));
}
Also used : AsyncTaskCreationInfo(org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo) Guid(org.ovirt.engine.core.compat.Guid)

Example 18 with AsyncTaskCreationInfo

use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.

the class CreateVolumeVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    storageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getStorageDomainId());
    setReturnValue(Guid.Empty);
    // NOTE: The 'uuidReturn' variable will contain the taskID and not
    // the created image id!
    String imageInitSize = null;
    if (getParameters().getImageInitialSizeInBytes() != 0) {
        imageInitSize = String.valueOf(getParameters().getImageInitialSizeInBytes());
    }
    String diskType = FeatureSupported.isContentTypeSupported(getParameters().getPoolCompatibilityVersion()) ? getParameters().getDiskContentType().getStorageValue() : DiskContentType.LEGACY_DISK_TYPE;
    uuidReturn = getIrsProxy().createVolume(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), Long.valueOf(getParameters().getImageSizeInBytes()).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), diskType, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), getParameters().getSourceImageGroupId().toString(), getParameters().getImageId().toString(), imageInitSize);
    proceedProxyReturnValue();
    Guid taskID = new Guid(uuidReturn.uuid);
    createdImageId = getParameters().getNewImageID().toString();
    setReturnValue(new Guid(createdImageId));
    getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters().getStoragePoolId()));
}
Also used : AsyncTaskCreationInfo(org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo) Guid(org.ovirt.engine.core.compat.Guid)

Example 19 with AsyncTaskCreationInfo

use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.

the class DeleteImageGroupVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    uuidReturn = deleteImage(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), String.valueOf(getParameters().getPostZero()), getParameters().isDiscard(), String.valueOf(getParameters().getForceDelete()).toLowerCase());
    proceedProxyReturnValue();
    Guid taskID = new Guid(uuidReturn.uuid);
    getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.deleteImage, getParameters().getStoragePoolId()));
}
Also used : AsyncTaskCreationInfo(org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo) Guid(org.ovirt.engine.core.compat.Guid)

Example 20 with AsyncTaskCreationInfo

use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.

the class MoveImageGroupVDSCommand method executeIrsBrokerCommand.

@Override
protected void executeIrsBrokerCommand() {
    storageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getDstDomainId());
    uuidReturn = moveImage(getParameters().getStoragePoolId().toString(), getParameters().getStorageDomainId().toString(), getParameters().getDstDomainId().toString(), getParameters().getImageGroupId().toString(), getParameters().getVmId().toString(), getParameters().getOp().getValue(), String.valueOf(getParameters().getPostZero()).toLowerCase(), getParameters().isDiscard(), String.valueOf(getParameters().getForce()).toLowerCase());
    proceedProxyReturnValue();
    Guid taskID = new Guid(uuidReturn.uuid);
    getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.moveImage, getParameters().getStoragePoolId()));
}
Also used : AsyncTaskCreationInfo(org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

AsyncTaskCreationInfo (org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo)24 Guid (org.ovirt.engine.core.compat.Guid)20 ArrayList (java.util.ArrayList)2 SPMTask (org.ovirt.engine.core.bll.tasks.interfaces.SPMTask)2 AsyncTask (org.ovirt.engine.core.common.businessentities.AsyncTask)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 FutureTask (java.util.concurrent.FutureTask)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 CopyImageGroupWithDataCommandParameters (org.ovirt.engine.core.common.action.CopyImageGroupWithDataCommandParameters)1 AsyncTaskType (org.ovirt.engine.core.common.asynctasks.AsyncTaskType)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 CopyImageVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.CopyImageVDSCommandParameters)1 DestroyImageVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.DestroyImageVDSCommandParameters)1 MoveImageGroupVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.MoveImageGroupVDSCommandParameters)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 TransactionScopeOption (org.ovirt.engine.core.compat.TransactionScopeOption)1 VdsManager (org.ovirt.engine.core.vdsbroker.VdsManager)1