Repository navigation
Conversation
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
IscsiAdmStorageAdaptor.disconnectPhysicalDiskByPathonly 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 withRange [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 callingsubstring, 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
IscsiAdmStorageAdaptorTestcovering a SharedMountPoint path containing-iscsi-, a path without it, and a by-path style string missing the port. Two of the three fail withStringIndexOutOfBoundsException(including the exactbegin 21, end -1, length 58from 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.