Skip to content

<fix>[compute]: clean vm device addresses before vm db deletion (ZSTAC-82264)#3978

Open
zstack-robot-1 wants to merge 1 commit into
5.5.12from
sync/ye.zou/fix/ZSTAC-82264
Open

<fix>[compute]: clean vm device addresses before vm db deletion (ZSTAC-82264)#3978
zstack-robot-1 wants to merge 1 commit into
5.5.12from
sync/ye.zou/fix/ZSTAC-82264

Conversation

@zstack-robot-1
Copy link
Copy Markdown
Collaborator

Summary

  • clean VM-level device address records before VM DB deletion
  • register VmInstanceDeviceManager as VmJustBeforeDeleteFromDbExtensionPoint
  • avoid destroy failures for running VMs with NPU/PCI device metadata

Build

  • attempted mvn compile -pl compute -am -Dmaven.test.skip
  • blocked by existing JAXB/JDK environment issue in utils, unrelated to this patch

sync from gitlab !9870

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Review Change Stack

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: fe5a7ed2-84b2-49fa-a73a-138ffcea6bc4

📥 Commits

Reviewing files that changed from the base of the PR and between 41d127f and e4e645b.

⛔ Files ignored due to path filters (1)
  • conf/springConfigXml/VmInstanceManager.xml is excluded by !**/*.xml
📒 Files selected for processing (1)
  • compute/src/main/java/org/zstack/compute/vm/devices/VmInstanceDeviceManagerImpl.java

概览

VmInstanceDeviceManagerImpl 现在实现 VmJustBeforeDeleteFromDbExtensionPoint 扩展点,添加 vmJustBeforeDeleteFromDb 回调方法以在虚拟机从数据库删除前清理对应的设备地址。

变更

VM 设备地址生命周期清理

层 / 文件 说明
设备地址删除回调实现
compute/src/main/java/org/zstack/compute/vm/devices/VmInstanceDeviceManagerImpl.java
VmInstanceDeviceManagerImpl 实现 VmJustBeforeDeleteFromDbExtensionPoint,添加 vmJustBeforeDeleteFromDb 方法在 VM 删除前调用 deleteVmDeviceAddress 清理设备地址。

代码审查工作量估计

🎯 1 (Trivial) | ⏱️ ~5 分钟

小兔来修缮,生命周期长,
VM 将消亡,地址莫遗忘,
删前清一清,扩展点铮铮,
设备地址净,逻辑更妥当。🐰✨


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标题格式正确且相关,但超过了72字符的限制(77字符)。 缩短标题长度至72字符以内,可考虑简化为'[compute]: clean vm device addresses before deletion (ZSTAC-82264)'(71字符)。
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 (3 passed)
Check name Status Explanation
Description check ✅ Passed PR描述清晰地说明了变更内容,包括清理VM设备地址、注册扩展点以及解决的问题。
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/ye.zou/fix/ZSTAC-82264

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