Skip to content

Conversation

@sudo87
Copy link
Collaborator

@sudo87 sudo87 commented Oct 3, 2025

Description

This PR fixes #11502

  1. Prevent service offering update to specific domains if any instance for the offering are outside of those
  2. Removal of offerings is skipped if it is in use by any Instance.

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):

Screenshot 2025-11-06 at 12 10 38 PM

How Has This Been Tested?

  1. Create a compute offering L1 at Root Domain
  2. Create a domain d1
  3. Create an instance vm1 with L1 at root domain level
  4. Try updating service offering domain to d1, shouldn't be allowed
  5. Destroy instance vm1
  6. Update of domain d1 for service offering works

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

@codecov
Copy link

codecov bot commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 8.51064% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.30%. Comparing base (d53b6db) to head (a487eba).
⚠️ Report is 34 commits behind head on 4.20.

Files with missing lines Patch % Lines
.../main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java 0.00% 26 Missing ⚠️
...rc/main/java/com/cloud/user/DomainManagerImpl.java 0.00% 8 Missing ⚠️
...main/java/com/cloud/storage/dao/VolumeDaoImpl.java 40.00% 6 Missing ⚠️
.../cloud/configuration/ConfigurationManagerImpl.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #11780      +/-   ##
============================================
+ Coverage     16.19%   16.30%   +0.11%     
- Complexity    13306    13427     +121     
============================================
  Files          5657     5657              
  Lines        498467   503719    +5252     
  Branches      60491    62373    +1882     
============================================
+ Hits          80702    82117    +1415     
- Misses       408783   412537    +3754     
- Partials       8982     9065      +83     
Flag Coverage Δ
uitests 4.10% <ø> (+0.09%) ⬆️
unittests 17.15% <8.51%> (+0.11%) ⬆️

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.

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

@sudo87 idea seems correct, implementation not

@sudo87 sudo87 marked this pull request as draft October 3, 2025 08:52
@sudo87 sudo87 marked this pull request as ready for review October 6, 2025 12:13
@sudo87
Copy link
Collaborator Author

sudo87 commented Oct 6, 2025

@blueorangutan package

@blueorangutan
Copy link

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

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

@DaanHoogland DaanHoogland linked an issue Oct 31, 2025 that may be closed by this pull request
@DaanHoogland DaanHoogland requested a review from shwstppr October 31, 2025 19:28
@DaanHoogland DaanHoogland reopened this Oct 31, 2025
@sudo87 sudo87 requested a review from DaanHoogland November 4, 2025 05:07
@sudo87
Copy link
Collaborator Author

sudo87 commented Nov 4, 2025

@blueorangutan package

@blueorangutan
Copy link

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

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

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm, some overly complexity remains in the removeXxxOffering methods in DomainManagerImpl that might not be needed. whitebox testing advised.

@RosiKyu
Copy link
Collaborator

RosiKyu commented Dec 10, 2025

@blueorangutan package

@blueorangutan
Copy link

@rosi-shapeblue 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

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 15989

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 11, 2025

@blueorangutan package

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 15, 2025

Thank you, @RosiKyu, for taking the time to review and for validating the functionality.

On Black UI rendering issue, I will take a look at the code changes. Although that seems to be related to UI packaging issue.

@RosiKyu
Copy link
Collaborator

RosiKyu commented Dec 15, 2025

@blueorangutan package

@blueorangutan
Copy link

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

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

@RosiKyu
Copy link
Collaborator

RosiKyu commented Dec 15, 2025

@sudo87 , @DaanHoogland - the rendering issue does not appear to be caused by the PR code. Rebuilding the packages with the PR code resolved it, so I believe this can be safely merged.

screencapture-10-0-35-249-8080-client-2025-12-15-16_41_20

Copy link
Collaborator

@RosiKyu RosiKyu left a comment

Choose a reason for hiding this comment

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

LGTM - I have tested the PR and the core functionality is working as expected (below are the Test Restuls). All test cases for protecting offerings from deletion during domain removal have passed.

Test Results

Test Case Result
TC1: Prevent restricting service offering when VMs exist outside domain PASSED
TC2: Allow restricting offering after VM destroyed PASSED
TC3: Skip service offering removal during domain deletion when in use PASSED
TC4: Disk Offering protection PASSED
TC5: Network Offering protection PASSED
TC6: VPC Offering protection PASSED
TC7: Clean deletion (offering deleted when not in use) PASSED

