Source:
<code>protected void init() { if (Guid.isNullOrEmpty(getParameters().getVmTemplateId())) { getParameters().setVmTemplateId(Guid.newGuid()); } setVmTemplateId(getParameters().getVmTemplateId()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setVmTemplateName(getParameters().getName()); VmStatic masterVm = getParameters().getMasterVm(); if (masterVm != null) { setVmId(masterVm.getId()); setClusterId(masterVm.getClusterId()); if (getVmDeviceUtils().shouldOverrideSoundDevice( masterVm, getMasterVmCompatibilityVersion(), getParameters().isSoundDeviceEnabled())) { getParameters().setSoundDeviceEnabled(true); } if (getParameters().isSoundDeviceEnabled() == null) { getParameters().setSoundDeviceEnabled(false); } if (getParameters().isConsoleEnabled() == null) { getParameters().setConsoleEnabled(false); } vmHandler.updateDefaultTimeZone(masterVm); vmHandler.autoSelectUsbPolicy(masterVm); vmHandler.autoSelectDefaultDisplayType(getVmId(), masterVm, getCluster(), getParameters().getGraphicsDevices()); vmHandler.autoSelectGraphicsDevice(getVmId(), masterVm, getCluster(), getParameters().getGraphicsDevices(), getMasterVmCompatibilityVersion()); <START> vmHandler.autoSelectResumeBehavior(masterVm, getCluster().getCompatibilityVersion()); <END> separateCustomProperties(masterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getCluster() != null && masterVm != null) { VM vm = new VM(masterVm, new VmDynamic(), null); vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getCluster().getStoragePoolId()); } updateDiskInfoDestinationMap(); generateTargetDiskIds(); getParameters().setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }</code><technical_language>afraid need check if getCluster() is null here, executed validation</technical_language>

Target:
protected void init() { if (Guid.isNullOrEmpty(getParameters().getVmTemplateId())) { getParameters().setVmTemplateId(Guid.newGuid()); } setVmTemplateId(getParameters().getVmTemplateId()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setVmTemplateName(getParameters().getName()); VmStatic masterVm = getParameters().getMasterVm(); if (masterVm != null) { setVmId(masterVm.getId()); setClusterId(masterVm.getClusterId()); if (getVmDeviceUtils().shouldOverrideSoundDevice( masterVm, getMasterVmCompatibilityVersion(), getParameters().isSoundDeviceEnabled())) { getParameters().setSoundDeviceEnabled(true); } if (getParameters().isSoundDeviceEnabled() == null) { getParameters().setSoundDeviceEnabled(false); } if (getParameters().isConsoleEnabled() == null) { getParameters().setConsoleEnabled(false); } vmHandler.updateDefaultTimeZone(masterVm); vmHandler.autoSelectUsbPolicy(masterVm); vmHandler.autoSelectDefaultDisplayType(getVmId(), masterVm, getCluster(), getParameters().getGraphicsDevices()); vmHandler.autoSelectGraphicsDevice(getVmId(), masterVm, getCluster(), getParameters().getGraphicsDevices(), getMasterVmCompatibilityVersion()); vmHandler.autoSelectResumeBehavior(masterVm, getCluster()); separateCustomProperties(masterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getCluster() != null && masterVm != null) { VM vm = new VM(masterVm, new VmDynamic(), null); vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getCluster().getStoragePoolId()); } updateDiskInfoDestinationMap(); generateTargetDiskIds(); getParameters().setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }