FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix skip DRS for a VM by vishesh92 · Pull Request #12994 · apache/cloudstack · GitHub

Repository navigation

Fix skip DRS for a VM - #12994

Merged
weizhouapache merged 4 commits into
apache:4.20from
shapeblue:fix-skip-drs
Jul 9, 2026
Merged

weizhouapache merged 4 commits into
apache:4.20from
shapeblue:fix-skip-drs

Conversation

vishesh92 commented Apr 10, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

Description

When a VM has skipFromDRS detail set, it is still not getting skipped. This PR fixes it.
Doc PR - apache/cloudstack-documentation#653

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 requested a review from Copilot April 10, 2026 06:46
apache deleted a comment from blueorangutan Apr 10, 2026
vishesh92 requested review from Copilot and removed request for Copilot April 10, 2026 06:52

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 Bot commented Apr 10, 2026 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.63158% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.26%. Comparing base (c267ad3) to head (dd4e94a).
⚠️ Report is 13 commits behind head on 4.20.

Files with missing lines Patch % Lines
...udstack/resourcedetail/ResourceDetailsDaoBase.java 11.11% 8 Missing ⚠️
...ache/cloudstack/cluster/ClusterDrsServiceImpl.java 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #12994      +/-   ##
============================================
- Coverage     16.26%   16.26%   -0.01%     
+ Complexity    13433    13432       -1     
============================================
  Files          5665     5667       +2     
  Lines        500572   500681     +109     
  Branches      60792    60792              
============================================
- Hits          81417    81415       -2     
- Misses       410047   410160     +113     
+ Partials       9108     9106       -2     
Flag Coverage Δ
uitests 4.14% <ø> (-0.01%) ⬇️
unittests 17.11% <52.63%> (-0.01%) ⬇️

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

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

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member Author

@blueorangutan package

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.

Copy link
Copy Markdown

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

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-15852)

Copy link
Copy Markdown
Contributor

@blueorangutan test

Copy link
Copy Markdown

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

Copy link
Copy Markdown

[SF] Trillian test result (tid-15855)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 53699 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12994-t15855-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

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@vishesh92

As discussed, if we could add a log message saying we are skipping a vm from drs plan when "generateClusterDrsPlan" api is called it will be beneficial to the admin user when troubleshooting.

Also, please update the doc about the "skipFromDRS" in vmsettings

https://docs.cloudstack.apache.org/en/4.22.0.0/adminguide/clusters.html#cloudstack-drs

weizhouapache added this to the 4.20.4 milestone May 7, 2026
vishesh92 and others added 3 commits May 20, 2026 16:01

Copy link
Copy Markdown
Member Author

@vishesh92

As discussed, if we could add a log message saying we are skipping a vm from drs plan when "generateClusterDrsPlan" api is called it will be beneficial to the admin user when troubleshooting.

Also, please update the doc about the "skipFromDRS" in vmsettings

https://docs.cloudstack.apache.org/en/4.22.0.0/adminguide/clusters.html#cloudstack-drs

Created a doc PR here: apache/cloudstack-documentation#653

Copy link
Copy Markdown
Member Author

@blueorangutan package

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.

Copy link
Copy Markdown

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

apache deleted a comment from blueorangutan May 21, 2026
apache deleted a comment from blueorangutan May 21, 2026

Copy link
Copy Markdown
Member Author

@blueorangutan test

apache deleted a comment from blueorangutan May 22, 2026
apache deleted a comment from blueorangutan May 22, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

Test Result Time (s) Test File
test_01_deployVMInSharedNetwork Failure 310.65 test_network.py

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member Author

@blueorangutan package

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.

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

code lgtm

not tested

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member Author

@blueorangutan test

Copy link
Copy Markdown

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

Copy link
Copy Markdown

[SF] Trillian test result (tid-16495)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 49648 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12994-t16495-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

weizhouapache merged commit a4b102f into apache:4.20 Jul 9, 2026
24 of 26 checks passed
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 11, 2026
bhouse-nexthop added a commit to bhouse-nexthop/cloudstack that referenced this pull request Sep 11, 2026
The DRS work in this branch builds on shouldSkipVMForDRS() and the bulk
skip-detail lookup that apache#12994 introduced, and 4.22.1.1 predates it.

Taken as the adapted form that reached the 4.22 branch rather than the
original commit: apache#12994 was written against UserVmDetailsDao and picked
up the VMInstanceDetailsDao rename on the way up through the forward
merge, so cherry-picking it directly imports a class that does not exist
on any 4.22 ref.

Cherry picked from a4b102f as merged into 4.22.

Signed-off-by: Brad House <bhouse@nexthop.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

6 participants


Back | FazBrowse Home | New Git URL