Skip to content

<fix>[vm]: use max of virtual and actual size for root disk allocation#3333

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

<fix>[vm]: use max of virtual and actual size for root disk allocation#3333
zstack-robot-1 wants to merge 1 commit into5.5.6from
sync/ye.zou/fix/ZSTAC-74683

Conversation

@zstack-robot-1
Copy link
Collaborator

Summary

  • ZSTAC-74683: 不指定根云盘规格时,qcow2 镜像 virtualSize < actualSize 导致创建 VM 失败
  • 根因:getRootDiskAllocateSize() 仅用 image.getSize() (virtual size),未考虑 actualSize 可能更大
  • 修复:改用 Math.max(virtualSize, actualSize) 确保分配足够空间

Files Changed

  • VmInstanceSpec.java — getRootDiskAllocateSize() 取 max(virtualSize, actualSize)

Resolves: ZSTAC-74683

sync from gitlab !9155

…isk offering

Resolves: ZSTAC-74683

Change-Id: Id0339ed0221e92e506f60745cde972cc3ee6d9ae
@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

概览

修改了在没有根磁盘产品时的根磁盘大小回退计算逻辑。将直接返回镜像清单大小改为返回镜像清单大小和实际大小的最大值。

变更项

分类 / 文件 总结
虚拟机规格配置
header/src/main/java/org/zstack/header/vm/VmInstanceSpec.java
修改根磁盘大小计算逻辑,使用镜像清单大小与实际大小的最大值作为回退值

代码审查工作量估计

🎯 2 (Simple) | ⏱️ ~8 分钟

诗歌

🐰 梦想根磁盘,大小难确定
取两数之最,回退逻辑精
镜像真实现,规格更完善
一行三删增,用心在微澜

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed 标题符合指定的格式要求:遵循 [scope]: 的格式,共70个字符,不超过72字符限制。标题清晰准确地描述了主要变更内容——使用虚拟大小和实际大小的最大值来计算根磁盘分配。
Description check ✅ Passed 拉取请求描述与变更集相关。描述清楚地说明了问题(qcow2镜像virtualSize < actualSize导致VM创建失败)、根本原因和修复方案(使用Math.max获取最大值),与代码变更直接对应。

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sync/ye.zou/fix/ZSTAC-74683

No actionable comments were generated in the recent review. 🎉


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