'Use CHAP when adding initiator to host.'

def _use_chap(self, chapinfo, initiator_name, host_id):

    (chap_username, chap_password) = chapinfo.split(';')
    url = ('/iscsi_initiator/' + initiator_name)
    data = {'TYPE': '222', 'USECHAP': 'true', 'CHAPNAME': chap_username, 'CHAPPASSWORD': chap_password, 'ID': initiator_name, 'PARENTTYPE': '21', 'PARENTID': host_id}
    result = self.call(url, data, 'PUT', log_filter_flag=True)
    msg = _('Use    CHAP    to    associate    initiator    to    host    error.    Please    check    the    CHAP    username    and    password.')
    self._assert_rest_result(result, msg)
