You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "Pearl1594 (via GitHub)" <gi...@apache.org> on 2026/10/15 19:47:04 UTC
[PR] kvm: fix HA checker deciding host state from the last pool only [cloudstack]
Pearl1594 opened a new pull request, #14410:
URL: https://github.com/apache/cloudstack/pull/14410
### Description
`KVMHAChecker` decides whether a host's storage heartbeat is alive across all of its HA-enabled primary storage pools. With `kvm.ha.fence.on.storage.heartbeat.failure=false` (the default), the loop overwrote its result on every iteration, so only the **last pool in the list** decided the outcome:
- last pool dead, others healthy: host reported dead, which can lead to unnecessary fencing and HA restarts
- an earlier pool dead, last pool healthy: the failure was ignored
With a single pool, or with the setting `true`, behaviour is unchanged. The change only affects hosts with multiple HA pools and the setting at `false`. Now, with setting as false, KVMHAChecker reports the host as dead only when every pool has no heartbeat.
<!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
<!--- ******************************************************************************* -->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!--- ******************************************************************************* -->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [X] 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
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [X] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
#### How did you try to break this feature and the system with this change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] kvm: fix HA checker deciding host state from the last pool only [cloudstack]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #14410:
URL: https://github.com/apache/cloudstack/pull/14410#issuecomment-6201983980
## [](https://sonarcloud.io/dashboard?id=apache_cloudstack&pullRequest=14410) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=14410&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=14410&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=14410&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [85.7% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=14410&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=14410&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_cloudstack&pullRequest=14410)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] kvm: fix HA checker deciding host state from the last pool only [cloudstack]
Posted by "Pearl1594 (via GitHub)" <gi...@apache.org>.
Pearl1594 commented on code in PR #14410:
URL: https://github.com/apache/cloudstack/pull/14410#discussion_r4295525190
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAChecker.java:
##########
@@ -60,6 +53,22 @@ public Boolean checkingHeartBeat() {
return validResult;
}
+ /*
+ * With reportFailureIfOneStorageIsDown the host is dead as soon as one pool has no heart beat,
+ * otherwise it is dead only when none of the pools has one.
+ */
+ private boolean checkPoolsHeartBeat() {
+ boolean anyPoolHasHeartBeat = false;
+ for (HAStoragePool pool : storagePools) {
+ boolean poolHasHeartBeat = pool.getPool().checkingHeartBeat(pool, host);
+ if (reportFailureIfOneStorageIsDown && !poolHasHeartBeat) {
+ return false;
+ }
+ anyPoolHasHeartBeat = anyPoolHasHeartBeat || poolHasHeartBeat;
+ }
+ return anyPoolHasHeartBeat;
Review Comment:
Yes - with an empty pool list host would be marked Down. This is existing behaviour and unchanged by this PR, which only fixes the result being taken from the last pool.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] kvm: fix HA checker deciding host state from the last pool only [cloudstack]
Posted by "Damans227 (via GitHub)" <gi...@apache.org>.
Damans227 commented on code in PR #14410:
URL: https://github.com/apache/cloudstack/pull/14410#discussion_r4295456128
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAChecker.java:
##########
@@ -60,6 +53,22 @@ public Boolean checkingHeartBeat() {
return validResult;
}
+ /*
+ * With reportFailureIfOneStorageIsDown the host is dead as soon as one pool has no heart beat,
+ * otherwise it is dead only when none of the pools has one.
+ */
+ private boolean checkPoolsHeartBeat() {
+ boolean anyPoolHasHeartBeat = false;
+ for (HAStoragePool pool : storagePools) {
+ boolean poolHasHeartBeat = pool.getPool().checkingHeartBeat(pool, host);
+ if (reportFailureIfOneStorageIsDown && !poolHasHeartBeat) {
+ return false;
+ }
+ anyPoolHasHeartBeat = anyPoolHasHeartBeat || poolHasHeartBeat;
+ }
+ return anyPoolHasHeartBeat;
Review Comment:
should an empty pool list count as a dead host? the comment above says we return true when we cant tell, and the fence path already bails out when there are no pools
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] kvm: fix HA checker deciding host state from the last pool only [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14410:
URL: https://github.com/apache/cloudstack/pull/14410#issuecomment-6200979046
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14410?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 4.16%. Comparing base ([`376c1b4`](https://app.codecov.io/gh/apache/cloudstack/commit/376c1b40174ab4b8d7f9aced5401143cbc09d587?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`529a778`](https://app.codecov.io/gh/apache/cloudstack/commit/529a778a5af1e9f811e114f65ae83530b68ffda0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (376c1b4) and HEAD (529a778). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (376c1b4) | HEAD (529a778) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 4.20 #14410 +/- ##
=============================================
- Coverage 16.41% 4.16% -12.25%
=============================================
Files 5669 405 -5264
Lines 501628 33078 -468550
Branches 60942 5903 -55039
=============================================
- Hits 82336 1378 -80958
+ Misses 410064 31524 -378540
+ Partials 9228 176 -9052
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14410/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14410/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.16% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14410/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14410?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] kvm: fix HA checker deciding host state from the last pool only [cloudstack]
Posted by "Damans227 (via GitHub)" <gi...@apache.org>.
Damans227 commented on code in PR #14410:
URL: https://github.com/apache/cloudstack/pull/14410#discussion_r4295755903
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAChecker.java:
##########
@@ -60,6 +53,22 @@ public Boolean checkingHeartBeat() {
return validResult;
}
+ /*
+ * With reportFailureIfOneStorageIsDown the host is dead as soon as one pool has no heart beat,
+ * otherwise it is dead only when none of the pools has one.
+ */
+ private boolean checkPoolsHeartBeat() {
+ boolean anyPoolHasHeartBeat = false;
+ for (HAStoragePool pool : storagePools) {
+ boolean poolHasHeartBeat = pool.getPool().checkingHeartBeat(pool, host);
+ if (reportFailureIfOneStorageIsDown && !poolHasHeartBeat) {
+ return false;
+ }
+ anyPoolHasHeartBeat = anyPoolHasHeartBeat || poolHasHeartBeat;
+ }
+ return anyPoolHasHeartBeat;
Review Comment:
that covers it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org