def create_router(self, context, router): r = router['router'] flavor = r.get(FLAVOR_ROUTER) if not str(flavor) in self.l3_plugins: flavor = self.default_l3_flavor plugin = self._get_l3_plugin(flavor) with context.session.begin(subtransactions=True): r_in_db = plugin.create_router(context, router) LOG.debug("Created router: %s with flavor %s " % (r_in_db['id'], flavor)) meta_db_v2.add_router_flavor_binding(context.session, flavor, str(r_in_db['id'])) LOG.debug("Created router: %s" % r_in_db['id']) self._extend_router_dict(context, r_in_db) return r_in_db
def create_router(self, context, router): r = router["router"] flavor = r.get(FLAVOR_ROUTER) if not str(flavor) in self.l3_plugins: flavor = self.default_l3_flavor plugin = self._get_l3_plugin(flavor) with context.session.begin(subtransactions=True): r_in_db = plugin.create_router(context, router) LOG.debug( _("Created router: %(router_id)s with flavor " "%(flavor)s"), {"router_id": r_in_db["id"], "flavor": flavor}, ) meta_db_v2.add_router_flavor_binding(context.session, flavor, str(r_in_db["id"])) LOG.debug(_("Created router: %s"), r_in_db["id"]) self._extend_router_dict(context, r_in_db) return r_in_db
def create_router(self, context, router): r = router['router'] flavor = r.get(FLAVOR_ROUTER) if not str(flavor) in self.l3_plugins: flavor = self.default_l3_flavor plugin = self._get_l3_plugin(flavor) r_in_db = plugin.create_router(context, router) LOG.debug("Created router: %s with flavor %s " % (r_in_db['id'], flavor)) try: meta_db_v2.add_router_flavor_binding(flavor, str(r_in_db['id'])) except: LOG.exception('failed to add flavor bindings') plugin.delete_router(context, r_in_db['id']) raise FaildToAddFlavorBinding() LOG.debug("Created router: %s" % r_in_db['id']) self._extend_router_dict(context, r_in_db) return r_in_db