'Trigger a \'no valid host\' situation to generate a message.'

def _create_user_message(self):

    bad_protocol = data_utils.rand_name('storage_protocol')
    bad_vendor = data_utils.rand_name('vendor_name')
    extra_specs = {'storage_protocol': bad_protocol, 'vendor_name': bad_vendor}
    vol_type_name = data_utils.rand_name((self.__class__.__name__ + '-volume-type'))
    bogus_type = self.create_volume_type(name=vol_type_name, extra_specs=extra_specs)
    params = {'volume_type': bogus_type['id'], 'size': CONF.volume.volume_size}
    volume = self.create_volume(wait_until='error', **params)
    messages = self.messages_client.list_messages()['messages']
    message_id = None
    for message in messages:
        if (message['resource_uuid'] == volume['id']):
            message_id = message['id']
            break
    self.assertIsNotNone(message_id, ('No    user    message    generated    for    volume    %s' % volume['id']))
    return message_id
