Skip to content

Commit 864071f

Browse files
committed
Prevent NPE when removing NIC from a stopped VM using service offering with CPU cap set
1 parent 4348386 commit 864071f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/main/java/com/cloud/hypervisor/KVMGuru.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ protected void setVmQuotaPercentage(VirtualMachineTO to, VirtualMachineProfile v
132132
VirtualMachine vm = vmProfile.getVirtualMachine();
133133
HostVO host = hostDao.findById(vm.getHostId());
134134
if (host == null) {
135-
throw new CloudRuntimeException("Host with id: " + vm.getHostId() + " not found");
135+
logger.warn("Host is not available. Skipping CPU quota calculation for VM: {}", vm);
136+
return;
136137
}
137138
logger.debug("Limiting CPU usage for VM: {} on host: {}", vm, host);
138139
double hostMaxSpeed = getHostCPUSpeed(host);

0 commit comments

Comments
 (0)