weizhouapache commented on code in PR #8930:
URL: https://github.com/apache/cloudstack/pull/8930#discussion_r1568594891
##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -7700,8 +7700,8 @@ public UserVm restoreVM(RestoreVMCmd cmd) throws
InsufficientCapacityException,
_accountMgr.checkAccess(caller, null, true, vm);
DiskOffering diskOffering = rootDiskOfferingId != null ?
validateAndGetDiskOffering(rootDiskOfferingId, vm, caller) : null;
- VMTemplateVO template = _templateDao.findById(newTemplateId);
- if (template.getSize() != null) {
+ VMTemplateVO template = _templateDao.findById(newTemplateId != null ?
newTemplateId : vm.getTemplateId());
+ if (template != null && template.getSize() != null) {
Review Comment:
@vishesh92
throw an exception if template is removed ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]