6ae9ed
From c81a60b88a477a2fb8a35e53b6e4da3a6029dfd0 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <c81a60b88a477a2fb8a35e53b6e4da3a6029dfd0@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Mon, 1 Aug 2016 13:31:53 -0400
6ae9ed
Subject: [PATCH] iscsi: Establish connection to target via static target login
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1356436
6ae9ed
6ae9ed
Commit id '56057900' altered the discovery of iSCSI node targets by
6ae9ed
using the "--op nonpersistent". This caused issues for clean environments
6ae9ed
or if by chance a "-m node -o delete" was executed.
6ae9ed
6ae9ed
Since each iSCSI Storage Pool has the required iSCSI target path, use
6ae9ed
that and the virISCSINodeNew API in order to generate the iSCSI node record.
6ae9ed
6ae9ed
(cherry picked from commit 5d8c31c6b202aa5ce4329042225bb40fec16baf9)
6ae9ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
6ae9ed
---
6ae9ed
 src/storage/storage_backend_iscsi.c | 9 ++++-----
6ae9ed
 1 file changed, 4 insertions(+), 5 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
6ae9ed
index bb33da2..84ad6f3 100644
6ae9ed
--- a/src/storage/storage_backend_iscsi.c
6ae9ed
+++ b/src/storage/storage_backend_iscsi.c
6ae9ed
@@ -353,11 +353,10 @@ virStorageBackendISCSIStartPool(virConnectPtr conn,
6ae9ed
     if ((session = virStorageBackendISCSISession(pool, true)) == NULL) {
6ae9ed
         if ((portal = virStorageBackendISCSIPortal(&pool->def->source)) == NULL)
6ae9ed
             goto cleanup;
6ae9ed
-        /*
6ae9ed
-         * iscsiadm doesn't let you login to a target, unless you've
6ae9ed
-         * first issued a 'sendtargets' command to the portal :-(
6ae9ed
-         */
6ae9ed
-        if (virISCSIScanTargets(portal, NULL, NULL) < 0)
6ae9ed
+
6ae9ed
+        /* Create a static node record for the IQN target. Must be done
6ae9ed
+         * in order for login to the target */
6ae9ed
+        if (virISCSINodeNew(portal, pool->def->source.devices[0].path) < 0)
6ae9ed
             goto cleanup;
6ae9ed
 
6ae9ed
         if (virStorageBackendISCSISetAuth(portal, conn, &pool->def->source) < 0)
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed