-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Deployment plan fixes for VM with last host, and last host in maintenance #12062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Deployment plan fixes for VM with last host, and last host in maintenance #12062
Conversation
- Consider last host when it is not in maintenance - Fail deployment when user requests for last host consideration and last host doesn't exists or in maintenance
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.20 #12062 +/- ##
=========================================
Coverage 16.18% 16.18%
- Complexity 13300 13301 +1
=========================================
Files 5657 5657
Lines 498467 498480 +13
Branches 60493 60496 +3
=========================================
+ Hits 80655 80663 +8
- Misses 408829 408836 +7
+ Partials 8983 8981 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes deployment planning logic for VMs with last host by ensuring the last host is considered only when it exists and is not in maintenance mode. When users explicitly request last host consideration and the host doesn't exist or is in maintenance, deployment now fails with a clear error message.
Key Changes:
- Added validation to check if last host exists and is not in maintenance before attempting deployment
- When
ConsiderLastHostis explicitly set to "true", deployment now fails with an exception if the last host is unavailable - Fixed minor logging inconsistencies and typos across multiple files
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java | Core logic changes to validate last host existence and maintenance state, with error handling when explicitly requested; also fixed a typo in a log message |
| server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java | Minor log message formatting improvements for migration attempts (removed extra space) |
| server/src/main/java/com/cloud/resource/ResourceManagerImpl.java | Updated log message format for consistency during maintenance operations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
Outdated
Show resolved
Hide resolved
|
@blueorangutan package |
|
@sureshanaparti 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. |
5ec03de to
6aa828b
Compare
|
@blueorangutan package |
|
@sureshanaparti 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15747 |
|
@blueorangutan test |
|
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java
Outdated
Show resolved
Hide resolved
|
@blueorangutan package |
|
@sureshanaparti 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15770 |
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm, only possible snatch may be afinity, but on the other hand, it is only a “when all else fails” scenario. We should be good like this.
| String considerLastHostStr = (String)vmProfile.getParameter(VirtualMachineProfile.Param.ConsiderLastHost); | ||
| String haVmTag = (String)vmProfile.getParameter(VirtualMachineProfile.Param.HaTag); | ||
| boolean considerLastHost = vm.getLastHostId() != null && haVmTag == null && | ||
| (considerLastHostStr == null || Boolean.TRUE.toString().equalsIgnoreCase(considerLastHostStr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sureshanaparti I'm not clear why the first part of this OR operator would make it consider the last host. I would assume if the ConsiderLastHost parameter is not set that this evaluates to false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nvazquez , true is the documented default, so we should treat null as true. (if it is not passed in the parameters, I actually do not know if that would be handled upstream already)
| } | ||
|
|
||
| logger.debug("VM's last host is {}, trying to choose the same host if it is not in maintenance state", lastHost); | ||
| if (lastHost.isInMaintenanceStates()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably checking other states as well? Or migrating only to enabled and running hosts?
|
[SF] Trillian test result (tid-14829)
|
Description
This PR includes the following deployment plan fixes for VM with last host, and last host in maintenance.
Fixes #12045
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Tested with 4 x KVM hosts on a single cluster. Able to put a host in maintenance when 2 hosts are already in maintenance. VMs choose the available host for migration, and VMs are not stopped.
All Hosts are Up =>
Host 2 in Maintenance =>
Host 4 in Maintenance =>
Host 1 in Maintenance =>
How did you try to break this feature and the system with this change?