KVM: add storage-heartbeat fencing fallback when OOBM fence fails (host stuck in Fencing on total power loss)#13589
Open
nikolauseppinger wants to merge 1 commit into
Conversation
When a KVM host suffers a complete power failure, its BMC (IPMI/iDRAC/iLO) usually goes down with it. The Host HA framework's fence operation relies solely on out-of-band management, so fencing can never succeed in this scenario: the host remains stuck in the Fencing state indefinitely and scheduleRestartForVmsOnHost() is never invoked, leaving all HA-enabled VMs down until an operator intervenes - defeating the purpose of HA for the most common total-failure scenario. At that point CloudStack has already proven the host dead: health checks failed, activity checks found no VM disk activity, and the neighbouring hosts positively report the host's storage heartbeat as expired - the same evidence the legacy KVMFencer has always accepted as sufficient proof of fencing. This change adds an opt-in fallback (cluster setting kvm.ha.fence.on.storage.heartbeat, default false): when the OOBM fence operation fails, the host is considered fenced only if the neighbouring hosts positively report its storage heartbeat as expired (Status.Down from KVMHostActivityChecker). The host is never considered fenced when any check still sees it alive, when no neighbour can confirm, or when the heartbeat check itself fails - absence of evidence never counts as evidence of death. With the setting disabled (default) the behaviour is unchanged.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a KVM host suffers a complete power failure, its BMC (IPMI/iDRAC/iLO)
usually loses power together with the host. The Host HA framework's fence
operation (
KVMHAProvider.fence()) relies solely on out-of-band management(
PowerOperation.OFF), so fencing can never succeed in this scenario:FencingexceptFencedorDisabled, so thehost retries fencing forever (
RetryFencing).FenceTask.processResult()only callsoldHighAvailabilityManager.scheduleRestartForVmsOnHost()on a successfulfence, so HA-enabled VMs are never restarted.
HAManagerImpl.isVMAliveOnHost()returns true for every state exceptFenced, which also blocks the legacy VM HA investigation path.The result: on a total power failure — arguably the most common
total-failure scenario HA exists for — all HA-enabled VMs stay down
indefinitely until an operator intervenes (e.g. via
declareHostAsDegraded).Related reports: #12921, #12185.
At the point
fence()is invoked, CloudStack has already gathered strongevidence that the host is dead:
pool (
CheckVMActivityOnStoragePoolCommand),expired — the same evidence the legacy
KVMFencerhas always accepted assufficient proof of fencing.
Change
This PR adds an opt-in fallback, disabled by default:
kvm.ha.fence.on.storage.heartbeat(default
false).or an exception such as an unreachable BMC), the host is considered fenced
only if the neighbouring hosts positively report its storage heartbeat
as expired (
Status.DownfromKVMHostActivityChecker.getHostAgentStatus(),which requires neighbour confirmation via
CheckOnHostCommand).when no neighbour can confirm (
Disconnected/Unknown), or when theheartbeat check itself fails — absence of evidence never counts as evidence
of death.
The heartbeat semantics follow the existing checks, including
kvm.ha.fence.host.if.heartbeat.fails.on.storage.Safety considerations
Fencing exists to guarantee the host can no longer write to shared storage
before VMs are restarted elsewhere. The fallback only fires after three
independent confirmations (failed health checks, no VM disk activity over the
whole activity-check window, expired storage heartbeat confirmed by
neighbours), which is strictly more evidence than the legacy
KVMFencerrequires for the same decision. A transient BMC outage on a live host does
not trigger it: a live host keeps writing its heartbeat, so neighbours will
not report
Down.Types of changes
Bug Severity
How Has This Been Tested?
KVMHostHATestcovering all fence paths (OOBM success,OOBM failure with the setting disabled/enabled, heartbeat dead/alive, OOBM
exception with and without fallback); 10/10 tests pass.
mvn -pl plugins/hypervisors/kvm -am testbuilds green including checkstyle.storage, iDRAC OOBM): host power loss took down the iDRAC, host remained in
Fencing with all HA VMs down; neighbour heartbeat checks had reported the
host dead 62 seconds after the failure.