[KVM] StringIndexOutOfBoundsException in IscsiAdmStorageAdaptor.disconnectPhysicalDiskByPath makes the first Stop VM fail when a disk path contains "-iscsi-" (e.g. a SharedMountPoint pool mount directory)

未關閉
#14,664 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@HawkForge 已經在處理了。

開始於 2026年11月12日。

  • #14686 來自 @HawkForge —— 未關閉

評估

難度
3/5
預估耗時
1-2 天
新手友好度
57/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
java

研究方向

Start with IscsiAdmStorageAdaptor.disconnectPhysicalDiskByPath at the reported exception line, then trace how KVMStoragePoolManager calls it during LibvirtComputingResource.cleanupDisk. Reproduce with an attached volume on a SharedMountPoint iSCSI pool and inspect the disk path passed to the method. Done when the first Stop attempt handles that path without throwing and the regression is covered by a focused test.

由索引模型根據 Issue 內容生成。

描述

problem

Stopping a VM that has a volume from a SharedMountPoint (iSCSI-backed) pool attached fails the first time with:

java.lang.StringIndexOutOfBoundsException: Range [21, -1) out of bounds for length 58
  at com.cloud.hypervisor.kvm.storage.IscsiAdmStorageAdaptor.disconnectPhysicalDiskByPath(IscsiAdmStorageAdaptor.java:362)
  at com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager.disconnectPhysicalDiskByPath(KVMStoragePoolManager.java:213)
  at com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.cleanupDisk(LibvirtComputingResource.java:3971)
  at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStopCommandWrapper.execute(LibvirtStopCommandWrapper.java:98)

The exception is deterministic (same message every time, reproduced 4 times). The second Stop attempt succeeds. If the volume is detached first, the Stop succeeds on the first attempt. The index pair (start 21, end -1) looks like an indexOf(...) returning -1 and being used as the end of a substring, which would mean the disk path format does not match what the parser expects. We have not confirmed this.

versions
  • Apache CloudStack 4.22.1.1
  • Hypervisor: KVM
  • Primary storage: pool of type SharedMountPoint, backed by iSCSI LUNs
The steps to reproduce the bug
  1. Create a VM with a data volume on a SharedMountPoint (iSCSI-backed) pool and attach it.
  2. Stop the VM. The stop fails with the exception above.
  3. Stop the VM again. It stops normally.
  4. Start the VM, detach the volume, stop the VM. It stops on the first attempt.
What to do about it?

Validate the path in disconnectPhysicalDiskByPath before calling substring, and return false (or log and skip) for paths that are not iSCSI device paths instead of throwing. It would also help to understand why the second Stop works.

主要語言
Java
星號
3.1k
分支
1.4k
平均合併
7 天 16 小時
30 天內合併 PR
15

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。