mirror of https://github.com/apache/cloudstack.git
Fix NPE when using baremetal template
Template size is NULL for baremetal, which caused NPE when unboxing
This commit is contained in:
parent
64c5266ec5
commit
db97bb8e89
|
|
@ -2450,7 +2450,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
// check if account/domain is with in resource limits to create a new vm
|
||||
boolean isIso = Storage.ImageFormat.ISO == template.getFormat();
|
||||
long size = _templateDao.findById(template.getId()).getSize();
|
||||
// For baremetal, size can be null
|
||||
Long tmp = _templateDao.findById(template.getId()).getSize();
|
||||
long size = 0;
|
||||
if (tmp != null) {
|
||||
size = tmp;
|
||||
}
|
||||
if (diskOfferingId != null) {
|
||||
size += _diskOfferingDao.findById(diskOfferingId).getDiskSize();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue