[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] [RFC] ISCSI transport protocol support in libvirt

Hi everyone,

This my first post on this list

Context : Some days ago I have decided to use infiniband for ISCSI streams. Infiniband adds a new wonderful transport protocol : ISER. This protocols is added to the well known the default TCP. (NB: ISER = ISCSI + RDMA). I could not see any ISCSI transport protocol modification support in libivirt (the default protocol tcp is even hardcoded in the regex)

What i have done :
- did the shell testing for the iscsiadm
- the attached patch that corrects 2 typos in the original code and switches completely the iscsi transport protocol from tcp to iser (which is not ideal at all)

What should be done (imho):
- add iscsi transport protocol support (using my patch as a basis)
- add a new XML property/whatever_fits_the_projects_policy to the storagepool object that allows user to pick the iscsi transport protocol (default is tcp)

I was thinking of having something like :

<pool type="iscsi">
          <host name=""/>
          <device path="IQNOFTARGET"/>
          <transport protocol="iser"/>

Any comment on this ? Any help on the XML part ?

Best regards,


NB: the current iscsi transport protocols available are : tcp(default), iser, qla4xxx, bnx2, and icxgb3i.

PS: i'm still doing extensive testing of my patch

diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index f34123f..7c21ad7 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -113,11 +113,13 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
      * # iscsiadm --mode session
      * tcp: [1],1 demo-tgt-b
      * tcp: [2],1 demo-tgt-a
+     * iser: [5],1 demo-tgt-d
      * Pull out 2nd and 4th fields
     const char *regexes[] = {
-        "^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+)\\s*$"
+        "^iser:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+)\\s*$"
     int vars[] = {
@@ -230,7 +232,7 @@ virStorageBackendIQNFound(virStoragePoolObjPtr pool,
     if (ret == IQN_MISSING) {
-        VIR_DEBUG("Could not find interface witn IQN '%s'", iqn);
+        VIR_DEBUG("Could not find interface with IQN '%s'", iqn);
@@ -293,7 +295,24 @@ virStorageBackendCreateIfaceIQN(virStoragePoolObjPtr pool,
     if (virRun(cmdargv2, &exitstatus) < 0) {
                               _("Failed to run command '%s' to update iscsi interface with IQN '%s'"),
-                              cmdargv1[0], pool->def->source.initiator.iqn);
+                              cmdargv2[0], pool->def->source.initiator.iqn);
+        goto out;
+    }
+    /* This part switches iscsi transport protocol from default (tcp) to iser
+     * TODO: add some XML variable variable for enabling/disabling this block*/ 
+    const char *const cmdargv3[] = {
+        ISCSIADM, "--mode", "iface", "--interface", &temp_ifacename[0],
+        "--op", "update", "--name iface.transport_name", "--value iser", NULL
+    };
+    /* Note that we ignore the exitstatus.  Older versions of iscsiadm tools
+     * returned an exit status of > 0, even if they succeeded.  We will just
+     * rely on whether iface file got updated properly. */
+    if (virRun(cmdargv3, &exitstatus) < 0) {
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                              _("Failed to run command '%s' to update iscsi interface with IQN '%s'"),
+                              cmdargv3[0], pool->def->source.initiator.iqn);
         goto out;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]