'Generate and store a randomly-generated CHAP secret for the host.'

def get_chap_secret_for_host(self, host_name):

    resp = self.ssh.lsiscsiauth()
    host_found = False
    for host_data in resp:
        try:
            if (host_data['name'] == host_name):
                host_found = True
                if (host_data['iscsi_auth_method'] == 'chap'):
                    return host_data['iscsi_chap_secret']
        except KeyError:
            self.handle_keyerror('lsiscsiauth', host_data)
    if (not host_found):
        msg = (_('Failed    to    find    host    %s.') % host_name)
        raise exception.VolumeBackendAPIException(data=msg)
    return None
