コード例 #1
0
ファイル: ofswitch.py プロジェクト: openstack/neutron
 def _send_msg(self, msg, reply_cls=None, reply_multi=False,
               active_bundle=None):
     timeout_sec = cfg.CONF.OVS.of_request_timeout
     timeout = eventlet.Timeout(seconds=timeout_sec)
     if active_bundle is not None:
         (dp, ofp, ofpp) = self._get_dp()
         msg = ofpp.ONFBundleAddMsg(dp, active_bundle['id'],
                                    active_bundle['bundle_flags'], msg, [])
     try:
         result = ofctl_api.send_msg(self._app, msg, reply_cls, reply_multi)
     except os_ken_exc.OSKenException as e:
         m = _("ofctl request %(request)s error %(error)s") % {
             "request": msg,
             "error": e,
         }
         LOG.error(m)
         # NOTE(yamamoto): use RuntimeError for compat with ovs_lib
         raise RuntimeError(m)
     except eventlet.Timeout as e:
         with excutils.save_and_reraise_exception() as ctx:
             if e is timeout:
                 ctx.reraise = False
                 m = _("ofctl request %(request)s timed out") % {
                     "request": msg,
                 }
                 LOG.error(m)
                 # NOTE(yamamoto): use RuntimeError for compat with ovs_lib
                 raise RuntimeError(m)
     finally:
         timeout.cancel()
     LOG.debug("ofctl request %(request)s result %(result)s",
               {"request": msg, "result": result})
     return result
コード例 #2
0
 def _send_msg(self, msg, reply_cls=None, reply_multi=False,
               active_bundle=None):
     timeout_sec = cfg.CONF.OVS.of_request_timeout
     timeout = eventlet.Timeout(seconds=timeout_sec)
     if active_bundle is not None:
         (dp, ofp, ofpp) = self._get_dp()
         msg = ofpp.ONFBundleAddMsg(dp, active_bundle['id'],
                                    active_bundle['bundle_flags'], msg, [])
     try:
         result = ofctl_api.send_msg(self._app, msg, reply_cls, reply_multi)
     except os_ken_exc.OSKenException as e:
         m = _("ofctl request %(request)s error %(error)s") % {
             "request": msg,
             "error": e,
         }
         LOG.error(m)
         # NOTE(yamamoto): use RuntimeError for compat with ovs_lib
         raise RuntimeError(m)
     except eventlet.Timeout as e:
         with excutils.save_and_reraise_exception() as ctx:
             if e is timeout:
                 ctx.reraise = False
                 m = _("ofctl request %(request)s timed out") % {
                     "request": msg,
                 }
                 LOG.error(m)
                 # NOTE(yamamoto): use RuntimeError for compat with ovs_lib
                 raise RuntimeError(m)
     finally:
         timeout.cancel()
     LOG.debug("ofctl request %(request)s result %(result)s",
               {"request": msg, "result": result})
     return result