def create_router(self, context, router):
        r = router['router']
        flavor = r.get(FLAVOR_ROUTER)
        if str(flavor) not 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 str(flavor) not 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: %(router_id)s with flavor " "%(flavor)s"), {"router_id": r_in_db["id"], "flavor": flavor}
        )
        try:
            meta_db_v2.add_router_flavor_binding(context.session, flavor, str(r_in_db["id"]))
        except Exception:
            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
    def create_router(self, context, router):
        r = router['router']
        flavor = r.get(ext_flavor.FLAVOR_ROUTER)
        if str(flavor) not 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: %(router_id)s with flavor "
                  "%(flavor)s",
                  {'router_id': r_in_db['id'], 'flavor': flavor})
        try:
            meta_db_v2.add_router_flavor_binding(context.session,
                                                 flavor, str(r_in_db['id']))
        except Exception:
            LOG.exception(_LE('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
Beispiel #4
0
    def create_router(self, context, router):
        r = router['router']
        flavor = r.get(ext_flavor.FLAVOR_ROUTER)
        if str(flavor) not 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: %(router_id)s with flavor "
                    "%(flavor)s"),
                  {'router_id': r_in_db['id'], 'flavor': flavor})
        try:
            meta_db_v2.add_router_flavor_binding(context.session,
                                                 flavor, str(r_in_db['id']))
        except Exception:
            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