'Restrict access to a volume.'

def initialize_connection(self, volume, connector):

    try:
        cmd = ['volume', 'select', volume['name'], 'access', 'create', 'initiator', connector['initiator']]
        if self.configuration.use_chap_auth:
            cmd.extend(['authmethod', 'chap', 'username', self.configuration.chap_username])
        self._eql_execute(*cmd)
        iscsi_properties = self._get_iscsi_properties(volume)
        iscsi_properties['discard'] = True
        return {'driver_volume_type': 'iscsi', 'data': iscsi_properties}
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.error('Failed    to    initialize    connection    to    volume    "%s".', volume['name'])