Functionality Verified:

  • Service offerings protected from deletion when VMs are using them
  • Disk offerings protected from deletion when volumes are using them
  • Network offerings protected from deletion when networks are using them
  • VPC offerings protected from deletion when VPCs are using them
  • Offerings correctly deleted when no resources are using them
  • Domain restriction blocked when resources exist outside target domain

Detailed Test Results

Test Case 1 - Prevent restricting service offering when VMs exist outside target domain

Expected Result: Error message is triggered; Update should be blocked.

Actual Result: Error (530): "There are Instances associated to this service offering outside of the specified domains." - Update was blocked.

Status: PASSED

Screenshot from 2025-12-13 11-18-54

Test Case 2 - Allow Restricting Offering After VM is Destroyed

Expected Result: The update should succeed (no error).

Actual Result: Update is successfull

Screenshot from 2025-12-13 11-25-05

Test Case 3 - Skip Offering Removal During Domain Deletion

Expected Result: Domain deleted successfully, but should NOT be deleted because VMs were using it

Actual Result: Domain deleted. Offering test-offering-pr11780 still exists in Compute Offerings.

Status: PASSED

Screenshot from 2025-12-13 11-33-08 Screenshot from 2025-12-13 11-33-59 Screenshot from 2025-12-13 11-34-18

Test Case 4 - Disk Offering protection during domain deletion

Preconditions

  1. Disk offering test-disk-offering-2 created (public)
  2. Volume test-volume-2 created using this offering (in ROOT)
  3. Offering restricted to test-domain-3

Steps: Delete test-domain-3 with cleanup

Expected Result Disk offering should NOT be deleted because a volume is using it

Actual Result Disk offering test-disk-offering-2 still exists after domain deletion

Status: PASSED

Screenshot from 2025-12-13 12-22-11 Screenshot from 2025-12-13 12-21-59 Screenshot from 2025-12-13 12-21-57 Screenshot from 2025-12-13 12-21-27 Screenshot from 2025-12-13 12-21-05

Test Case 5 - Network Offering protection during domain deletion

Preconditions

  1. Network offering test-network-offering-pr11780 created (public)
  2. Network test-network-pr11780 created using this offering (in ROOT)
  3. Offering restricted to test-domain-4

Steps: Delete test-domain-4 with cleanup

Expected Result Network offering should NOT be deleted because a network is using it

Actual Result Network offering test-network-offering-pr11780 still exists after domain deletion

Status PASSED

Screenshot from 2025-12-13 12-34-36 Screenshot from 2025-12-13 12-34-15 Screenshot from 2025-12-13 12-34-12 Screenshot from 2025-12-13 12-33-55

Test Case 6 - VPC Offering protection during domain deletion

Preconditions:

  1. VPC offering test-vpc-offering-pr11780 created (public)
  2. VPC test-vpc-pr11780 created using this offering (in ROOT)
  3. Offering restricted to test-domain-5

Steps: Delete test-domain-5 with cleanup

Expected Result: VPC offering should NOT be deleted because a VPC is using it

Actual Result VPC offeringtest-vpc-offering-pr11780still exists after domain deletion

Status: PASSED

Screenshot from 2025-12-13 13-12-31 Screenshot from 2025-12-13 13-12-19

Test Case 7 - Clean deletion (offering deleted when not in use)

**Preconditions: **

  1. Compute offering test-delete-offering created (public)
  2. NO VMs created using this offering
  3. Offering restricted to test-domain-6

Steps:

  1. Delete test-domain-6 with cleanup
  2. Check if offering still exists

Expected Result: Offering SHOULD be deleted because no resources are using it

Actual Result: Offering test-delete-offering was deleted (no longer in list)

Status: PASSED

Screenshot from 2025-12-13 13-20-57 Screenshot from 2025-12-13 13-21-31 Screenshot from 2025-12-13 13-21-24 image

@DaanHoogland
Copy link
Contributor

@shwstppr can you have another look?

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

code lgtm

@shwstppr shwstppr removed their assignment Jan 6, 2026
@shwstppr shwstppr closed this Jan 6, 2026
@shwstppr shwstppr reopened this Jan 6, 2026
@shwstppr
Copy link
Contributor

shwstppr commented Jan 6, 2026

@blueorangutan package

@blueorangutan
Copy link

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

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

@DaanHoogland DaanHoogland added this to the 4.20.3 milestone Jan 6, 2026
@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@shwstppr shwstppr merged commit 57331ac into apache:4.20 Jan 7, 2026
46 of 49 checks passed
@shwstppr shwstppr deleted the avoidOfferingRemoval branch January 7, 2026 03:55
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.

Removing compute offering with related domain.

5 participants