def create_router(self, context, router): """Create a new router entry on DB, and create it on OFC.""" LOG.debug(_("RouterMixin.create_router() called, " "router=%s ."), router) tenant_id = self._get_tenant_id_for_create(context, router['router']) provider = get_provider_with_default(router['router'].get( ext_provider.ROUTER_PROVIDER)) driver = get_driver_by_provider(provider) with context.session.begin(subtransactions=True): new_router = super(RouterMixin, self).create_router(context, router) new_router['gw_port'] = self._get_gw_port_detail( context, driver, new_router['gw_port_id']) rdb.add_router_provider_binding(context.session, provider, str(new_router['id'])) self._extend_router_dict_provider(new_router, provider) # create router on the network controller try: return driver.create_router(context, tenant_id, new_router) except nexc.RouterOverLimit: with excutils.save_and_reraise_exception(): super(RouterMixin, self).delete_router(context, new_router['id'])
def create_router(self, context, router): """Create a new router entry on DB, and create it on OFC.""" LOG.debug(_("RouterMixin.create_router() called, " "router=%s ."), router) tenant_id = self._get_tenant_id_for_create(context, router['router']) provider = get_provider_with_default( router['router'].get(ext_provider.ROUTER_PROVIDER)) driver = get_driver_by_provider(provider) with context.session.begin(subtransactions=True): new_router = super(RouterMixin, self).create_router(context, router) new_router['gw_port'] = self._get_gw_port_detail( context, driver, new_router['gw_port_id']) rdb.add_router_provider_binding(context.session, provider, str(new_router['id'])) self._extend_router_dict_provider(new_router, provider) # create router on the network controller try: return driver.create_router(context, tenant_id, new_router) except nexc.RouterOverLimit: with excutils.save_and_reraise_exception(): super(RouterMixin, self).delete_router(context, new_router['id'])