@db_api.api_context_manager.writer
def _update_inventory(context, rp, inventory):
 _ensure_rc_cache(context)
 rc_id = _RC_CACHE.id_from_string(inventory.resource_class)
 inv_list = InventoryList(objects=[inventory])
 conn = context.session.connection()
 with conn.begin():
  exceeded = _update_inventory_for_provider(conn, rp, inv_list, set([rc_id]))
  rp.generation = _increment_provider_generation(conn, rp)
 return exceeded

@ db_api . api_context_manager . writer def _update_inventory ( context , rp , inventory ) : _ensure_rc_cache ( context ) rc_id = _RC_CACHE . id_from_string ( inventory . resource_class ) inv_list = InventoryList ( objects = [ inventory ] ) conn = context . session . connection ( ) with conn . begin ( ) : exceeded = _update_inventory_for_provider ( conn , rp , inv_list , set ( [ rc_id ] ) ) rp . generation = _increment_provider_generation ( conn , rp ) return exceeded
update an inventory already on the provider .