Source:
protected void init() { T parameters = getParameters(); if (parameters.getVmStaticData() != null) { Guid templateIdToUse = getParameters().getVmStaticData().getVmtGuid(); if (parameters.getVmStaticData().isUseLatestVersion()) { VmTemplate latest = getVmTemplateDao().getTemplateWithLatestVersionInChain(templateIdToUse); if (latest != null) { if (!templateIdToUse.equals(latest.getId())) { getParameters().setDiskInfoDestinationMap(new HashMap<Guid, DiskImage>()); } setVmTemplate(latest); templateIdToUse = latest.getId(); getParameters().getVmStaticData().setVmtGuid(templateIdToUse); } } setVmTemplateId(templateIdToUse); if (parameters.isSoundDeviceEnabled() == null) { parameters.setSoundDeviceEnabled(parameters.getVmStaticData().getVmType() == VmType.Desktop); } if (parameters.isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } vmDevicesSourceId = (getInstanceTypeId() != null) ? getInstanceTypeId() : parameters.getVmStaticData().getVmtGuid(); imageTypeId = parameters.getVmStaticData().getImageTypeId(); vmInterfacesSourceId = parameters.getVmStaticData().getVmtGuid(); vmDisksSource = getVmTemplate(); } parameters.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); updateVmObject(); initTemplateDisks(); initStoragePoolId(); diskInfoDestinationMap = getParameters().getDiskInfoDestinationMap(); if (diskInfoDestinationMap == null) { diskInfoDestinationMap = new HashMap<>(); } VmHandler.updateDefaultTimeZone(parameters.getVmStaticData()); if (getParameters().getVmStaticData() != null && getParameters().getVmStaticData().getMigrationSupport() == null) { setDefaultMigrationPolicy(); } }

Target:
protected void init() { T parameters = getParameters(); if (parameters.getVmStaticData() != null) { Guid templateIdToUse = getParameters().getVmStaticData().getVmtGuid(); if (parameters.getVmStaticData().isUseLatestVersion()) { VmTemplate latest = getVmTemplateDao().getTemplateWithLatestVersionInChain(templateIdToUse); if (latest != null) { if (!templateIdToUse.equals(latest.getId())) { getParameters().setDiskInfoDestinationMap(new HashMap<Guid, DiskImage>()); } setVmTemplate(latest); templateIdToUse = latest.getId(); getParameters().getVmStaticData().setVmtGuid(templateIdToUse); } } setVmTemplateId(templateIdToUse); if (shouldOverrideSoundDevice()) { parameters.setSoundDeviceEnabled(true); } if (parameters.isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } vmDevicesSourceId = (getInstanceTypeId() != null) ? getInstanceTypeId() : parameters.getVmStaticData().getVmtGuid(); imageTypeId = parameters.getVmStaticData().getImageTypeId(); vmInterfacesSourceId = parameters.getVmStaticData().getVmtGuid(); vmDisksSource = getVmTemplate(); } parameters.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); updateVmObject(); initTemplateDisks(); initStoragePoolId(); diskInfoDestinationMap = getParameters().getDiskInfoDestinationMap(); if (diskInfoDestinationMap == null) { diskInfoDestinationMap = new HashMap<>(); } VmHandler.updateDefaultTimeZone(parameters.getVmStaticData()); if (getParameters().getVmStaticData() != null && getParameters().getVmStaticData().getMigrationSupport() == null) { setDefaultMigrationPolicy(); } }