bug 7933: this happens if you create a vm off of a so, and then delete that so. the so now ceases to exist, however, the host tries to calc stats using the so, which is null. fixing that issue.

status 7933: resolved fixed
This commit is contained in:
abhishek 2011-01-13 14:53:48 -08:00
parent d7d9a251be
commit 13c0478b9b
1 changed files with 4 additions and 2 deletions

View File

@ -2876,7 +2876,7 @@ public class ManagementServerImpl implements ManagementServer {
Long parentId = cmd.getParentDomainId();
Long ownerId = UserContext.current().getCaller().getId();
Account account = UserContext.current().getCaller();
if (ownerId == null) {
ownerId = Long.valueOf(1);
}
@ -3153,7 +3153,9 @@ public class ManagementServerImpl implements ManagementServer {
List<UserVmVO> instances = _userVmDao.listUpByHostId(hostId);
for (UserVmVO vm : instances) {
ServiceOffering so = findServiceOfferingById(vm.getServiceOfferingId());
mem += so.getRamSize() * 1024L * 1024L;
if (so != null) {
mem += so.getRamSize() * 1024L * 1024L;
}
}
return mem;
}