Skip to content

Fix Revert Instance to Snapshot with custom service offering#12885

Open
abh1sar wants to merge 1 commit intoapache:4.20from
shapeblue:custom-svc-off
Open

Fix Revert Instance to Snapshot with custom service offering#12885
abh1sar wants to merge 1 commit intoapache:4.20from
shapeblue:custom-svc-off

Conversation

@abh1sar
Copy link
Contributor

@abh1sar abh1sar commented Mar 25, 2026

Description

This PR fixes a regression in Revert VM to Snapshot with Dynamic/Custom service offering.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  1. Create an Instance with Custom service offering
  2. Take a VM snapshot
  3. Revert the snapshot

Before fix :

2026-03-24 10:26:04,056 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-5:[ctx-a2bbedfa, job-76]) (logid:5c30faaa) Unexpected exception while executing org.apache.cloudstack.api.command.admin.vmsnapshot.RevertToVMSnapshotCmdByAdmin com.cloud.utils.exception.CloudRuntimeException: While the VM is running, only scalling up it is supported. New service offering {"memory": 512, "speed": 500, "cpu": 1} should have at least one value (ram, speed or cpu) greater than the current values {"memory": 512, "speed": 500, "cpu": 1}.
    at com.cloud.vm.snapshot.VMSnapshotManagerImpl.orchestrateRevertToVMSnapshot(VMSnapshotManagerImpl.java:954)

After fix:

Revert was successful.

How did you try to break this feature and the system with this change?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression in VM snapshot revert for VMs using dynamic/custom service offerings by avoiding unnecessary service-offering “upgrade” operations during revert.

Changes:

  • Tightens/clarifies validation around allowed VM state vs snapshot type for revert (disk-only vs disk+memory).
  • Reworks service offering handling during revert by introducing a “needs change” check before attempting to change the VM’s service offering.
  • Updates revert transaction flow to only call changeUserVmServiceOffering(...) when a change is detected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 70.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.25%. Comparing base (c19630f) to head (5e066a1).

Files with missing lines Patch % Lines
...a/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java 70.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #12885   +/-   ##
=========================================
  Coverage     16.25%   16.25%           
  Complexity    13415    13415           
=========================================
  Files          5664     5664           
  Lines        500465   500476   +11     
  Branches      60780    60782    +2     
=========================================
+ Hits          81338    81347    +9     
- Misses       410031   410033    +2     
  Partials       9096     9096           
Flag Coverage Δ
uitests 4.15% <ø> (ø)
unittests 17.10% <70.00%> (+<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.

@abh1sar
Copy link
Contributor Author

abh1sar commented Mar 25, 2026

@blueorangutan package

@blueorangutan
Copy link

@abh1sar 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blueorangutan
Copy link

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

@abh1sar
Copy link
Contributor Author

abh1sar commented Mar 25, 2026

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-15737)

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