Noam Slomianko has uploaded a new change for review.

Change subject: engine: fix null pointer in VdsUpdateRunTimeInfo
......................................................................

engine: fix null pointer in VdsUpdateRunTimeInfo

In case a VM was in the host but not in the DB a null pointer exception
would occur, added a fix.

Change-Id: I07ba7082196441ad6bd5b66436e3c944c4abec21
Signed-off-by: Noam Slomianko <nslom...@redhat.com>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/17297/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index e8fae40..19500ad 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -1309,8 +1309,14 @@
     private void proceedGuaranteedMemoryCheck() {
         for (VmInternalData vmInternalData : _runningVms.values()) {
             VM savedVm = _vmDict.get(vmInternalData.getVmDynamic().getId());
+            if (savedVm == null) {
+                // Vm is in the host but not in the DB, there is nothing we 
can do
+                // It is logged later
+                return;
+            }
             VmStatistics vmStatistics = vmInternalData.getVmStatistics();
-            if (vmStatistics.getCurrentMemory() != null && 
vmStatistics.getCurrentMemory() > 0 &&
+            if (vmStatistics != null && vmStatistics.getCurrentMemory() != 
null &&
+                    vmStatistics.getCurrentMemory() > 0 &&
                     savedVm.getMinAllocatedMem() > 
vmStatistics.getCurrentMemory() / TO_MEGA_BYTES) {
                 AuditLogableBase auditLogable = new AuditLogableBase();
                 auditLogable.addCustomValue("VmName", savedVm.getName());


-- 
To view, visit http://gerrit.ovirt.org/17297
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07ba7082196441ad6bd5b66436e3c944c4abec21
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Noam Slomianko <nslom...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to