Source:
public void execute() { if (enclosingCommand.getParameters().getTaskGroupSuccess()) { enclosingCommand.getParameters().setImageGroupID(Guid.newGuid()); enclosingCommand.getParameters().setEntityInfo( new EntityInfo(VdcObjectType.Disk, enclosingCommand.getParameters().getImageGroupID())); DiskImage diskImage = enclosingCommand.getParameters().getDiskImage(); ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(enclosingCommand.getParameters().getStorageDomainId()); diskImage.setStorageIds(storageIds); diskImage.setStoragePoolId(enclosingCommand.getParameters().getStoragePoolId()); diskImage.setId(enclosingCommand.getParameters().getImageGroupID()); diskImage.setDiskInterface(DiskInterface.VirtIO); if (diskImage.getVolumeFormat() == VolumeFormat.RAW) { if (getDestinationStorageDomain().getStorageType().isBlockDomain()) { diskImage.setVolumeType(VolumeType.Preallocated); } else { diskImage.setVolumeType(VolumeType.Sparse); } } else { diskImage.setVolumeType(VolumeType.Sparse); } VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, getAddImageFromScratchParameters(), ExecutionHandler.createInternalJobContext()); enclosingCommand.getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); if (vdcReturnValue.getActionReturnValue() != null) { DiskImage newDiskImage = (DiskImage) vdcReturnValue.getActionReturnValue(); enclosingCommand.getParameters().setDestinationImageId(newDiskImage.getImageId()); } ExecutionHandler.setAsyncJob(enclosingCommand.getExecutionContext(), true); enclosingCommand.getReturnValue().setSucceeded(true); } }

Target:
public void execute() { if (enclosingCommand.getParameters().getTaskGroupSuccess()) { enclosingCommand.getParameters().setImageGroupID(Guid.newGuid()); enclosingCommand.getParameters().setEntityInfo( new EntityInfo(VdcObjectType.Disk, enclosingCommand.getParameters().getImageGroupID())); DiskImage diskImage = enclosingCommand.getParameters().getDiskImage(); ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(enclosingCommand.getParameters().getStorageDomainId()); diskImage.setStorageIds(storageIds); diskImage.setStoragePoolId(enclosingCommand.getParameters().getStoragePoolId()); diskImage.setId(enclosingCommand.getParameters().getImageGroupID()); diskImage.setDiskInterface(DiskInterface.VirtIO); if (diskImage.getVolumeFormat() == VolumeFormat.RAW && getDestinationStorageDomain().getStorageType().isBlockDomain()) { diskImage.setVolumeType(VolumeType.Preallocated); } else { diskImage.setVolumeType(VolumeType.Sparse); } VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, getAddImageFromScratchParameters(), ExecutionHandler.createInternalJobContext()); enclosingCommand.getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); if (vdcReturnValue.getActionReturnValue() != null) { DiskImage newDiskImage = (DiskImage) vdcReturnValue.getActionReturnValue(); enclosingCommand.getParameters().setDestinationImageId(newDiskImage.getImageId()); enclosingCommand.getParameters().getDiskImage().setImageId(newDiskImage.getImageId()); } ExecutionHandler.setAsyncJob(enclosingCommand.getExecutionContext(), true); enclosingCommand.getReturnValue().setSucceeded(true); } }