From 68f459b334cccf9dae3228acc4144d236e761785 Mon Sep 17 00:00:00 2001 From: mprokopchuk Date: Wed, 11 Sep 2024 05:45:50 -0700 Subject: [PATCH] CapacityManagementImpl.updateCapacityForHost(..) use VM update time in capacity calculation. (#9662) VM update time is nullable in DB and can cause NullPointerException if record in vm_instance has defined last_host_id and undefined update_time. --- .../src/main/java/com/cloud/capacity/CapacityManagerImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java index 64af417cc08b..421c980b2096 100644 --- a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java +++ b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import javax.inject.Inject; import javax.naming.ConfigurationException; @@ -709,7 +710,8 @@ public void updateCapacityForHost(final Host host, final Map