'Creates allocation records for the supplied instance UUID against
the supplied resource provider.
:note Currently we only allocate against a single resource provider.
Once shared storage and things like NUMA allocations are a
reality, this will change to allocate against multiple providers.
:param rp_uuid: The UUID of the resource provider to allocate against.
:param consumer_uuid: The instance\'s UUID.
:param alloc_data: Dict, keyed by resource class, of amounts to
consume.
:param project_id: The project_id associated with the allocations.
:param user_id: The user_id associated with the allocations.
:returns: True if the allocations were created, False otherwise.'

@safe_connect
def put_allocations(self, rp_uuid, consumer_uuid, alloc_data, project_id, user_id):

    payload = {'allocations': [{'resource_provider': {'uuid': rp_uuid}, 'resources': alloc_data}], 'project_id': project_id, 'user_id': user_id}
    url = ('/allocations/%s' % consumer_uuid)
    r = self.put(url, payload, version='1.8')
    if (r.status_code == 406):
        payload.pop('project_id')
        payload.pop('user_id')
        r = self.put(url, payload)
    if (r.status_code != 204):
        LOG.warning('Unable    to    submit    allocation    for    instance    %(uuid)s    (%(code)i    %(text)s)', {'uuid': consumer_uuid, 'code': r.status_code, 'text': r.text})
    return (r.status_code == 204)
