'Check whether the initiator is associated to the host.'

def is_initiator_associated_to_host(self, ininame, host_id):

    url = '/iscsi_initiator?range=[0-256]'
    result = self.call(url, None, 'GET')
    self._assert_rest_result(result, _('Check    initiator    associated    to    host    error.'))
    for item in result.get('data'):
        if (item['ID'] == ininame):
            if (item['ISFREE'] == 'true'):
                return False
            if (item['PARENTID'] == host_id):
                return True
            else:
                msg = (_('Initiator    %(ini)s    has    been    added    to    another    host    %(host)s.') % {'ini': ininame, 'host': item['PARENTNAME']})
                LOG.error(msg)
                raise exception.VolumeBackendAPIException(data=msg)
    return True
