'Connect the host and volume; return dict describing connection.'

@utils.retry(exception.PureRetryableException, retries=HOST_CREATE_MAX_RETRIES)
def _connect(self, volume, connector):

    iqn = connector['initiator']
    if self.configuration.use_chap_auth:
        (chap_username, chap_password) = self._get_chap_credentials(connector['host'], iqn)
    current_array = self._get_current_array()
    vol_name = self._get_vol_name(volume)
    host = self._get_host(current_array, connector)
    if host:
        host_name = host['name']
        LOG.info('Re-using    existing    purity    host    %(host_name)r', {'host_name': host_name})
        if self.configuration.use_chap_auth:
            if (not GENERATED_NAME.match(host_name)):
                LOG.error("Purity    host    %(host_name)s    is    not    managed    by    Cinder    and    can't    have    CHAP    credentials    modified.    Remove    IQN    %(iqn)s    from    the    host    to    resolve    this    issue.", {'host_name': host_name, 'iqn': connector['initiator']})
                raise exception.PureDriverException(reason=_('Unable    to    re-use    a    host    that    is    not    managed    by    Cinder    with    use_chap_auth=True,'))
            elif ((chap_username is None) or (chap_password is None)):
                LOG.error('Purity    host    %(host_name)s    is    managed    by    Cinder    but    CHAP    credentials    could    not    be    retrieved    from    the    Cinder    database.', {'host_name': host_name})
                raise exception.PureDriverException(reason=_('Unable    to    re-use    host    with    unknown    CHAP    credentials    configured.'))
    else:
        host_name = self._generate_purity_host_name(connector['host'])
        LOG.info('Creating    host    object    %(host_name)r    with    IQN:    %(iqn)s.', {'host_name': host_name, 'iqn': iqn})
        try:
            current_array.create_host(host_name, iqnlist=[iqn])
        except purestorage.PureHTTPError as err:
            if ((err.code == 400) and ((ERR_MSG_ALREADY_EXISTS in err.text) or (ERR_MSG_ALREADY_IN_USE in err.text))):
                LOG.debug('Unable    to    create    host:    %s', err.text)
                raise exception.PureRetryableException()
        if self.configuration.use_chap_auth:
            try:
                current_array.set_host(host_name, host_user=chap_username, host_password=chap_password)
            except purestorage.PureHTTPError as err:
                if ((err.code == 400) and (ERR_MSG_HOST_NOT_EXIST in err.text)):
                    LOG.debug('Unable    to    set    CHAP    info:    %s', err.text)
                    raise exception.PureRetryableException()
    connection = self._connect_host_to_vol(current_array, host_name, vol_name)
    if self.configuration.use_chap_auth:
        connection['auth_username'] = chap_username
        connection['auth_password'] = chap_password
    return connection
