famerico opened a new issue, #14664:
URL: https://github.com/apache/cloudstack/issues/14664

   ### 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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to