Skip to content

<feature>[sdk]: Add getVmHaNetworkGroupRiskOnHost method#3462

Open
ZStack-Robot wants to merge 1 commit intofeature-5.5.6-dpu-net-ha2from
sync/haoyu.ding/fix-83065@@2
Open

<feature>[sdk]: Add getVmHaNetworkGroupRiskOnHost method#3462
ZStack-Robot wants to merge 1 commit intofeature-5.5.6-dpu-net-ha2from
sync/haoyu.ding/fix-83065@@2

Conversation

@ZStack-Robot
Copy link
Collaborator

Resolves: ZSTAC-83065

Change-Id: I6d6f71667972646b71746c6c656e676c70657467

sync from gitlab !9321

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: ce9095de-710b-46bc-b4ef-19cbdcd06422

📥 Commits

Reviewing files that changed from the base of the PR and between 160f69a and ebc3778.

⛔ Files ignored due to path filters (4)
  • sdk/src/main/java/SourceClassMap.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/GetVmHaNetworkGroupStatusOnHostAction.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/GetVmHaNetworkGroupStatusOnHostResult.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/NetworkGroupStatusDetail.java is excluded by !sdk/**
📒 Files selected for processing (2)
  • testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy
  • utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

Walkthrough

新增了一个同步调用方法 getVmHaNetworkGroupStatusOnHost 到 API 帮助类,用于获取主机上 VM HA 网络组的状态,并在错误代码类中追加了四个 HA 相关的静态常量:ORG_ZSTACK_HA_10035 到 ORG_ZSTACK_HA_10038。

Changes

Cohort / File(s) Summary
API 助手方法扩展
testlib/src/main/java/org/zstack/testlib/ApiHelper.groovy
新增 getVmHaNetworkGroupStatusOnHost 方法,按既有模式创建并执行 SDK Action,设置 sessionId、处理策略、支持 apipath 跟踪与错误输出返回。
错误代码常量补充
utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java
新增四个 HA 相关错误代码常量:ORG_ZSTACK_HA_10035ORG_ZSTACK_HA_10036ORG_ZSTACK_HA_10037ORG_ZSTACK_HA_10038

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 分钟

Poem

🐰 我在代码地里轻轻跳,
新增方法像嫩芽报到,
状态追踪稳且巧,
错误码伴随一路到,
小兔挥爪,功能上线笑! 🎋


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Title check ❌ Error 标题声明添加了 getVmHaNetworkGroupRiskOnHost 方法,但实际变更添加的是 getVmHaNetworkGroupStatusOnHost 方法,存在不匹配。 将标题更正为 '[sdk]: Add getVmHaNetworkGroupStatusOnHost method' 以准确反映实际代码变更。
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed PR 描述提到了相关的 JIRA 工单和 GitLab 同步信息,与代码变更相关联。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sync/haoyu.ding/fix-83065@@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.41.0)
utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

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

@zstack-robot-2
Copy link
Collaborator

Comment from yaohua.wu:

Review: MR !9321 (zstack) — ZSTAC-83065

本 MR 为 premium MR !13135 的 SDK/测试配套变更,包含:

  • GetVmHaNetworkGroupRiskOnHostAction(SDK action)
  • GetVmHaNetworkGroupRiskOnHostResult(SDK result)
  • NetworkGroupStatusDetail(SDK detail 类)
  • SourceClassMap 类映射注册
  • ApiHelper.groovy 测试辅助方法
  • CloudOperationsErrorCode 新增 3 个错误码(10035-10037)

所有文件均为标准生成/注册代码,与 premium 侧 API 定义一致,无问题。

详细 review 见 premium MR:http://dev.zstack.io:9080/zstackio/premium/-/merge_requests/13135#note_679009

Verdict: APPROVED


🤖 Robot Reviewer

import java.util.Map;
import org.zstack.sdk.*;

public class GetVmHaNetworkGroupRiskOnHostAction extends AbstractAction {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment from yaohua.wu:

直接叫Status?Risk本身就有风险的意思,但是本质上这个API的返回不是只返回风险,available本身不属于风险范畴

Resolves: ZSTAC-83065

Change-Id: I6d6f71667972646b71746c6c656e676c70657467
@MatheMatrix MatheMatrix force-pushed the sync/haoyu.ding/fix-83065@@2 branch from 160f69a to ebc3778 Compare March 11, 2026 09: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.

3 participants