Skip to content

<feature>[kvm]: add iothread vq mapping data path#4169

Open
zstack-robot-2 wants to merge 1 commit into
feature-5.5.28-zbsfrom
sync/haidong.pang/feature/iothread-vq-mapping@@3
Open

<feature>[kvm]: add iothread vq mapping data path#4169
zstack-robot-2 wants to merge 1 commit into
feature-5.5.28-zbsfrom
sync/haidong.pang/feature/iothread-vq-mapping@@3

Conversation

@zstack-robot-2
Copy link
Copy Markdown
Collaborator

Summary

Add the KVM-side data contract for automatic IOThread VQ mapping.

Changes

  • Report qemu-kvm package version in KVM host facts.
  • Add the host capability constants and tag inputs for IOThread VQ mapping.
  • Carry resolved ioThreads through VolumeTO and SDK VolumeTO for KVM agent consumption.
  • Add focused host capability coverage.

sync from gitlab !10075

Resolves: ZSTAC-82672

Change-Id: Ib43a7a02a0528cc40cd8aa370b93b7fba7dfc051
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

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: c2b16900-308c-4fc1-9cb4-0371172a765d

📥 Commits

Reviewing files that changed from the base of the PR and between 4cdaed7 and 548a60a.

📒 Files selected for processing (7)
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMConstant.java
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMSystemTags.java
  • plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java
  • sdk/src/main/java/org/zstack/sdk/VolumeTO.java
  • test/src/test/groovy/org/zstack/test/integration/kvm/host/AddHostCase.groovy

Walkthrough

本更改为 KVM 主机事实响应添加了 QEMU-KVM 包版本跟踪字段,通过系统标签存储和智能清理机制管理该信息,并为卷配置引入了 IOThread 映射支持与相关版本阈值。

Changes

KVM 主机增强与卷配置

Layer / File(s) Summary
主机 QEMU-KVM 包版本数据结构
plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
HostFactResponse 中新增版本受控字段 qemuKvmPackageVersion 与对应的 getter/setter 方法,与既有的 libvirtPackageVersion 字段平行。
主机包版本系统标签定义
plugin/kvm/src/main/java/org/zstack/kvm/KVMSystemTags.java
新增 QEMU_KVM_PACKAGE_VERSION_TOKENQEMU_KVM_PACKAGE_VERSION 系统标签模式常量,标签前缀为 qemu-kvm::package::version::,绑定到 HostVO。
主机包版本持久化与清理逻辑
plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
saveKvmHostRelatedFacts 中升级 libvirt/qemu-kvm 包版本字段的条件判断,将"null 检查"升级为"非空白检查",空白时显式删除对应标签,非空白时才 trim 后更新。
主机包版本标签清理测试
test/src/test/groovy/org/zstack/test/integration/kvm/host/AddHostCase.groovy
新增 testPackageVersionTagsClearedWhenFactMissing() 测试方法,覆盖两个场景:fact 存在时系统标签被正确设置,fact 缺失/为空时重连主机后系统标签被清空。
卷 IOThread 配置字段与访问器
plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java, sdk/src/main/java/org/zstack/sdk/VolumeTO.java
在两个 VolumeTO 实现中新增 ioThreads 字段(0 表示自动 IOThread VQ 映射被禁用),plugin 版本同步拷贝构造器,两个版本均提供 getter/setter 方法。
IOThread VQ 映射版本阈值常量
plugin/kvm/src/main/java/org/zstack/kvm/KVMConstant.java
新增两个版本常量用于表示 QEMU-KVM 与 libvirt IOThread VQ 映射功能的最小支持版本号(分别为 6.2.0-4518.0.0-163)。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 灰度包版本如微风,qemu-kvm 随 iothread 启航,
标签清理似春雨细润,卷配置更新展宽广,
主机事实步步追踪,兔子为你整理八方。

🚥 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 标题准确反映了本次变更的主要目标——为KVM的IOThread VQ映射添加数据路径支持。
Description check ✅ Passed 描述清晰地涵盖了所有变更内容,包括报告qemu-kvm版本、添加主机能力常量、在VolumeTO中传递ioThreads信息和测试覆盖。
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/haidong.pang/feature/iothread-vq-mapping@@3

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.43.0)
plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java

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.

1 participant