Skip to content

<fix>[compute]: fix magic string enableDpdkVhostuser in VmNicManagerImpl#3840

Open
ZStack-Robot wants to merge 1 commit intofeature-5.5.22-zcf-temporaryfrom
sync/shixin.ruan/shixin-ZCF-1936@@2
Open

<fix>[compute]: fix magic string enableDpdkVhostuser in VmNicManagerImpl#3840
ZStack-Robot wants to merge 1 commit intofeature-5.5.22-zcf-temporaryfrom
sync/shixin.ruan/shixin-ZCF-1936@@2

Conversation

@ZStack-Robot
Copy link
Copy Markdown
Collaborator

Move enableDpdkVhostuser tag constant from premium ZNS to
VmSystemTags in the zstack project to eliminate magic string
in VmNicManagerImpl.getVmNicType().

Resolves: ZCF-1936

Change-Id: I21bec7237d909922c08f369ac5b269b4de14c8d3

sync from gitlab !9711

Move enableDpdkVhostuser tag constant from premium ZNS to
VmSystemTags in the zstack project to eliminate magic string
in VmNicManagerImpl.getVmNicType().

Resolves: ZCF-1936

Change-Id: I21bec7237d909922c08f369ac5b269b4de14c8d3
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 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: d60f8e97-1a46-4baa-b3a3-a9826d53b551

📥 Commits

Reviewing files that changed from the base of the PR and between 21ebc82 and 55c21ab.

📒 Files selected for processing (2)
  • compute/src/main/java/org/zstack/compute/vm/VmNicManagerImpl.java
  • compute/src/main/java/org/zstack/compute/vm/VmSystemTags.java

功能概览

引入一个新的虚拟机系统标签模式 enableDpdkVhostuser::{l3NetworkUuid},并重构现有代码以使用该模式化标签而非手动格式化字符串来检测 DPDK vhost-user 的启用状态。

变更

内聚组 / 文件 摘要
系统标签定义
compute/src/main/java/org/zstack/compute/vm/VmSystemTags.java
新增 DPDK vhost-user 系统标签的常量定义,包括令牌 ENABLE_DPDK_VHOSTUSER_L3_UUID_TOKEN 和模式化标签实例 ENABLE_DPDK_VHOSTUSER
网卡管理器实现
compute/src/main/java/org/zstack/compute/vm/VmNicManagerImpl.java
将 DPDK vhost-user 启用检测从直接使用 String.format 重构为调用 VmSystemTags.ENABLE_DPDK_VHOSTUSER.instantiateTag 方法,提升标签生成的一致性。

预估代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

诗句

🐰 系统标签焕新颜,
vhost-user 更规范,
令牌聚合显优雅,
代码清晰又安全,
小小重构大智慧!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Title check ✅ Passed PR标题遵循[scope]: 的格式,长度为72字符,清楚地描述了主要变更内容。
Description check ✅ Passed PR描述清楚地说明了变更的目的——将enableDpdkVhostuser标签常量从premium ZNS移动到VmSystemTags中以消除魔法字符串。
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/shixin.ruan/shixin-ZCF-1936@@2

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

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