[KVM] StringIndexOutOfBoundsException in IscsiAdmStorageAdaptor.disconnectPhysicalDiskByPath makes the first Stop VM fail when a disk path contains "-iscsi-" (e.g. a SharedMountPoint pool mount directory)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- backend, infrastructure
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Create a VM with a data volume on a SharedMountPoint (iSCSI-backed) pool and attach it.
- Stop the VM. The stop fails with the exception above.
- Stop the VM again. It stops normally.
- 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.
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 1.4k
- Avg merge
- 7d 4h
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/cloudstack
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/cloudstack#14719 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
apache/cloudstack#14715 ·
Maintainers usually reply within 1 day
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new sizePossibly taken @bhouse-nexthop claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/cloudstack#14645 · 1 comment ·
Maintainers usually reply within 1 day
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replacedPossibly taken @bhouse-nexthop claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/cloudstack#14633 · 1 comment ·
Maintainers usually reply within 1 day
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)Possibly taken @bhouse-nexthop claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/cloudstack#14631 · 1 comment ·
Maintainers usually reply within 1 day
All issues in apache/cloudstack
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
SAP/ai-sdk-java#1206 ·
Maintainers usually reply within 1 day
-
enhancement good first issue insight-module
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sdlc-pro/spring-lens#606 ·
Maintainers usually reply within 1 day
-
quality-assurance
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#252 ·
Maintainers usually reply within 1 day
-
backlog kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
TencentBlueKing/bk-job#4627 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
openrocket/openrocket#3460 ·
Maintainers usually reply within 1 day