EnzoBartelt opened a new pull request, #14972:
URL: https://github.com/apache/cloudstack/pull/14972
### Description
Some logs generated when deploying VMs are very confusing, potentially
leading to misudertanding of a success/failure. As example, the log shown below
might make the reader believe that there was a problem at the deploy, but it
was just a fail when creating a JSON string from a VM instance object.
```
2026-12-02 14:36:57,605 DEBUG [c.c.d.DeploymentPlanningManagerImpl]
(API-Job-Executor-5:[ctx-74dcff3b, job-3994307, ctx-48c67576]) (logid:f5a54727)
Trying to deploy VM [error decoding VM instance
{"id":60387,"instanceName":"i-5395-60387-VM","state":"Stopped","type":"User","uuid":"c5deae8d-ddc1-4437-aabb-213036fdb94d"}]
and details: Plan
[{"_dcId":3,"_recreateDisks":false,"preferredHostIds":[],"migrationPlan":false,"hostPriorities":{}}];
avoid list [{}] and planner: [].
```
Another case is when trying to allocate a VM using reserved resources. When
there aren't reserved resources available, it explicitly states that there was
a failure when allocating the VM. However, the available resources are verified
in sequence, and the deployment workflow proceeds without any errors.
```
2026-12-02 14:36:59,044 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) STATS: Failed to alloc resource from host: Host
{"id":132,"name":"panthro05","type":"Routing","uuid":"52057823-b6b9-4a2a-b7f4-d00b6bf2a512"}
reservedCpu: 0, requested cpu: 2000, reservedMem: (0 bytes) 0, requested mem:
(2.00 GB) 2147483648
2026-12-02 14:36:59,045 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) Host does not have enough reserved CPU available, cannot
allocate to this host.
2026-12-02 14:36:59,045 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) Checking if host: Host
{"id":132,"name":"panthro05","type":"Routing","uuid":"52057823-b6b9-4a2a-b7f4-d00b6bf2a512"}
has enough capacity for requested CPU: 2000 and requested RAM: (2.00 GB)
2147483648 , cpuOverprovisioningFactor: 50.0
2026-12-02 14:36:59,048 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) Hosts's actual total CPU: 224000 and CPU after applying
overprovisioning: 11200000
2026-12-02 14:36:59,048 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) Free CPU: 10462000 , Requested CPU: 2000
2026-12-02 14:36:59,048 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) Free RAM: (251.38 GB) 269918928896 , Requested RAM: (2.00 GB)
2147483648
2026-12-02 14:36:59,048 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) Host has enough CPU and RAM available
2026-12-02 14:36:59,048 DEBUG [c.c.c.CapacityManagerImpl]
(Work-Job-Executor-92:[ctx-42868ead, job-3994307/job-3994325, ctx-1289bbfd])
(logid:f5a54727) STATS: Can alloc CPU from host: Host
{"id":132,"name":"panthro05","type":"Routing","uuid":"52057823-b6b9-4a2a-b7f4-d00b6bf2a512"},
used: 738000, reserved: 0, actual total: 224000, total with overprovisioning:
11200000; requested cpu: 2000, alloc_from_last_host?: false,
considerReservedCapacity?: true
```
These situations have been addressed aiming to make the logs clearer for
troubleshooting scenarios.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [X] Trivial
### How Has This Been Tested?
The PR was tested by deploying a VM and checking the Management Server logs,
comparing them before and after the changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]