resizeVolume of a running system VM's volume is accepted but the VM never sees the new size

未关闭 适合新手
#14,645 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
backend, cloud

调研方向

从 VolumeApiServiceImpl.orchestrateResizeVolume 开始,追踪它如何识别 VM 并应用现有的调整大小状态检查。查看仅调整大小的卷调整以及系统 VM 状态的相关测试;当系统 VM 的卷在 VM 未停止时拒绝调整大小,而已停止 VM 的调整大小仍然有效时,这项更改就完成了。

由索引模型根据 Issue 内容生成。

描述

problem

A size-only resizeVolume of a running system VM's volume, for example a virtual router's ROOT, is accepted and resizes the volume on the storage. The running system VM is never told, so the guest keeps seeing the old size until it next starts. The API, the database and the storage all report the new size while the VM still runs on the old one.

VolumeApiServiceImpl.orchestrateResizeVolume only looks the VM up as a user VM (_userVmDao.findById). For a system VM that returns null, so the resize is sent with the instance name none and no host. On KVM the image is grown, but virsh blockresize is never run for the running domain. The per-hypervisor checks in the same method (XenServer can only resize a stopped VM's disk; on KVM the VM's host must be Up and Enabled) are skipped for the same reason.

Other paths already treat system VM volumes differently:

  • volume snapshots of system VM volumes are refused;
  • attach and detach accept only user VMs;
  • a ROOT resize through a new disk offering is refused unless the VM is Stopped.

The size-only path has no such check.

versions

4.22, and main.

The steps to reproduce the bug

Seen on KVM with Ceph RBD primary storage:

  1. Take a running virtual router whose ROOT disk offering is not size-strict.
  2. Call resizeVolume id=<router ROOT volume> size=<larger size in GB>.
  3. The call succeeds. listVolumes and rbd info show the new size.
  4. On the host, virsh domblkinfo <router> vda still shows the old size, and so does lsblk in the router. The new size only appears after the router is restarted.
What to do about it?

Refuse to resize the volume of a system VM that is not Stopped, with an error telling the admin to stop it first. Resizing it while it is stopped keeps working as before, and the VM sees the new size when it starts.

Doing the resize live instead would mean running the system VM's resize through the VM work queue and notifying the hypervisor, as is done for user VMs, and checking that on each hypervisor. Refusing is the smaller, safer change.

主要语言
Java
星标
3.1k
派生
1.4k
平均合并
6 天 20 小时
30 天内合并 PR
17

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。