Source:
<code>public void validateRootDiskResize(final HypervisorType hypervisorType, Long rootDiskSize, VMTemplateVO templateVO, UserVmVO vm, final Map<String, String> customParameters) throws InvalidParameterValueException { if ((rootDiskSize << 30) < templateVO.getSize()) { Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024; s_logger.error("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() + "B (" + templateVOSizeGB + "GB)"); throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() + "B (" + templateVOSizeGB + "GB)"); } else if ((rootDiskSize << 30) > templateVO.getSize()){ if (hypervisorType == HypervisorType.VMware && !vm.getDetails().get("rootDiskController").toLowerCase().contains("scsi")) { <START> s_logger.error("Found unsupported root disk controller : " + vm.getDetails().get("rootDiskController")); <END> throw new InvalidParameterValueException("Found unsupported root disk controller :" + vm.getDetails().get("rootDiskController")); }else{ s_logger.debug("Rootdisksize override validation successful. Template root disk size "+(templateVO.getSize() / 1024 / 1024 / 1024)+ " GB" + " Root disk size specified "+ rootDiskSize+" GB");} } else { s_logger.debug("Root disk size specified is " + (rootDiskSize << 30) + " and Template root disk size is " + templateVO.getSize()+" . Both are equal so no need to override"); customParameters.remove("rootdisksize"); } }</code><technical_language>Thanks a lot @borisstoyanov. @priyankparihar I NPE line 3615 is due rootdiskcontroller set for VM. If template is imported explicitly root disk controller a global setting in effect</technical_language>

Target:
public void validateRootDiskResize(final HypervisorType hypervisorType, Long rootDiskSize, VMTemplateVO templateVO, UserVmVO vm, final Map<String, String> customParameters) throws InvalidParameterValueException { if ((rootDiskSize << 30) < templateVO.getSize()) { Long templateVOSizeGB = templateVO.getSize() / 1024 / 1024 / 1024; s_logger.error("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() + "B (" + templateVOSizeGB + "GB)"); throw new InvalidParameterValueException("unsupported: rootdisksize override is smaller than template size " + templateVO.getSize() + "B (" + templateVOSizeGB + "GB)"); } else if ((rootDiskSize << 30) > templateVO.getSize()) { if (hypervisorType == HypervisorType.VMware && (vm.getDetails() == null || vm.getDetails().get("rootDiskController") == null)) { s_logger.warn("If Root disk controller parameter is not overridden, then Root disk resize may fail because current Root disk controller value is NULL."); } else if (hypervisorType == HypervisorType.VMware && !vm.getDetails().get("rootDiskController").toLowerCase().contains("scsi")) { s_logger.error("Found unsupported root disk controller : " + vm.getDetails().get("rootDiskController")); throw new InvalidParameterValueException("Found unsupported root disk controller :" + vm.getDetails().get("rootDiskController")); } else { s_logger.debug("Rootdisksize override validation successful. Template root disk size "+(templateVO.getSize() / 1024 / 1024 / 1024)+ " GB" + " Root disk size specified "+ rootDiskSize+" GB"); } } else { s_logger.debug("Root disk size specified is " + (rootDiskSize << 30) + " and Template root disk size is " + templateVO.getSize()+" . Both are equal so no need to override"); customParameters.remove("rootdisksize"); } }