Skip to content

<fix>[vm]: pass guest OS type to kvmagent - #4707

Open
ZStack-Robot wants to merge 1 commit into
5.4.13from
sync/zstackio/fix/5.4.13/ZSTAC-87832@@2
Open

<fix>[vm]: pass guest OS type to kvmagent#4707
ZStack-Robot wants to merge 1 commit into
5.4.13from
sync/zstackio/fix/5.4.13/ZSTAC-87832@@2

Conversation

@ZStack-Robot

Copy link
Copy Markdown
Collaborator

Summary

Pass the VM guest OS type to kvmagent so guest-specific CPU hotplug handling can be selected safely.

Changes

  • Extend StartVmCmd with guestOsType under the 5.4.12 wire-protocol gray version.
  • Populate guestOsType from VmInstanceInventory in KVMHost.
  • Extend ChangeVmGuestOsCase to verify the branch default and Ubuntu/Debian/CentOS updates while retaining ACPI/x2APIC coverage.

Testing

  • JDK 8 designated KvmTest / ChangeVmGuestOsCase: Tests run: 1, Failures: 0, Errors: 0, Skipped: 0; BUILD SUCCESS.
  • plugin/kvm and modified Groovy test compilation: passed.
  • git diff --check: passed.

Resolves: ZSTAC-87832

sync from gitlab !10759

Resolves: ZSTAC-87832

Change-Id: I876a25b0082e4b00c9078905e5f1ba2197dd0e2a
@coderabbitai

coderabbitai Bot commented Aug 23, 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 timed out.
⚙️ 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: d3c4c027-9447-43f6-9506-db578c7705ae

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce53ce and dada0d1.

📒 Files selected for processing (3)
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
  • plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
  • test/src/test/groovy/org/zstack/test/integration/kvm/vm/ChangeVmGuestOsCase.groovy

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

本次变更为 StartVmCmd 增加 guestOsType 字段。KVMHost 在启动虚拟机时传递该值。集成测试验证多个 guest OS 类型能够同步传递给 KVM agent。

Changes

KVM guest OS 类型传递

Layer / File(s) Summary
启动命令契约与 KVMHost wiring
plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java, plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
StartVmCmd 增加 guestOsType 字段及其 getter/setter。KVMHost 从虚拟机配置读取 guestOsType,并将其加入启动命令。
guest OS 类型集成验证
test/src/test/groovy/org/zstack/test/integration/kvm/vm/ChangeVmGuestOsCase.groovy
测试捕获 KVM 启动命令,并验证初始值及 Ubuntu 22.04、Debian 12、CentOS 7 更新后的 guest OS 类型。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to dada0

The change passes guest OS information to support guest-specific CPU hotplug handling, with targeted tests and build checks passing. No actionable merge-blocking risk remains after normal review.

Sequence Diagram(s)

sequenceDiagram
  participant VmInstanceInventory
  participant KVMHost
  participant KVMAgent
  VmInstanceInventory->>KVMHost: 提供 guestOsType
  KVMHost->>KVMAgent: 发送 StartVmCmd(guestOsType)
  KVMAgent-->>KVMHost: 接收启动命令
Loading

Suggested reviewers: liang-hanyu, majin1996

Poem

兔子捧着启动令,
guest OS 类型写分明。
Ubuntu、Debian、CentOS,
重启验证都同步。
KVM agent 收到值,
月光下安心蹦几步。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了将客户机操作系统类型传递给 kvmagent 的主要变更。
Description check ✅ Passed 描述与变更内容相关,并说明了协议字段、数据来源和测试范围。
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
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/zstackio/fix/5.4.13/ZSTAC-87832@@2

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

@zstack-robot-2

Copy link
Copy Markdown
Collaborator

Comment from yaohua.wu:

Review: MR !10759 — ZSTAC-87832

Background (preserved across rounds)

  • Jira: ZSTAC-87832 — Ubuntu 虚拟机在线扩容 CPU 后新增 vCPU 保持 offline
  • Bug summary: Ubuntu 22.04/24.04 虚拟机热添加 CPU 后,来宾系统能看到新增 CPU,但需重启或手工写 sysfs 才能 online。该问题影响已开启计算规格在线修改的 x86_64 Ubuntu/Debian 来宾。
  • Intent & scope: 在管理节点到 kvmagent 的 StartVm 协议中透传 guestOsType,让配套 zstack-utility MR !7679 能为受支持来宾选择 SMBIOS/QGA 处理;本 MR 修改 2 个生产 Java 文件和 1 个 Groovy 合约用例,不改变外部 API。
  • Round 1 initial findings: 0 × P0, 0 × P1;未发现阻塞性正确性、兼容性或架构问题。
  • Suggested fix direction: 无需额外代码修复;合并/发布时保持与 zstack-utility !7679 的版本配套,并在受支持环境完成双仓联调。

Findings

Severity File:Line Review conclusion
五个独立视角及反向验证后,未发现满足发布门槛的 P0/P1/P2/P3 finding。

Coverage

  • 本地 authoritative diff 与 GitLab 一致:3/3 文件,40 行新增;generated-file filter 跳过 0 个文件。
  • 已核对完整 StartVmCmd 协议对象、KVMHost.startVm 构造路径、Groovy simulator 断言,以及配套 zstack-utility !7679 对 guestOsType 的消费。
  • Upstream freshness:源分支与最新 upstream/5.4.13 无分叉、无新增上游提交、无同文件冲突;GitLab 状态为 can_be_merged
  • Quality Gate 抑制 1 条低置信单源候选(G4=1):现有 guestOsType 领域语义及 agent 侧大小写/版本后缀归一化已覆盖其反例。
  • 验证:git diff --check 通过。当前审查机缺少 Maven(mvn: command not found)且仅有 JDK 21,未重复执行 JDK 8 KvmTest;MR 中已记录 ChangeVmGuestOsCase 通过(1 test,0 failure/error)。

Verdict: APPROVED

本 MR 的字段版本门槛、赋值位置和回归测试与 Jira 方案及配套 agent 实现一致;剩余风险集中在双仓发布配套和目标环境联调,不构成本 MR 的代码阻塞项。


🤖 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.

3 participants