KVM Host HA: Support user-defined fencing scripts when OOB management is unavailable
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Start by reading KVMHAProvider.fence() in KVMHAProvider.java, where the issue says OOB fencing currently runs, and review the related Host HA and VM HA interaction in issues #11627 and #13376. The proposed script interface, execution policy, and state machine integration are open design questions. Done means defining and implementing safe fencing behavior that only permits recovery after explicit confirmation; the payload does not identify specific tests.
索引モデルが issue の本文から書いたものです。
説明
The required feature described as a wish
Currently, Apache CloudStack KVM Host HA relies on Out-of-Band Management (IPMI/Redfish) to fence failed hosts.
If the OOB management interface is unavailable, the fencing operation fails, potentially leaving the host in the Fencing state and preventing VM HA from restarting affected instances on healthy hosts.
For example, if a physical KVM host experiences a power outage and its BMC becomes unreachable, CloudStack may be unable to confirm that the host is powered off, even though the host has physically stopped operating.
I propose introducing support for user-defined fencing scripts, allowing administrators to implement infrastructure-specific fencing verification without requiring CloudStack to support every possible hardware, storage, or network configuration.
Current Behavior
During a simulated failure, CloudStack attempts to fence an unavailable KVM host using OOB management.
The fencing operation fails with the following exception:
WARN [o.a.c.h.t.FenceTask]
Exception occurred while running FenceTask on a resource:
org.apache.cloudstack.ha.provider.HAFenceException:
OBM service is not configured or enabled for this host
acsh2.hu.abc.com
at org.apache.cloudstack.kvm.ha.KVMHAProvider.fence(KVMHAProvider.java:99)
The current KVM HA provider executes:
outOfBandManagementService.executePowerOperation(
host, PowerOperation.OFF, null
);
If the operation fails, the host may remain in the Fencing state, with subsequent fencing attempts failing for the same reason.
As a result, VM HA recovery may be blocked even when the physical host is already powered off.
Proposed Enhancement
Introduce a configurable custom fencing script mechanism for KVM Host HA.
Administrators should be able to specify an external executable that CloudStack invokes when fencing a host.
The script would receive information identifying the affected host and return a result indicating whether fencing has been successfully verified.
This would allow users to implement fencing verification based on their own infrastructure, without requiring CloudStack to integrate every possible fencing technology.
- Configurable fencing script:
For example, a CloudStack configuration option could specify:
kvm.ha.custom.fencing.script=/opt/cloudstack/ha/fence-host.sh
The script could be invoked with arguments identifying the affected host:
/opt/cloudstack/ha/fence-host.sh \
--host-id 2 \
--host-uuid e1f21bff-9033-4823-aec2-329a14a06453 \
--host-name acsh2.hu.abc.com
The exact interface and configuration mechanism would be subject to implementation.
2. Script return values
A simple exit-code-based interface could be used:
| Exit code | Meaning | CloudStack behavior |
|---|---|---|
| 0 | Host successfully fenced or confirmed unable to access shared storage | Transition to Fenced |
| 1 | Host is still active or fencing failed | Do not transition to Fenced |
| 2 | Host state cannot be determined | Keep recovery blocked and retry according to policy |
| Other | Script execution error | Log error and treat fencing as unsuccessful |
The important requirement is that only an explicit successful result should allow CloudStack to transition the host to Fenced.
A script timeout, execution failure, or inconclusive result must never be interpreted as successful fencing.
3. Configurable execution policy
Administrators should be able to select how custom fencing integrates with the existing OOB mechanism.
For example:
Fencing strategy:
OOB_ONLY
CUSTOM_ONLY
OOB_THEN_CUSTOM
This would allow the existing OOB-based behavior to remain the default, preserving backward compatibility.
4. Infrastructure-independent implementation
The custom script could use any verification or fencing mechanism appropriate for the environment, including:
- Querying an external power management system or intelligent PDU.
- Checking hardware power status through an independent management interface.
- Verifying successful storage-level fencing.
- Querying an external cluster manager or fencing service.
- Checking an infrastructure-specific quorum or watchdog mechanism.
- Integrating with third-party automation or monitoring systems that provide authoritative fencing status.
The responsibility for implementing reliable fencing verification would remain with the administrator.
CloudStack would only need to provide a standardized script execution interface and interpret the result.
5. Security and execution requirements
The implementation should provide:
- Configurable execution timeout.
- Controlled script execution permissions.
- Proper argument escaping and input validation.
- Detailed logging of execution results.
- Safe handling of script failures.
- A clearly documented exit-code contract.
- Protection against concurrent fencing operations on the same host.
Since a successful fencing result may trigger VM recovery on another host, the script must provide reliable evidence that the original host cannot continue running the affected workloads.
Expected Behavior
When a KVM host becomes unavailable:
- CloudStack detects the host failure.
- Host HA initiates fencing.
- Depending on the configured strategy, CloudStack attempts OOB fencing and/or executes the custom fencing script.
- The script performs infrastructure-specific fencing or verifies that the host is already safely fenced.
- If the script returns success, CloudStack transitions the host to Fenced.
- VM HA can proceed with restarting affected instances on healthy hosts.
- If fencing cannot be verified, CloudStack does not automatically restart the affected VMs.
Example Use Case: Single Host Power Failure
Consider a conventional CloudStack cluster with three KVM hosts using shared primary storage.
One host experiences a complete power failure, and its BMC is also unreachable.
Although the host is physically powered off, CloudStack cannot complete OOB fencing.
With custom fencing scripts, an administrator could implement an alternative method to verify that the host is powered off or otherwise safely isolated.
Once the script confirms successful fencing, CloudStack can proceed with VM HA recovery.
Example Use Case: Multi-Site Disaster Recovery
In a geographically distributed deployment, an entire site may become unreachable, including its OOB management infrastructure.
An infrastructure-specific fencing script could verify that the affected site's hosts have been isolated through an independent mechanism.
This would allow CloudStack to continue automatic VM recovery without depending exclusively on BMC connectivity.
Benefits
- Eliminates the exclusive dependency on OOB management for KVM Host HA fencing.
- Supports both single-host failures and complete site outages.
- Allows infrastructure-specific fencing implementations.
- Avoids adding hardware-specific or storage-specific logic to the CloudStack core.
- Enables integration with existing fencing solutions.
- Maintains split-brain protection by requiring explicit fencing confirmation.
- Preserves backward compatibility with the existing OOB fencing mechanism.
Related Issues
Questions
- Would a configurable custom fencing script be acceptable as an extension to the existing KVM HA provider?
- Could the existing KVMHAProvider.fence() implementation be extended to execute an administrator-defined script?
- Would it be preferable to implement this as a separate HA provider rather than extending the existing KVM HA provider?
- Could this functionality be implemented without modifying the existing Host HA state machine?
- 主要言語
- Java
- スター
- 3.1k
- フォーク
- 1.4k
- 平均マージ
- 7日 16時間
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cloudstack のほかの issue
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new size対応中かも @bhouse-nexthop が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/cloudstack#14645 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replaced対応中かも @bhouse-nexthop が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/cloudstack#14633 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)対応中かも @bhouse-nexthop が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/cloudstack#14631 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/cloudstack#14625 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)対応中かも @willbennett-devops が 12 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/cloudstack#14545 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
apache/cloudstack の issue をすべて見る
似ている issue
-
[Bug]: Nullable implicit operator on string extensible enums still throws for a null string対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug emitter:client:csharp
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/typespec#12572 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settingsオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration対応中かも @amalsaidov が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信