Source:
<code>private void createDiskBasedOnImage() { if(!getParameters().getDiskInfo().isWipeAfterDeleteSet()) { StorageType storageType = getStorageDomain().getStorageType(); getParameters().getDiskInfo().setWipeAfterDelete(WipeAfterDeleteUtils.getDefaultWipeAfterDeleteFlag(storageType)); } AddImageFromScratchParameters parameters = new AddImageFromScratchParameters(Guid.Empty, getParameters().getVmId(), getDiskImageInfo()); parameters.setQuotaId(getQuotaId()); parameters.setDiskAlias(getDiskAlias()); parameters.setStorageDomainId(getStorageDomainId()); parameters.setParentCommand(VdcActionType.AddDisk); parameters.setEntityInfo(getParameters().getEntityInfo()); parameters.setStoragePoolId(getStorageDomain().getStoragePoolId()); parameters.setParentParameters(getParameters()); if (getVm() != null) { setVmSnapshotIdForDisk(parameters); <START> boolean shouldPlugDisk = getVm().getStatus() == VMStatus.Down && (getParameters().getPlugDiskToVm() == null || getParameters().getPlugDiskToVm()); <END> getCompensationContext().snapshotNewEntity(VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo() .getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK, null, shouldPlugDisk, Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()), null)); getCompensationContext().stateChanged(); } VdcReturnValueBase tmpRetValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, parameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext(), getLock())); setLock(null); getReturnValue().getVdsmTaskIdList().addAll(tmpRetValue.getInternalVdsmTaskIdList()); if (tmpRetValue.getActionReturnValue() != null) { DiskImage diskImage = (DiskImage) tmpRetValue.getActionReturnValue(); addDiskPermissions(diskImage); getReturnValue().setActionReturnValue(diskImage.getId()); } getReturnValue().setFault(tmpRetValue.getFault()); setSucceeded(tmpRetValue.getSucceeded()); }</code><technical_language>please export this a method</technical_language>

Target:
private void createDiskBasedOnImage() { if(!getParameters().getDiskInfo().isWipeAfterDeleteSet()) { StorageType storageType = getStorageDomain().getStorageType(); getParameters().getDiskInfo().setWipeAfterDelete(WipeAfterDeleteUtils.getDefaultWipeAfterDeleteFlag(storageType)); } AddImageFromScratchParameters parameters = new AddImageFromScratchParameters(Guid.Empty, getParameters().getVmId(), getDiskImageInfo()); parameters.setQuotaId(getQuotaId()); parameters.setDiskAlias(getDiskAlias()); parameters.setStorageDomainId(getStorageDomainId()); parameters.setParentCommand(VdcActionType.AddDisk); parameters.setEntityInfo(getParameters().getEntityInfo()); parameters.setStoragePoolId(getStorageDomain().getStoragePoolId()); parameters.setParentParameters(getParameters()); if (getVm() != null) { setVmSnapshotIdForDisk(parameters); getCompensationContext().snapshotNewEntity(VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo() .getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK, null, shouldDiskBePlugged(), Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()), null)); getCompensationContext().stateChanged(); } VdcReturnValueBase tmpRetValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, parameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext(), getLock())); setLock(null); getReturnValue().getVdsmTaskIdList().addAll(tmpRetValue.getInternalVdsmTaskIdList()); if (tmpRetValue.getActionReturnValue() != null) { DiskImage diskImage = (DiskImage) tmpRetValue.getActionReturnValue(); addDiskPermissions(diskImage); getReturnValue().setActionReturnValue(diskImage.getId()); } getReturnValue().setFault(tmpRetValue.getFault()); setSucceeded(tmpRetValue.getSucceeded()); }