Skip to content

ZSTAC-86249: publish HA start state change#4583

Open
MatheMatrix wants to merge 1 commit into
5.4.12from
sync/hanyu.liang/fix-86249@@2
Open

ZSTAC-86249: publish HA start state change#4583
MatheMatrix wants to merge 1 commit into
5.4.12from
sync/hanyu.liang/fix-86249@@2

Conversation

@MatheMatrix

Copy link
Copy Markdown
Owner

Backport of ZSTAC-84266 to 5.4.12.

Source: zstack!9795 (5.4.8).

Publishes the VM HA start state change event used by the HA flow.

Validation: static diff and commit checks only; no case was run per backport requirement.

sync from gitlab !10552

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Could not fetch remote config from http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml: TimeoutError: The operation was aborted due to timeout
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e0eb03b6-56e1-45a8-a6a8-033db83a2e22

📥 Commits

Reviewing files that changed from the base of the PR and between 53153f1 and 2e57a4c.

📒 Files selected for processing (2)
  • compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java
  • header/src/main/java/org/zstack/header/vm/VmCanonicalEvents.java

Walkthrough

本次变更为 VM 状态变更事件增加来源字段,统一状态落库逻辑,并使 HA 启动流程记录 HaStartVmInstanceMsg 作为状态变更来源。

Changes

VM 状态变更来源追踪

Layer / File(s) Summary
状态变更事件契约
header/src/main/java/org/zstack/header/vm/VmCanonicalEvents.java
VmStateChangedData 新增 stateChangeSource 字段及对应 getter/setter。
状态落库与 HA 来源传递
compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java
状态落库方法新增来源参数,旧方法委托至新重载;HA 启动流程通过统一方法将 VM 置为 Stopped 并记录来源类名。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HaStartVmInstanceMsg
  participant VmInstanceBase
  participant VmStateChangedData
  HaStartVmInstanceMsg->>VmInstanceBase: 调用 changeVmStateInDb 并传入来源类名
  VmInstanceBase->>VmStateChangedData: 写入 stateChangeSource
  VmInstanceBase-->>HaStartVmInstanceMsg: 完成 VM 状态落库
Loading

Suggested reviewers: huhu0316

Poem

兔子蹦蹦带来源,
状态落库路更通。
HA 启动写下名,
事件携带小纸笼。
咯吱一声,记录成!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了本次 HA 启动状态变更发布的核心改动。
Description check ✅ Passed 描述与补丁内容一致,说明了回移植背景、功能点和验证方式。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/hanyu.liang/fix-86249@@2

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.44.1)
compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java

ast-grep timed out on this file


Comment @coderabbitai help to get the list of available commands.

Resolves: ZSTAC-86249

Change-Id: I45e2ad39f66aab961c42e3020813e3b7622cd540
@MatheMatrix
MatheMatrix force-pushed the sync/hanyu.liang/fix-86249@@2 branch from 940de3e to 2e57a4c Compare July 17, 2026 01:19
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.

2 participants