def _ml2_md_extend_subnet_dict_bulk(results, _): subnetdb = results[0][1] if results else None plugin = directory.get_plugin() session = db_api.get_session_from_obj(subnetdb) if not session: session = db_api.get_writer_session() with session.begin(subtransactions=True): plugin.extension_manager.extend_subnet_dict_bulk(session, results)
def _ml2_md_extend_port_dict(result, portdb): plugin = directory.get_plugin() session = db_api.get_session_from_obj(portdb) if not session: session = db_api.get_writer_session() # REVISIT: Check if transaction begin is still # required here, and if so, if reader pattern # can be used instead (will require getting the # current context, which should be available in # the session.info's dictionary, with a key of # 'using_context'). with session.begin(subtransactions=True): plugin.extension_manager.extend_port_dict(session, portdb, result)
def _extend_router_dict_apic(router_res, router_db): if router_res.get(api_plus.BULK_EXTENDED): return LOG.debug("APIC AIM L3 Plugin extending router dict: %s", router_res) plugin = directory.get_plugin(constants.L3) session = db_api.get_session_from_obj(router_db) if not session: session = db_api.get_writer_session() try: plugin._md.extend_router_dict(session, router_db, router_res) plugin._include_router_extn_attr(session, router_res) except Exception: with excutils.save_and_reraise_exception(): LOG.exception("APIC AIM extend_router_dict failed")
def _extend_router_dict_bulk_apic(routers, _): LOG.debug("APIC AIM L3 Plugin bulk extending router dict: %s", routers) if not routers: return router_db = routers[0] plugin = directory.get_plugin(constants.L3) session = db_api.get_session_from_obj(router_db) if not session: session = db_api.get_writer_session() try: plugin._md.extend_router_dict_bulk(session, routers) plugin._include_router_extn_attr_bulk(session, routers) except Exception: with excutils.save_and_reraise_exception(): LOG.exception("APIC AIM _extend_router_dict_bulk failed")