Skip to content

<fix>[compute]: skip null DiskOfferingVO when querying candidate primary storages (ZSTAC-80709)#3890

Open
zstack-robot-1 wants to merge 1 commit into5.5.22from
sync/ye.zou/fix/ZSTAC-80709
Open

<fix>[compute]: skip null DiskOfferingVO when querying candidate primary storages (ZSTAC-80709)#3890
zstack-robot-1 wants to merge 1 commit into5.5.22from
sync/ye.zou/fix/ZSTAC-80709

Conversation

@zstack-robot-1
Copy link
Copy Markdown
Collaborator

sync from gitlab !9770

Resolves: ZSTAC-80709

Change-Id: I03f8705c7accba537036132b04dc91b6141f81ef
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 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: 2d105b60-5968-4f9d-8fff-b953d50490fb

📥 Commits

Reviewing files that changed from the base of the PR and between 18b0d53 and 1272347.

📒 Files selected for processing (1)
  • compute/src/main/java/org/zstack/compute/vm/VmInstanceManagerImpl.java

Walkthrough

在VmInstanceManagerImpl.java中对VM创建的数据磁盘处理进行了防御性重构。原先直接内联处理DiskOfferingVO对象的转换,现改为引入局部变量、执行查找,并仅在结果非空时才将其包装成DiskOfferingInventory,以避免潜在的NPE。

Changes

null安全性改进

Layer / File(s) Summary
Null检查逻辑
compute/src/main/java/org/zstack/compute/vm/VmInstanceManagerImpl.java
在dataDiskOfferingUuids的循环中,将直接内联的DiskOfferingVO转换替换为显式的局部变量声明和null条件检查,防止将null值包装成DiskOfferingInventory。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 一条防线细心铺,null不再乱跳舞,
局部变量守关卡,检查妥当才通途,
小小重构大安稳!


Important

Pre-merge checks failed

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

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Title check ❌ Error 标题格式符合[scope]: 的要求,但长度为95字符,超过72字符的限制。 缩短标题长度到72字符以内,例如改为:[compute]: skip null DiskOfferingVO for candidate storages
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed 描述与变更集相关,虽然简洁但足以说明这是从GitLab同步的变更。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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-80709

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