]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Ignore additional fields in iscsiadm output
authorJán Tomko <jtomko@redhat.com>
Fri, 21 Feb 2014 09:22:22 +0000 (10:22 +0100)
committerJán Tomko <jtomko@redhat.com>
Fri, 2 May 2014 19:16:12 +0000 (21:16 +0200)
There has been a new field introduced in iscsiadm --mode session
output [1], but our regex only expects four fields. This breaks
startup of iscsi pools:
error: Failed to start pool iscsi
error: internal error: cannot find session

Fix this by ignoring anything after the fourth field.

https://bugzilla.redhat.com/show_bug.cgi?id=1067173

[1] https://github.com/mikechristie/open-iscsi/commit/181af9a

(cherry picked from commit 57e17a74b76fd8f93012d6d0407106e9a2d5c5e3)

src/storage/storage_backend_iscsi.c

index 9bcea243b6a02457f772738d2c9993c9d0f0a8fa..23c49212747596853b692729ac11ae4885d17988 100644 (file)
@@ -102,7 +102,7 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
      * Pull out 2nd and 4th fields
      */
     const char *regexes[] = {
-        "^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+)\\s*$"
+        "^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+).*$"
     };
     int vars[] = {
         2,