Skip to content

Fix skip DRS for a VM#12994

Open
vishesh92 wants to merge 3 commits intoapache:4.20from
shapeblue:fix-skip-drs
Open

Fix skip DRS for a VM#12994
vishesh92 wants to merge 3 commits intoapache:4.20from
shapeblue:fix-skip-drs

Conversation

@vishesh92
Copy link
Copy Markdown
Member

@vishesh92 vishesh92 commented Apr 10, 2026

Description

When a VM has skipFromDRS detail set, it is still not getting skipped. This PR fixes it.

Details

This pull request refactors how the system determines whether a VM should be skipped for DRS (Distributed Resource Scheduler) operations. The main improvement is centralizing and simplifying the skip logic, now using the `UserVmDetailsDao` to check VM details in the database rather than relying solely on in-memory details. This ensures more accurate and consistent behavior.

Key changes:

Refactoring skip logic for DRS:

  • Introduced a new shouldSkipVMForDRS method to encapsulate all logic for determining if a VM should be skipped, making the code cleaner and easier to maintain.
  • Updated the main DRS processing loop to use the new shouldSkipVMForDRS method, ensuring consistent skip checks throughout the codebase.

Improved VM detail retrieval:

  • Now retrieves the SKIP_DRS flag using UserVmDetailsDao from the database, instead of only checking the VM's in-memory details map. This makes the skip logic more robust and reliable.

Dependency injection:

  • Added dependency injection for UserVmDetailsDao to enable database access for VM details.
  • Imported UserVmDetailVO and UserVmDetailsDao for use in the new logic.

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?

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

@vishesh92 vishesh92 requested a review from Copilot April 10, 2026 06:46
…erviceImpl.java

Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
@apache apache deleted a comment from blueorangutan Apr 10, 2026
@vishesh92 vishesh92 requested review from Copilot and removed request for Copilot April 10, 2026 06:52
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Fixes DRS skip behavior when the SKIP_DRS VM detail is set but not present in the in-memory VM details map by centralizing skip logic and consulting the DB-backed VM details DAO.

Changes:

  • Added DB-backed lookup of VmDetailConstants.SKIP_DRS via UserVmDetailsDao.
  • Centralized DRS skip logic into shouldSkipVMForDRS and reused it in both the main loop and skipDrs.

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 38.09524% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.26%. Comparing base (6f1aa96) to head (0a6803f).

Files with missing lines Patch % Lines
...udstack/resourcedetail/ResourceDetailsDaoBase.java 0.00% 12 Missing ⚠️
...ache/cloudstack/cluster/ClusterDrsServiceImpl.java 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #12994      +/-   ##
============================================
- Coverage     16.26%   16.26%   -0.01%     
+ Complexity    13434    13430       -4     
============================================
  Files          5665     5665              
  Lines        500530   500537       +7     
  Branches      60787    60780       -7     
============================================
+ Hits          81411    81412       +1     
- Misses       410028   410034       +6     
  Partials       9091     9091              
Flag Coverage Δ
uitests 4.15% <ø> (ø)
unittests 17.11% <38.09%> (-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.

Copy link
Copy Markdown
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 4 out of 4 changed files in this pull request and generated 1 comment.


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

@vishesh92
Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@vishesh92 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 17444

@blueorangutan
Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-15852)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants