Skip to content

Live scaling for VMs with fixed service offerings on KVM#12975

Open
bernardodemarco wants to merge 1 commit intoapache:mainfrom
scclouds:live-scaling-vms-with-fixed-service-offerings
Open

Live scaling for VMs with fixed service offerings on KVM#12975
bernardodemarco wants to merge 1 commit intoapache:mainfrom
scclouds:live-scaling-vms-with-fixed-service-offerings

Conversation

@bernardodemarco
Copy link
Copy Markdown
Member

Description

Apache CloudStack currently supports live scaling only for VMs with custom constrained and custom unconstrained compute offerings. For VMs with fixed compute offerings, users must stop the VM, change its service offering through the scaleVirtualMachine API and then start it again. Depending on the criticality of the applications running on the VM, the downtime caused by this process is highly undesirable.

Therefore, this PR introduces support for live scaling of VMs with fixed service offerings when using the KVM hypervisor in Apache CloudStack. The feature specification is available at #12908.

Fixes #12908 and fixes #6865

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)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

Test environment setup

  • Created multiple service offerings, including fixed and non-fixed offerings, with and without CPU cap enabled, with and without the dynamic scaling feature enabled:
Active service offerings Image
  • Enabled the global setting enable.dynamic.scale.vm.

Definition of the domain XML of the guest VMs

Verified that:

  • When the enable.dynamic.scale.vm global setting value is false, the domain XML of guest VMs is not prepared for live scaling;
  • When the Dynamically scalable property of service offerings is false, the domain XML of guest VMs is not prepared for live scaling;
  • When the Dynamically scalable property of templates is false, the domain XML of guest VMs is not prepared for live scaling;
  • When the Dynamically scalable property of VMs is false, the domain XML of guest VMs is not prepared for live scaling.

Live scaling

  • Verified the possibility of live scaling VMs from and to different types of service offerings;
  • Verified that, when suitable, CPU quota is applied on the fly;
  • Verified that, when suitable, CPU quota is removed on the fly;
  • Verified that, when suitable, CPU quota is updated on the fly.

kvm.cpu.dynamic.scaling.capacity and kvm.memory.dynamic.scaling.capacity settings

  • Verified that when the kvm.cpu.dynamic.scaling.capacity and kvm.memory.dynamic.scaling.capacity settings are equal to or less than 0, the host maximum capacity of CPU and memory is considered to define the upper limits for live scaling.
  • Verified that when the kvm.cpu.dynamic.scaling.capacity and kvm.memory.dynamic.scaling.capacity settings are greater than 0, the values of the settings are considered to define the upper limits for live scaling.

auto.migrate.vm.on.live.scale.insufficient.capacity setting

  • Verified that when the auto.migrate.vm.on.live.scale.insufficient.capacity setting is true and the current host lacks sufficient compute capacity to live scale the instance, the VM is automatically migrated to a suitable host;
  • Verified that when the auto.migrate.vm.on.live.scale.insufficient.capacity setting is false and the current host lacks sufficient compute capacity to live scale the instance, the VM is not migrated to a suitable host and an error message is returned.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 72.16495% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.01%. Comparing base (30dd234) to head (6e93c57).

Files with missing lines Patch % Lines
...n/java/com/cloud/vm/VirtualMachineManagerImpl.java 0.00% 20 Missing ⚠️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% 17 Missing ⚠️
.../main/java/com/cloud/agent/api/ScaleVmCommand.java 0.00% 5 Missing ⚠️
.../java/com/cloud/agent/api/to/VirtualMachineTO.java 20.00% 4 Missing ⚠️
...ervisor/kvm/resource/LibvirtComputingResource.java 94.59% 3 Missing and 1 partial ⚠️
...er/src/main/java/com/cloud/hypervisor/KVMGuru.java 96.61% 0 Missing and 2 partials ⚠️
...ypervisor/kvm/resource/LibvirtDomainXMLParser.java 0.00% 1 Missing ⚠️
...om/cloud/hypervisor/kvm/resource/LibvirtVMDef.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #12975   +/-   ##
=========================================
  Coverage     18.00%   18.01%           
- Complexity    16465    16476   +11     
=========================================
  Files          5977     5977           
  Lines        537731   537807   +76     
  Branches      66026    66035    +9     
=========================================
+ Hits          96840    96893   +53     
- Misses       429971   429994   +23     
  Partials      10920    10920           
Flag Coverage Δ
uitests 3.52% <ø> (+<0.01%) ⬆️
unittests 19.18% <72.16%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@bernardodemarco
Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

@blueorangutan
Copy link
Copy Markdown

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

@weizhouapache
Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

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.

Live scaling for VMs with fixed service offerings on KVM A running vm cannot dynamically scale cpu and memory. It can be expanded when stopped

3 participants