You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2025/12/10 17:30:55 UTC

(cloudstack) 01/01: Prevent NPE when removing NIC from a stopped VM using service offering with CPU cap set

This is an automated email from the ASF dual-hosted git repository.

pearl11594 pushed a commit to branch ghi12225-removeNic-cpuCap
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 864071f50b5aca2402b923533828c6dbbf3bd0bd
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Wed Dec 10 12:30:35 2025 -0500

    Prevent NPE when removing NIC from a stopped VM using service offering with CPU cap set
---
 server/src/main/java/com/cloud/hypervisor/KVMGuru.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
index 9edaa5e6d64..c178cc8bc53 100644
--- a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
+++ b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
@@ -132,7 +132,8 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru {
             VirtualMachine vm = vmProfile.getVirtualMachine();
             HostVO host = hostDao.findById(vm.getHostId());
             if (host == null) {
-                throw new CloudRuntimeException("Host with id: " + vm.getHostId() + " not found");
+                logger.warn("Host is not available. Skipping CPU quota calculation for VM: {}", vm);
+                return;
             }
             logger.debug("Limiting CPU usage for VM: {} on host: {}", vm, host);
             double hostMaxSpeed = getHostCPUSpeed(host);