Skip to content

Commit 7d08878

Browse files
piyush5netappSrivastava, Piyush
andauthored
bugfix/CSTACKEX-143: Second VM creation creates a dummy running VM with not a bootable error in console (#43)
Co-authored-by: Srivastava, Piyush <Piyush.Srivastava@netapp.com>
1 parent a41eb28 commit 7d08878

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ public boolean connectPhysicalDisk(String volumeUuid, KVMStoragePool pool, Map<S
146146
if (result != null) {
147147
if (isNonFatalLogin(result)) {
148148
logger.debug("iSCSI login returned benign message for {}@{}:{}: {}", iqn, host, port, result);
149+
// Session already exists — a newly mapped LUN won't be visible until
150+
// the kernel's next periodic SCSI scan (~30-60s).
151+
Script rescanCmd = new Script(true, "iscsiadm", 0, logger);
152+
rescanCmd.add("-m", "session");
153+
rescanCmd.add("--rescan");
154+
String rescanResult = rescanCmd.execute();
155+
if (rescanResult != null) {
156+
logger.warn("iSCSI session rescan returned: {}", rescanResult);
157+
} else {
158+
logger.debug("iSCSI session rescan completed successfully for {}@{}:{}", iqn, host, port);
159+
}
149160
} else {
150161
logger.debug("Failed to log in to iSCSI target " + volumeUuid + ": " + result);
151162
System.out.println("Failed to log in to iSCSI target " + volumeUuid);

0 commit comments

Comments
 (0)