'Helper method that retrieves the current inventory for the supplied
resource provider according to the placement API. If the cached
generation of the resource provider is not the same as the generation
returned from the placement API, we update the cached generation.'

def _get_inventory_and_update_provider_generation(self, rp_uuid):

    curr = self._get_inventory(rp_uuid)
    server_gen = curr.get('resource_provider_generation')
    if server_gen:
        my_rp = self._resource_providers[rp_uuid]
        if (server_gen != my_rp['generation']):
            LOG.debug('Updating    our    resource    provider    generation    from    %(old)i    to    %(new)i', {'old': my_rp['generation'], 'new': server_gen})
        my_rp['generation'] = server_gen
    return curr
