| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The guard only checked that the path contains "-iscsi-", so a
SharedMountPoint disk under a directory like /mnt/fa-iscsi-primary got
past it and indexOf(":") returned -1. Require the by-path prefix and
validate the parsed positions, returning false for non-iSCSI paths.
| Back | FazBrowse Home | New Git URL |
Description
IscsiAdmStorageAdaptor.disconnectPhysicalDiskByPath only checked that the path contains -iscsi- before parsing it as /dev/disk/by-path/ip-<host>:<port>-iscsi-<iqn>-lun-<n>. KVMStoragePoolManager passes the local path of every disk to every adaptor, so a SharedMountPoint disk such as /mnt/fa-iscsi-primary/<uuid> passed the check, indexOf(":") returned -1 and the first Stop of the VM failed with Range [21, -1) out of bounds for length 58.
The method now requires the /dev/disk/by-path/ip- prefix and checks the parsed positions before calling substring, returning false for paths that are not iSCSI by-path entries.
Root cause analysis and the controlled reproduction (same storage mounted at a directory without -iscsi- stops fine) by @famerico in the issue.
Fixes: #14664
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
Added IscsiAdmStorageAdaptorTest covering a SharedMountPoint path containing -iscsi-, a path without it, and a by-path style string missing the port. Two of the three fail with StringIndexOutOfBoundsException (including the exact begin 21, end -1, length 58 from the issue) without the fix.
mvn -pl plugins/hypervisors/kvm test -Dtest=IscsiAdmStorageAdaptorTest: 3 tests, 0 failures (checkstyle passes). That run was on main; this branch is the same commit cherry-picked cleanly onto 4.22 (the method is identical there), not re-run on 4.22 locally. Not tested against a real iSCSI target.
How did you try to break this feature and the system with this change?
Well-formed by-path strings are parsed exactly as before. Other callers of cleanupDisk (migration, detach) go through the same method so they get the same guard.