Skip to content

Fix Revert Instance to Snapshot with custom service offering - #12885

Merged
abh1sar merged 2 commits into
apache:4.20from
shapeblue:custom-svc-off
Mar 27, 2026
Merged

Fix Revert Instance to Snapshot with custom service offering#12885
abh1sar merged 2 commits into
apache:4.20from
shapeblue:custom-svc-off

Conversation

@abh1sar

Copy link
Copy Markdown
Contributor

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?

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadserver/src/main/java/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java Outdated
Comment threadserver/src/main/java/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java Outdated
@codecov

codecovBot commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.25%. Comparing base (4b7370a) to head (64c9a96).
⚠️ Report is 1 commits behind head on 4.20.

Files with missing linesPatch %Lines
...a/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java70.00%5 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## 4.20 #12885 +/- ##
=========================================
Coverage 16.25% 16.25% - Complexity 13419 13421 +2 
=========================================
Files 5664 5664 Lines 500467 500478 +11 Branches 60780 60782 +2 =========================================
+ Hits 81354 81365 +11 - Misses 410018 410019 +1 + Partials 9095 9094 -1 
FlagCoverage Δ
uitests4.15% <ø> (ø)
unittests17.11% <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
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@abh1sar

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-15737)

@winterhazelwinterhazel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CLGTM, but did not test it yet

Comment threadserver/src/main/java/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java Outdated
@abh1sar

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-15743)

@abh1sarabh1sar closed this Mar 26, 2026
@abh1sarabh1sar reopened this Mar 26, 2026
@abh1sar

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@abh1sar
abh1sar requested a review from RosiKyuMarch 26, 2026 07:38

@RosiKyuRosiKyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Image

@abh1sar

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

abh1sarand others added 2 commits March 27, 2026 08:56
@abh1sar
abh1sar merged commit b22dbbe into apache:4.20Mar 27, 2026
26 checks passed
@abh1sar
abh1sar deleted the custom-svc-off branch March 27, 2026 04:49
@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-15747)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 64223 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12885-t15747-kvm-ol8.zip
Smoke tests completed. 138 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_08_upgrade_kubernetes_ha_clusterFailure3687.89test_kubernetes_clusters.py
test_01_deployVMInSharedNetworkFailure282.62test_network.py
test_02_list_cpvm_vmFailure0.04test_ssvm.py
test_04_cpvm_internalsFailure0.06test_ssvm.py

DaanHoogland pushed a commit that referenced this pull request Apr 17, 2026
DaanHoogland pushed a commit that referenced this pull request Apr 20, 2026
Sign up for freeto 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.

5 participants

@abh1sar@blueorangutan@winterhazel@RosiKyu