'Attach volume to initiator/host.
During this call VPSA exposes volume to particular Initiator. It also
creates a \'server\' entity for Initiator (if it was not created before)
All necessary connection information is returned, including auth data.
Connection data (target, LUN) is not stored in the DB.'

def initialize_connection(self, volume, connector):

    initiator_name = connector['initiator']
    vpsa_srv = self._create_vpsa_server(initiator_name)
    if (not vpsa_srv):
        raise exception.ZadaraServerCreateFailure(name=initiator_name)
    name = (self.configuration.zadara_vol_name_template % volume['name'])
    vpsa_vol = self._get_vpsa_volume_name(name)
    if (not vpsa_vol):
        raise exception.VolumeNotFound(volume_id=volume['id'])
    ctrl = self._get_active_controller_details()
    if (not ctrl):
        raise exception.ZadaraVPSANoActiveController()
    xml_tree = self.vpsa.send_cmd('list_vol_attachments', vpsa_vol=vpsa_vol)
    attach = self._xml_parse_helper(xml_tree, 'servers', ('name', vpsa_srv))
    if (attach is None):
        self.vpsa.send_cmd('attach_volume', vpsa_srv=vpsa_srv, vpsa_vol=vpsa_vol)
    xml_tree = self.vpsa.send_cmd('list_vol_attachments', vpsa_vol=vpsa_vol)
    server = self._xml_parse_helper(xml_tree, 'servers', ('iqn', initiator_name))
    if (server is None):
        raise exception.ZadaraAttachmentsNotFound(name=name)
    target = server.findtext('target')
    lun = int(server.findtext('lun'))
    if ((target is None) or (lun is None)):
        raise exception.ZadaraInvalidAttachmentInfo(name=name, reason=(_('target=%(target)s,    lun=%(lun)s') % {'target': target, 'lun': lun}))
    properties = {}
    properties['target_discovered'] = False
    properties['target_portal'] = ('%s:%s' % (ctrl['ip'], '3260'))
    properties['target_iqn'] = target
    properties['target_lun'] = lun
    properties['volume_id'] = volume['id']
    properties['auth_method'] = 'CHAP'
    properties['auth_username'] = ctrl['chap_user']
    properties['auth_password'] = ctrl['chap_passwd']
    LOG.debug('Attach    properties:    %(properties)s', {'properties': properties})
    return {'driver_volume_type': ('iser' if self.configuration.safe_get('zadara_use_iser') else 'iscsi'), 'data': properties}
