mirror of https://github.com/apache/cloudstack.git
Fix null pointer exception in restore VM (#431)
This commit is contained in:
parent
e630d7afea
commit
93e66c52dc
|
|
@ -7683,8 +7683,19 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
}
|
||||
_accountMgr.checkAccess(caller, null, true, vm);
|
||||
|
||||
VMTemplateVO template;
|
||||
if (newTemplateId != null) {
|
||||
template = _templateDao.findById(newTemplateId);
|
||||
if (template == null) {
|
||||
throw new InvalidParameterValueException("Cannot find template with ID " + newTemplateId);
|
||||
}
|
||||
} else {
|
||||
template = _templateDao.findById(vm.getTemplateId());
|
||||
if (template == null) {
|
||||
throw new InvalidParameterValueException("Cannot find template linked with VM");
|
||||
}
|
||||
}
|
||||
DiskOffering diskOffering = rootDiskOfferingId != null ? validateAndGetDiskOffering(rootDiskOfferingId, vm, caller) : null;
|
||||
VMTemplateVO template = _templateDao.findById(newTemplateId);
|
||||
if (template.getSize() != null) {
|
||||
String rootDiskSize = details.get(VmDetailConstants.ROOT_DISK_SIZE);
|
||||
Long templateSize = template.getSize();
|
||||
|
|
|
|||
Loading…
Reference in New Issue