Skip to content

Commit f87fdc0

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
[CSTACKEX-233] Address Review Comments
1 parent 71a6730 commit f87fdc0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/IscsiAdmStorageAdaptor.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ public boolean connectPhysicalDisk(String volumeUuid, KVMStoragePool pool, Map<S
148148
// After a certain number of tries and a certain waiting period in between tries,
149149
// this method could still return (it should not block indefinitely) (the race condition
150150
// isn't solved here, but made highly unlikely to be a problem).
151+
// If the by-path is missing or is a regular file (not the iSCSI block symlink), size
152+
// stays 0. Return false so connect does not succeed and a raw file is not created at
153+
// that by-path in place of the real LUN device.
151154
if (!waitForDiskToBecomeAvailable(volumeUuid, pool)) {
152155
logger.warn("iSCSI device not ready for target {} at {}:{} after wait", volumeUuid, host, port);
153156
return false;
@@ -233,10 +236,8 @@ private boolean isIscsiSessionActive(String iqn, String host, int port) {
233236
if (StringUtils.isBlank(sessions)) {
234237
return false;
235238
}
236-
237-
String portal = host + ":" + port;
238239
for (String line : sessions.split("\n")) {
239-
if (line.contains(iqn) && line.contains(portal)) {
240+
if (line.contains(iqn) && line.contains(host)) {
240241
return true;
241242
}
242243
}

0 commit comments

Comments
 (0)