Skip to content

Log improvement when deploying a VM - #14972

Open
EnzoBartelt wants to merge 1 commit into
apache:4.20from
scclouds:vm-deploy-log-fix
Open

EnzoBartelt wants to merge 1 commit into
apache:4.20from
scclouds:vm-deploy-log-fix

Conversation

@EnzoBartelt

Copy link
Copy Markdown

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)
  • 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
  • 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.

@boring-cyborg

boring-cyborg Bot commented Dec 3, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@bernardodemarco

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@bernardodemarco
bernardodemarco self-requested a review December 3, 2026 15:27
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.46%. Comparing base (5d4a376) to head (a7409de).
⚠️ Report is 1 commits behind head on 4.20.

Files with missing lines Patch % Lines
...e/cloudstack/storage/volume/VolumeServiceImpl.java 0.00% 5 Missing ⚠️
...n/java/com/cloud/capacity/CapacityManagerImpl.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #14972   +/-   ##
=========================================
  Coverage     16.46%   16.46%           
+ Complexity    13713    13712    -1     
=========================================
  Files          5670     5670           
  Lines        501771   501764    -7     
  Branches      60965    60958    -7     
=========================================
+ Hits          82610    82611    +1     
+ Misses       409906   409897    -9     
- Partials       9255     9256    +1     
Flag Coverage Δ
uitests 4.16% <ø> (ø)
unittests 17.33% <11.11%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20285

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants