use of org.ovirt.engine.core.common.action.RemoveImageParameters in project ovirt-engine by oVirt.
the class RemoveDiskCommand method buildRemoveImageParameters.
private RemoveImageParameters buildRemoveImageParameters(DiskImage diskImage) {
RemoveImageParameters result = new RemoveImageParameters(diskImage.getImageId());
result.setTransactionScopeOption(TransactionScopeOption.Suppress);
result.setDiskImage(diskImage);
result.setParentCommand(ActionType.RemoveDisk);
result.setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getDiskId()));
result.setParentParameters(getParameters());
result.setRemoveFromSnapshots(true);
result.setStorageDomainId(getParameters().getStorageDomainId());
result.setForceDelete(getParameters().getForceDelete());
if (diskImage.getStorageIds().size() > 1) {
result.setDbOperationScope(ImageDbOperationScope.MAPPING);
}
return result;
}
use of org.ovirt.engine.core.common.action.RemoveImageParameters in project ovirt-engine by oVirt.
the class CreateSnapshotFromTemplateCommand method removeImage.
private void removeImage() {
RemoveImageParameters removeImageParams = new RemoveImageParameters(getParameters().getDestinationImageId());
removeImageParams.setStorageDomainId(getDestinationStorageDomainId());
removeImageParams.setDbOperationScope(ImageDbOperationScope.NONE);
removeImageParams.setShouldLockImage(false);
removeImageParams.setEntityInfo(new EntityInfo(VdcObjectType.Disk, getDestinationDiskImage().getId()));
ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.RemoveImage, removeImageParams);
if (!returnValue.getSucceeded()) {
addAuditLogOnRemoveFailure();
}
}
use of org.ovirt.engine.core.common.action.RemoveImageParameters in project ovirt-engine by oVirt.
the class RemoveAllVmImagesCommand method buildRemoveImageParameters.
private RemoveImageParameters buildRemoveImageParameters(DiskImage image) {
RemoveImageParameters result = new RemoveImageParameters(image.getImageId());
boolean parentExists = isExecutedAsChildCommand();
result.setParentCommand(parentExists ? getParameters().getParentCommand() : getActionType());
result.setParentParameters(parentExists ? getParameters().getParentParameters() : getParameters());
result.setDiskImage(image);
result.setEntityInfo(getParameters().getEntityInfo());
result.setForceDelete(getParameters().getForceDelete());
result.setShouldLockImage(false);
return result;
}
use of org.ovirt.engine.core.common.action.RemoveImageParameters in project ovirt-engine by oVirt.
the class CopyImageGroupCommand method revertTasks.
@Override
protected void revertTasks() {
if (getParameters().getRevertDbOperationScope() != null) {
Guid destImageId = getParameters().getDestinationImageId();
RemoveImageParameters removeImageParams = new RemoveImageParameters(destImageId);
if (getParameters().getParentCommand() == ActionType.AddVmFromSnapshot) {
removeImageParams.setParentParameters(getParameters());
removeImageParams.setParentCommand(ActionType.CopyImageGroup);
} else {
removeImageParams.setParentParameters(removeImageParams);
removeImageParams.setParentCommand(ActionType.RemoveImage);
removeImageParams.setStorageDomainId(getParameters().getStorageDomainId());
removeImageParams.setDbOperationScope(getParameters().getRevertDbOperationScope());
removeImageParams.setShouldLockImage(getParameters().isShouldLockImageOnRevert());
}
removeImageParams.setEntityInfo(new EntityInfo(VdcObjectType.Disk, getDestinationImageId()));
// Setting the image as the monitored entity, so there will not be dependency
ActionReturnValue returnValue = checkAndPerformRollbackUsingCommand(ActionType.RemoveImage, removeImageParams, null);
if (returnValue.getSucceeded()) {
// Starting to monitor the tasks - RemoveImage is an internal command
// which adds the taskId on the internal task ID list
startPollingAsyncTasks(returnValue.getInternalVdsmTaskIdList());
}
}
}
Aggregations