示例#1
0
 def create_router(self, context, router):
     LOG.debug("create_router: router=%s" % (router))
     # Limit one router per tenant
     if not router.get('router', None):
         return
     tenant_id = router['router']['tenant_id']
     with context.session.begin(subtransactions=True):
         try:
             namespace = utils.add_vdom(self, context, tenant_id=tenant_id)
             utils.add_vlink(self, context, namespace.vdom)
         except Exception as e:
             LOG.error("Failed to create_router router=%(router)s",
                       {"router": router})
             resources.Exinfo(e)
             utils.rollback_on_err(self, context, e)
     utils.update_status(self, context, t_consts.TaskStatus.COMPLETED)
示例#2
0
 def create_router(self, context, router):
     LOG.debug("create_router: router=%s" % (router))
     # Limit one router per tenant
     if not router.get('router', None):
         return
     tenant_id = router['router']['tenant_id']
     with context.session.begin(subtransactions=True):
         try:
             namespace = utils.add_vdom(self, context, tenant_id=tenant_id)
             utils.add_vlink(self, context, namespace.vdom)
         except Exception as e:
             LOG.error("Failed to create_router router=%(router)s",
                       {"router": router})
             resources.Exinfo(e)
             utils._rollback_on_err(self, context, e)
     utils.update_status(self, context, t_consts.TaskStatus.COMPLETED)
 def create_router(self, context, router):
     LOG.debug("create_router: router=%s", router)
     # Limit one router per tenant
     if not router.get('router', None):
         return
     tenant_id = router['router']['tenant_id']
     if fortinet_db.query_count(context, l3_db.Router,
                                tenant_id=tenant_id):
         raise Exception(_("FortinetL3ServicePlugin:create_router "
                           "Only support one router per tenant"))
     with context.session.begin(subtransactions=True):
         try:
             namespace = utils.add_vdom(self, context, tenant_id=tenant_id)
             utils.add_vlink(self, context, namespace.vdom)
         except Exception as e:
             with excutils.save_and_reraise_exception():
                 LOG.error(_LE("Failed to create_router router=%(router)s"),
                           {"router": router})
                 utils._rollback_on_err(self, context, e)
     utils.update_status(self, context, t_consts.TaskStatus.COMPLETED)
     return super(FortinetL3ServicePlugin, self).\
         create_router(context, router)
 def create_router(self, context, router):
     LOG.debug("create_router: router=%s", router)
     # Limit one router per tenant
     if not router.get('router', None):
         return
     tenant_id = router['router']['tenant_id']
     if fortinet_db.query_count(context, l3_db.Router, tenant_id=tenant_id):
         raise Exception(
             _("FortinetL3ServicePlugin:create_router "
               "Only support one router per tenant"))
     with context.session.begin(subtransactions=True):
         try:
             namespace = utils.add_vdom(self, context, tenant_id=tenant_id)
             utils.add_vlink(self, context, namespace.vdom)
         except Exception as e:
             with excutils.save_and_reraise_exception():
                 LOG.error(_LE("Failed to create_router router=%(router)s"),
                           {"router": router})
                 utils._rollback_on_err(self, context, e)
     utils.update_status(self, context, t_consts.TaskStatus.COMPLETED)
     return super(FortinetL3ServicePlugin, self).\
         create_router(context, router)