We use an rpm version: vdsm-4.9-106.el6.x86_64
First change makes target login to try transport iSER and if fails to try transport iSCSI. Second change is adding '-o new' to the discovery command so already discovered targets settings won't be overridden with default settings.
Thanks, Roi
--- iscsi.py 2011-11-01 12:35:06.707272165 +0200 +++ iscsi.py 2011-11-09 11:52:01.935067375 +0200 @@ -25,7 +25,7 @@ import storage_exception as se import devicemapper
-SENDTARGETS_DISCOVERY = [constants.EXT_ISCSIADM, "-m", "discoverydb", "-t", "sendtargets"] +SENDTARGETS_DISCOVERY = [constants.EXT_ISCSIADM, "-m", "discoverydb", "-t", "sendtargets", "-o", "new"] ISCSIADM_NODE = [constants.EXT_ISCSIADM, "-m", "node"] ISCSIADM_IFACE = [constants.EXT_ISCSIADM, "-m", "iface"] ISCSI_DEFAULT_PORT = "3260" @@ -376,6 +376,28 @@
return rc, out
+def setNodeTransport(portal, iqn, transport='tcp'): + """Configure a node transport +transport :tcp, iser + """ + if transport not in ['tcp', 'iser']: + transport = 'tcp' + + log.info('Set transport %s to target %s on portal %s' % (transport, iqn, portal)) + + cmds = [ + [constants.EXT_ISCSIADM] + '-m node -o update -n node.conn[0].iscsi.HeaderDigest -v None'.split(), + [constants.EXT_ISCSIADM] + ('-m node -o update -n iface.transport_name -v '+transport).split() + ] + + cmds[0] += ['-p', portal, '-T', iqn] + cmds[1] += ['-p', portal, '-T', iqn] + + for cmd in cmds: + rc = misc.execCmd(cmd)[0] + if rc != 0: + raise se.iSCSILoginError(portal) + def remiSCSIPortal(ip, port): """ Removes iSCSI portal from discovery list @@ -467,9 +489,16 @@ raise se.SetiSCSIPasswdError(portal)
# Finally instruct the iscsi initiator to login to the target + # try iser first and then tcp + setNodeTransport(portal, iqn, 'iser') cmd = cmdt + ["-l", "-p", portal] rc = misc.execCmd(cmd)[0] if rc != 0: + # now try iSCSI + setNodeTransport(portal, iqn, 'tcp') + cmd = cmdt + ["-l", "-p", portal] + rc = misc.execCmd(cmd)[0] + if rc != 0: raise se.iSCSILoginError(portal) except se.StorageException: exc_class, exc, tb = sys.exc_info()