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();
}
}
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()));
}
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()));
}
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()));
}
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()));
}
Aggregations