[PATCH] iscsi.py: fixed discovery issue and added support for iSER transport

Roi Dayan roid at mellanox.com
Mon Dec 12 14:41:34 UTC 2011


Same patch, beside fix to discover command.
I addressed to the last review and that’s why I mailed it here.
About the race. The gui doesn't let you choose between iser or tcp.
So we first try iser and then tcp.

I can't use gerrit without and account.
I can't create an account, says on the page someone with an account should create one for me.
On irc #vdsm I was forwarded to #ovirt for help but chanserv always kicks me out of the channel
with the reason that I'm not authorized to join there.

Roi

-----Original Message-----
From: vdsm-patches-bounces at lists.fedorahosted.org [mailto:vdsm-patches-bounces at lists.fedorahosted.org] On Behalf Of Dan Kenigsberg
Sent: Saturday, December 10, 2011 11:54 AM
To: VDSM Project Patches
Cc: Itzik Brown
Subject: Re: [PATCH] iscsi.py: fixed discovery issue and added support for iSER transport

On Thu, Dec 08, 2011 at 12:41:10PM +0200, Roi Dayan wrote:
> Fixed discovery of targets not to overwrite settings of already 
> connected targets.
> Added support for iSER transport.

Roi, what is the difference from your previous patch?
Have you addressed all the former comments? It seems that at least two (race between setting node transport to using it, trying iser on hosts that did not opt for it) are just as problematic as in the former patch.

It would be easier for us to review your patch if you send it via gerrit.ovirt.org (see http://www.ovirt.org/wiki/Working_with_oVirt_Gerrit for
explanations)

Regards,
Dan.

> ---
>  vdsm/storage/iscsi.py |   44 +++++++++++++++++++++++++++++++++++++++-----
>  1 files changed, 39 insertions(+), 5 deletions(-)
> 
> diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py index 
> d2a5bdd..b5ccbd9 100644
> --- a/vdsm/storage/iscsi.py
> +++ b/vdsm/storage/iscsi.py
> @@ -34,7 +34,7 @@ import misc
>  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", "-o", "delete"]
>  ISCSIADM_NODE = [constants.EXT_ISCSIADM, "-m", "node"]  
> ISCSIADM_IFACE = [constants.EXT_ISCSIADM, "-m", "iface"]  
> ISCSI_DEFAULT_PORT = "3260"
> @@ -248,14 +248,26 @@ def addiSCSINode(ip, port, iqn, tpgt, initiator, username=None, password=None):
>              rc = misc.execCmd(cmd + [password], printable=cmd + ["******"])[0]
>              if rc != 0:
>                  raise se.SetiSCSIPasswdError(portal)
> +	
>  
>          # Finally instruct the iscsi initiator to login to the target
> +        # Since currently its not possible to choose transport from RHEV
> +        # we try iSER transport first since its faster and if it fails we
> +        # will try iSCSI tranport
> +        setNodeTransport(portal, iqn, 'iser')
>          cmd = cmdt + ["-l", "-p", portal]
>          rc = misc.execCmd(cmd)[0]
> -        if rc == ISCSI_ERR_LOGIN_AUTH_FAILED:
> -            raise se.iSCSILoginAuthError(portal)
> -        elif rc not in (0, ISCSI_ERR_SESS_EXISTS):
> -            raise se.iSCSILoginError(portal)
> +
> +    	if rc == ISCSI_ERR_LOGIN_AUTH_FAILED:
> +	        raise se.iSCSILoginAuthError(portal)
> +    	elif rc not in (0, ISCSI_ERR_SESS_EXISTS):
> +    	    setNodeTransport(portal, iqn, 'tcp')
> +    	    rc = misc.execCmd(cmd)[0]
> +
> +            if rc == ISCSI_ERR_LOGIN_AUTH_FAILED:
> +                raise se.iSCSILoginAuthError(portal)
> +            elif rc not in (0, ISCSI_ERR_SESS_EXISTS):
> +                raise se.iSCSILoginError(portal)
>  
>      except se.StorageException:
>          exc_class, exc, tb = sys.exc_info() @@ -329,6 +341,28 @@ def 
> getiScsiSession(dev):
>      session = os.path.basename(sessiondir)
>      return session
>  
> +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))
> +
> +    params = [
> +        ['node.conn[0].iscsi.HeaderDigest', 'None'],
> +        ['iface.transport_name', transport]
> +    ]
> +
> +    cmdt = [constants.EXT_ISCSIADM, '-m', 'node', '-o', 'update', '-p', portal, '-T', iqn]
> +    for param in params:
> +        cmd = cmdt + ['-n', param[0], '-v', param[1]]
> +        rc = misc.execCmd(cmd)[0]
> +        if rc not in (0, ISCSI_ERR_SESS_EXISTS):
> +            raise se.iSCSILoginError(portal)
> +
>  def getdeviSCSIinfo(dev):
>      """
>      Reports the iSCSI parameters of the given device 'dev'
> --
> 1.7.1
_______________________________________________
vdsm-patches mailing list
vdsm-patches at lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/vdsm-patches


More information about the vdsm-patches mailing list