Skip to content

<feature>[dpu-bm2]: support attaching novlan and vxlan network to baremetal2 instance#3670

Open
ZStack-Robot wants to merge 1 commit into5.5.12from
sync/shan.wu/feature-dpu-baremetal@@2
Open

<feature>[dpu-bm2]: support attaching novlan and vxlan network to baremetal2 instance#3670
ZStack-Robot wants to merge 1 commit into5.5.12from
sync/shan.wu/feature-dpu-baremetal@@2

Conversation

@ZStack-Robot
Copy link
Copy Markdown
Collaborator

support attaching novlan and vxlan network to baremetal2 instance

Resolves/Related: ZSTAC-82781

Change-Id: I736d637a7168656a6c726c6769777a726e616974

sync from gitlab !9530

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 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: 68a82027-7d68-4141-89d3-a94f723566e7

📥 Commits

Reviewing files that changed from the base of the PR and between b1e0789 and 2499826.

⛔ Files ignored due to path filters (3)
  • sdk/src/main/java/SourceClassMap.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/BareMetal2DpuChassisConfig.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/YuccaBareMetal2DpuChassisConfig.java is excluded by !sdk/**
📒 Files selected for processing (1)
  • utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java
✅ Files skipped from review due to trivial changes (1)
  • utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

Walkthrough

CloudOperationsErrorCode 类中新增了四个公共静态错误代码常量:ORG_ZSTACK_BAREMETAL2_INSTANCE_10093..._10094..._10095..._10096。无其他代码或控制流修改。(不超过50字)

Changes

Cohort / File(s) Summary
错误代码常量扩展
utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java
新增四个裸金属实例相关的公共静态字符串常量(错误代码 10093–10096),仅添加常量定义,未修改其他逻辑或接口。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 新码轻敲进常量行,
些许编号落云端,
九三到九六并成章,
简单声明无波澜,
错误识别更分明。


Important

Pre-merge checks failed

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

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Title check ❌ Error PR title exceeds 72 character limit (85 chars) and describes attaching networks but actual change only adds error code constants. Shorten title to ≤72 chars and ensure it matches the actual changeset (adding error code constants), not the broader feature objective.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed Description mentions attaching networks to baremetal2 instances, which aligns with PR objectives but actual changes only add error code constants.
✨ 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/shan.wu/feature-dpu-baremetal@@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.42.0)
utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@header/src/main/java/org/zstack/header/volume/VolumeProtocol.java`:
- Line 9: VolumeProtocol now contains RBD but XInfiniStorageController does not
handle it; update the controller to close the protocol handling loop by adding
RBD cases or stop exposing RBD until implementation is ready. Specifically, in
XInfiniStorageController update protocolToString (method protocolToString) to
return a valid string for VolumeProtocol.RBD instead of throwing
RuntimeException, and extend the activate and deactivate methods to handle
VolumeProtocol.RBD in their protocol switch/if branches with the appropriate
logic or fallback path; alternatively remove/guard the VolumeProtocol.RBD enum
exposure so callers cannot select an unsupported protocol.

In
`@utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java`:
- Around line 5493-5494: The new error constant ORG_ZSTACK_BAREMETAL2_DPU_10002
(and the other four BAREMETAL2 constants added around the same diff) lack
corresponding human-friendly elaboration entries in
conf/errorElaborations/Elaboration.json; update that JSON by adding a BAREMETAL2
section (or extend the existing one) with entries keyed by each new constant
string (e.g., "ORG_ZSTACK_BAREMETAL2_DPU_10002") and provide appropriate
regex/message pairs for each error so runtime error reporting is not blank—also
ensure you add the same mappings for the other missing codes in the 7719-7726
range.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ 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: 4fed95bd-11ba-4058-963d-408c7f547d29

📥 Commits

Reviewing files that changed from the base of the PR and between 7bf9cdf and 5cc42da.

⛔ Files ignored due to path filters (3)
  • sdk/src/main/java/SourceClassMap.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/BareMetal2DpuChassisConfig.java is excluded by !sdk/**
  • sdk/src/main/java/org/zstack/sdk/BareMetal2DpuChassisInventory.java is excluded by !sdk/**
📒 Files selected for processing (3)
  • header/src/main/java/org/zstack/header/volume/VolumeProtocol.java
  • header/src/main/java/org/zstack/header/volume/VolumeProtocolCapability.java
  • utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

CBD,
NBD
NBD,
RBD
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

新增 RBD 后协议处理链路未闭环,实际调用会失败。

Line 9 引入 RBD 后,plugin/xinfini/src/main/java/org/zstack/xinfini/XInfiniStorageController.java 里:

  • protocolToString(Line 140-150)会走到 RuntimeException
  • activate(Line 153-166)和 deactivate(Line 207-221)会落入 not supported protocol 失败分支。

建议在同一 PR 补齐 RBD 分支处理,或暂不暴露该枚举值,避免功能处于“可配置但不可用”状态。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@header/src/main/java/org/zstack/header/volume/VolumeProtocol.java` at line 9,
VolumeProtocol now contains RBD but XInfiniStorageController does not handle it;
update the controller to close the protocol handling loop by adding RBD cases or
stop exposing RBD until implementation is ready. Specifically, in
XInfiniStorageController update protocolToString (method protocolToString) to
return a valid string for VolumeProtocol.RBD instead of throwing
RuntimeException, and extend the activate and deactivate methods to handle
VolumeProtocol.RBD in their protocol switch/if branches with the appropriate
logic or fallback path; alternatively remove/guard the VolumeProtocol.RBD enum
exposure so callers cannot select an unsupported protocol.

Comment on lines +5493 to +5494
public static final String ORG_ZSTACK_BAREMETAL2_DPU_10002 = "ORG_ZSTACK_BAREMETAL2_DPU_10002";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

新增错误码缺少 Elaboration 映射,用户侧将出现空/不完整报错信息

这 5 个新错误码已在常量中定义,但 conf/errorElaborations/Elaboration.json 里没有对应 BAREMETAL2 条目。请在同一 PR 同步补齐映射,否则实际报错时可读性会明显下降。

建议补充(示例,需按真实语义完善 regex/message)
+[
+  {
+    "category": "BAREMETAL2",
+    "code": "10002",
+    "method": "regex",
+    "regex": "TODO: dpu error regex",
+    "message_cn": "TODO",
+    "message_en": "TODO"
+  },
+  {
+    "category": "BAREMETAL2",
+    "code": "10093",
+    "method": "regex",
+    "regex": "TODO: instance error regex 10093",
+    "message_cn": "TODO",
+    "message_en": "TODO"
+  },
+  {
+    "category": "BAREMETAL2",
+    "code": "10094",
+    "method": "regex",
+    "regex": "TODO: instance error regex 10094",
+    "message_cn": "TODO",
+    "message_en": "TODO"
+  },
+  {
+    "category": "BAREMETAL2",
+    "code": "10095",
+    "method": "regex",
+    "regex": "TODO: instance error regex 10095",
+    "message_cn": "TODO",
+    "message_en": "TODO"
+  },
+  {
+    "category": "BAREMETAL2",
+    "code": "10096",
+    "method": "regex",
+    "regex": "TODO: instance error regex 10096",
+    "message_cn": "TODO",
+    "message_en": "TODO"
+  }
+]

Also applies to: 7719-7726

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java`
around lines 5493 - 5494, The new error constant ORG_ZSTACK_BAREMETAL2_DPU_10002
(and the other four BAREMETAL2 constants added around the same diff) lack
corresponding human-friendly elaboration entries in
conf/errorElaborations/Elaboration.json; update that JSON by adding a BAREMETAL2
section (or extend the existing one) with entries keyed by each new constant
string (e.g., "ORG_ZSTACK_BAREMETAL2_DPU_10002") and provide appropriate
regex/message pairs for each error so runtime error reporting is not blank—also
ensure you add the same mappings for the other missing codes in the 7719-7726
range.

@MatheMatrix MatheMatrix force-pushed the sync/shan.wu/feature-dpu-baremetal@@2 branch from 5cc42da to b1e0789 Compare April 3, 2026 03:54
…emetal2 instance

support attaching novlan and vxlan network to baremetal2 instance

Resolves/Related: ZSTAC-82781

Change-Id: I736d637a7168656a6c726c6769777a726e616974
@MatheMatrix MatheMatrix force-pushed the sync/shan.wu/feature-dpu-baremetal@@2 branch from b1e0789 to 2499826 Compare April 3, 2026 05:32
@MatheMatrix
Copy link
Copy Markdown
Owner

Comment from yaohua.wu:

Review: MR !9530 (zstack) — ZSTAC-82781

SDK 类和 Error Code 变更,配合 premium !13398

Warning

1. [CloudOperationsErrorCode.java:~7729-7737] 新增 error code 缺少 Elaboration 映射

ORG_ZSTACK_BAREMETAL2_INSTANCE_10093 ~ 10096 四个常量未在 conf/errorElaborations/Elaboration.json 中添加对应条目。运行时报错信息将缺乏可读的用户提示。CodeRabbit 已指出此问题且已被 resolved — 请确认是否已在后续提交中补充。


2. [BareMetal2DpuChassisConfig.java:~7] vendorType 字段新增到基类

SDK 的 BareMetal2DpuChassisConfig 新增 vendorType 公共字段。这是正确的(配合 premium 侧多态反序列化),但需确认此字段是否会出现在 API 响应中。如果会,需在 API 文档中补充说明。

Suggestion

1. [YuccaBareMetal2DpuChassisConfig.java] SDK 类字段为 public 且缺乏文档注释

phyInterfacebondModetunnelType 三个 public 字段缺少 JavaDoc 说明有效值范围。建议加注释标明:

  • phyInterface: e.g. "eth0", "eth1", "bond0"
  • bondMode: "none", "lacp", "active-backup"
  • tunnelType: "none", "vxlan", "flat+vxlan"

Verdict: APPROVED

SDK 变更与 premium 侧实现一致,SourceClassMap 注册正确。详细 review 见 premium MR !13398 评论。


🤖 Robot Reviewer

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