Merge "Correct i18n message"
This commit is contained in:
commit
29f1211269
@ -111,8 +111,8 @@ class L3NATAgent(object):
|
|||||||
self.driver = importutils.import_object(conf.interface_driver,
|
self.driver = importutils.import_object(conf.interface_driver,
|
||||||
conf)
|
conf)
|
||||||
except:
|
except:
|
||||||
LOG.exception(_("Error importing interface driver '%s'"
|
LOG.exception(_("Error importing interface driver '%s'"),
|
||||||
% conf.interface_driver))
|
conf.interface_driver)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
self.polling_interval = conf.polling_interval
|
self.polling_interval = conf.polling_interval
|
||||||
@ -139,7 +139,7 @@ class L3NATAgent(object):
|
|||||||
try:
|
try:
|
||||||
self._destroy_router_namespace(ns)
|
self._destroy_router_namespace(ns)
|
||||||
except:
|
except:
|
||||||
LOG.exception("couldn't delete namespace '%s'" % ns)
|
LOG.exception(_("Couldn't delete namespace '%s'"), ns)
|
||||||
|
|
||||||
def _destroy_router_namespace(self, namespace):
|
def _destroy_router_namespace(self, namespace):
|
||||||
ns_ip = ip_lib.IPWrapper(self.conf.root_helper,
|
ns_ip = ip_lib.IPWrapper(self.conf.root_helper,
|
||||||
@ -170,7 +170,7 @@ class L3NATAgent(object):
|
|||||||
try:
|
try:
|
||||||
self.do_single_loop()
|
self.do_single_loop()
|
||||||
except:
|
except:
|
||||||
LOG.exception("Error running l3_nat daemon_loop")
|
LOG.exception(_("Error running l3_nat daemon_loop"))
|
||||||
|
|
||||||
time.sleep(self.polling_interval)
|
time.sleep(self.polling_interval)
|
||||||
|
|
||||||
@ -182,8 +182,9 @@ class L3NATAgent(object):
|
|||||||
params = {'router:external': True}
|
params = {'router:external': True}
|
||||||
ex_nets = self.qclient.list_networks(**params)['networks']
|
ex_nets = self.qclient.list_networks(**params)['networks']
|
||||||
if len(ex_nets) > 1:
|
if len(ex_nets) > 1:
|
||||||
raise Exception("must configure 'gateway_external_network_id' if "
|
raise Exception(_("Must configure 'gateway_external_network_id' "
|
||||||
"Quantum has more than one external network.")
|
"if Quantum has more than one external "
|
||||||
|
"network."))
|
||||||
if len(ex_nets) == 0:
|
if len(ex_nets) == 0:
|
||||||
return None
|
return None
|
||||||
return ex_nets[0]['id']
|
return ex_nets[0]['id']
|
||||||
@ -192,8 +193,8 @@ class L3NATAgent(object):
|
|||||||
|
|
||||||
if (self.conf.external_network_bridge and
|
if (self.conf.external_network_bridge and
|
||||||
not ip_lib.device_exists(self.conf.external_network_bridge)):
|
not ip_lib.device_exists(self.conf.external_network_bridge)):
|
||||||
LOG.error("external network bridge '%s' does not exist"
|
LOG.error(_("External network bridge '%s' does not exist"),
|
||||||
% self.conf.external_network_bridge)
|
self.conf.external_network_bridge)
|
||||||
return
|
return
|
||||||
|
|
||||||
prev_router_ids = set(self.router_info)
|
prev_router_ids = set(self.router_info)
|
||||||
@ -257,9 +258,9 @@ class L3NATAgent(object):
|
|||||||
def _set_subnet_info(self, port):
|
def _set_subnet_info(self, port):
|
||||||
ips = port['fixed_ips']
|
ips = port['fixed_ips']
|
||||||
if not ips:
|
if not ips:
|
||||||
raise Exception("Router port %s has no IP address" % port['id'])
|
raise Exception(_("Router port %s has no IP address") % port['id'])
|
||||||
if len(ips) > 1:
|
if len(ips) > 1:
|
||||||
LOG.error("Ignoring multiple IPs on router port %s" % port['id'])
|
LOG.error(_("Ignoring multiple IPs on router port %s"), port['id'])
|
||||||
port['subnet'] = self.qclient.show_subnet(
|
port['subnet'] = self.qclient.show_subnet(
|
||||||
ips[0]['subnet_id'])['subnet']
|
ips[0]['subnet_id'])['subnet']
|
||||||
prefixlen = netaddr.IPNetwork(port['subnet']['cidr']).prefixlen
|
prefixlen = netaddr.IPNetwork(port['subnet']['cidr']).prefixlen
|
||||||
@ -356,8 +357,8 @@ class L3NATAgent(object):
|
|||||||
elif len(ports) == 1:
|
elif len(ports) == 1:
|
||||||
return ports[0]
|
return ports[0]
|
||||||
else:
|
else:
|
||||||
LOG.error("Ignoring multiple gateway ports for router %s"
|
LOG.error(_("Ignoring multiple gateway ports for router %s"),
|
||||||
% ri.router_id)
|
ri.router_id)
|
||||||
|
|
||||||
def _send_gratuitous_arp_packet(self, ri, interface_name, ip_address):
|
def _send_gratuitous_arp_packet(self, ri, interface_name, ip_address):
|
||||||
if self.conf.send_arp_for_ha > 0:
|
if self.conf.send_arp_for_ha > 0:
|
||||||
|
@ -288,6 +288,6 @@ class MetaInterfaceDriver(LinuxInterfaceDriver):
|
|||||||
return driver.unplug(device_name, bridge, namespace, prefix)
|
return driver.unplug(device_name, bridge, namespace, prefix)
|
||||||
|
|
||||||
def _load_driver(self, driver_provider):
|
def _load_driver(self, driver_provider):
|
||||||
LOG.debug("Driver location:%s", driver_provider)
|
LOG.debug(_("Driver location: %s"), driver_provider)
|
||||||
plugin_klass = importutils.import_class(driver_provider)
|
plugin_klass = importutils.import_class(driver_provider)
|
||||||
return plugin_klass(self.conf)
|
return plugin_klass(self.conf)
|
||||||
|
@ -62,7 +62,8 @@ class OVSBridge:
|
|||||||
try:
|
try:
|
||||||
return utils.execute(full_args, root_helper=self.root_helper)
|
return utils.execute(full_args, root_helper=self.root_helper)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
LOG.error("Unable to execute %s. Exception: %s", full_args, e)
|
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||||
|
{'cmd': full_args, 'exception': e})
|
||||||
|
|
||||||
def reset_bridge(self):
|
def reset_bridge(self):
|
||||||
self.run_vsctl(["--", "--if-exists", "del-br", self.br_name])
|
self.run_vsctl(["--", "--if-exists", "del-br", self.br_name])
|
||||||
@ -90,7 +91,8 @@ class OVSBridge:
|
|||||||
try:
|
try:
|
||||||
return utils.execute(full_args, root_helper=self.root_helper)
|
return utils.execute(full_args, root_helper=self.root_helper)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
LOG.error("Unable to execute %s. Exception: %s", full_args, e)
|
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||||
|
{'cmd': full_args, 'exception': e})
|
||||||
|
|
||||||
def count_flows(self):
|
def count_flows(self):
|
||||||
flow_list = self.run_ofctl("dump-flows", []).split("\n")[1:]
|
flow_list = self.run_ofctl("dump-flows", []).split("\n")[1:]
|
||||||
@ -116,7 +118,7 @@ class OVSBridge:
|
|||||||
kwargs.get('priority', '1')))
|
kwargs.get('priority', '1')))
|
||||||
flow_expr_arr.append(prefix)
|
flow_expr_arr.append(prefix)
|
||||||
elif 'priority' in kwargs:
|
elif 'priority' in kwargs:
|
||||||
raise Exception("Cannot match priority on flow deletion")
|
raise Exception(_("Cannot match priority on flow deletion"))
|
||||||
|
|
||||||
in_port = ('in_port' in kwargs and ",in_port=%s" %
|
in_port = ('in_port' in kwargs and ",in_port=%s" %
|
||||||
kwargs['in_port'] or '')
|
kwargs['in_port'] or '')
|
||||||
@ -140,7 +142,7 @@ class OVSBridge:
|
|||||||
|
|
||||||
def add_flow(self, **kwargs):
|
def add_flow(self, **kwargs):
|
||||||
if "actions" not in kwargs:
|
if "actions" not in kwargs:
|
||||||
raise Exception("must specify one or more actions")
|
raise Exception(_("Must specify one or more actions"))
|
||||||
if "priority" not in kwargs:
|
if "priority" not in kwargs:
|
||||||
kwargs["priority"] = "0"
|
kwargs["priority"] = "0"
|
||||||
|
|
||||||
@ -211,7 +213,8 @@ class OVSBridge:
|
|||||||
try:
|
try:
|
||||||
return utils.execute(args, root_helper=self.root_helper).strip()
|
return utils.execute(args, root_helper=self.root_helper).strip()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
LOG.error("Unable to execute %s. Exception: %s", args, e)
|
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||||
|
{'cmd': args, 'exception': e})
|
||||||
|
|
||||||
# returns a VIF object for each VIF port
|
# returns a VIF object for each VIF port
|
||||||
def get_vif_ports(self):
|
def get_vif_ports(self):
|
||||||
@ -265,7 +268,7 @@ class OVSBridge:
|
|||||||
ofport = int(match.group('ofport'))
|
ofport = int(match.group('ofport'))
|
||||||
return VifPort(port_name, ofport, vif_id, vif_mac, self)
|
return VifPort(port_name, ofport, vif_id, vif_mac, self)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
LOG.info("Unable to parse regex results. Exception: %s", e)
|
LOG.info(_("Unable to parse regex results. Exception: %s"), e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ def execute(cmd, root_helper=None, process_input=None, addl_env=None,
|
|||||||
cmd = shlex.split(root_helper) + cmd
|
cmd = shlex.split(root_helper) + cmd
|
||||||
cmd = map(str, cmd)
|
cmd = map(str, cmd)
|
||||||
|
|
||||||
LOG.debug("Running command: " + " ".join(cmd))
|
LOG.debug(_("Running command: %s"), cmd)
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if addl_env:
|
if addl_env:
|
||||||
env.update(addl_env)
|
env.update(addl_env)
|
||||||
@ -52,8 +52,9 @@ def execute(cmd, root_helper=None, process_input=None, addl_env=None,
|
|||||||
obj.communicate(process_input) or
|
obj.communicate(process_input) or
|
||||||
obj.communicate())
|
obj.communicate())
|
||||||
obj.stdin.close()
|
obj.stdin.close()
|
||||||
m = ("\nCommand: %s\nExit code: %s\nStdout: %r\nStderr: %r" %
|
m = _("\nCommand: %(cmd)s\nExit code: %(code)s\nStdout: %(stdout)r\n"
|
||||||
(cmd, obj.returncode, _stdout, _stderr))
|
"Stderr: %(stderr)r") % {'cmd': cmd, 'code': obj.returncode,
|
||||||
|
'stdout': _stdout, 'stderr': _stderr}
|
||||||
LOG.debug(m)
|
LOG.debug(m)
|
||||||
if obj.returncode and check_exit_code:
|
if obj.returncode and check_exit_code:
|
||||||
raise RuntimeError(m)
|
raise RuntimeError(m)
|
||||||
|
@ -83,7 +83,7 @@ def setup_logging(conf):
|
|||||||
logging.setup(product_name)
|
logging.setup(product_name)
|
||||||
log_root = logging.getLogger(product_name).logger
|
log_root = logging.getLogger(product_name).logger
|
||||||
log_root.propagate = 0
|
log_root.propagate = 0
|
||||||
LOG.info("Logging enabled!")
|
LOG.info(_("Logging enabled!"))
|
||||||
|
|
||||||
|
|
||||||
def load_paste_app(app_name):
|
def load_paste_app(app_name):
|
||||||
@ -97,7 +97,7 @@ def load_paste_app(app_name):
|
|||||||
|
|
||||||
config_path = os.path.abspath(cfg.CONF.find_file(
|
config_path = os.path.abspath(cfg.CONF.find_file(
|
||||||
cfg.CONF.api_paste_config))
|
cfg.CONF.api_paste_config))
|
||||||
LOG.info("Config paste file: %s", config_path)
|
LOG.info(_("Config paste file: %s"), config_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
app = deploy.loadapp("config:%s" % config_path, name=app_name)
|
app = deploy.loadapp("config:%s" % config_path, name=app_name)
|
||||||
|
@ -47,16 +47,16 @@ class QuantumManager(object):
|
|||||||
# intentianally to allow v2 plugins to be monitored
|
# intentianally to allow v2 plugins to be monitored
|
||||||
# for performance metrics.
|
# for performance metrics.
|
||||||
plugin_provider = cfg.CONF.core_plugin
|
plugin_provider = cfg.CONF.core_plugin
|
||||||
LOG.debug("Plugin location:%s", plugin_provider)
|
LOG.debug(_("Plugin location: %s"), plugin_provider)
|
||||||
# If the plugin can't be found let them know gracefully
|
# If the plugin can't be found let them know gracefully
|
||||||
try:
|
try:
|
||||||
LOG.info("Loading Plugin: %s" % plugin_provider)
|
LOG.info(_("Loading Plugin: %s"), plugin_provider)
|
||||||
plugin_klass = importutils.import_class(plugin_provider)
|
plugin_klass = importutils.import_class(plugin_provider)
|
||||||
except ClassNotFound:
|
except ClassNotFound:
|
||||||
LOG.exception("Error loading plugin")
|
LOG.exception(_("Error loading plugin"))
|
||||||
raise Exception("Plugin not found. You can install a "
|
raise Exception(_("Plugin not found. You can install a "
|
||||||
"plugin with: pip install <plugin-name>\n"
|
"plugin with: pip install <plugin-name>\n"
|
||||||
"Example: pip install quantum-sample-plugin")
|
"Example: pip install quantum-sample-plugin"))
|
||||||
self.plugin = plugin_klass()
|
self.plugin = plugin_klass()
|
||||||
|
|
||||||
# core plugin as a part of plugin collection simplifies
|
# core plugin as a part of plugin collection simplifies
|
||||||
@ -68,12 +68,12 @@ class QuantumManager(object):
|
|||||||
|
|
||||||
def _load_service_plugins(self):
|
def _load_service_plugins(self):
|
||||||
plugin_providers = cfg.CONF.service_plugins
|
plugin_providers = cfg.CONF.service_plugins
|
||||||
LOG.debug(_("Loading service plugins: %s" % plugin_providers))
|
LOG.debug(_("Loading service plugins: %s"), plugin_providers)
|
||||||
for provider in plugin_providers:
|
for provider in plugin_providers:
|
||||||
if provider == '':
|
if provider == '':
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
LOG.info(_("Loading Plugin: %s" % provider))
|
LOG.info(_("Loading Plugin: %s"), provider)
|
||||||
plugin_class = importutils.import_class(provider)
|
plugin_class = importutils.import_class(provider)
|
||||||
except ClassNotFound:
|
except ClassNotFound:
|
||||||
LOG.exception(_("Error loading plugin"))
|
LOG.exception(_("Error loading plugin"))
|
||||||
@ -85,8 +85,8 @@ class QuantumManager(object):
|
|||||||
# for the same type is a fatal exception
|
# for the same type is a fatal exception
|
||||||
if plugin_inst.get_plugin_type() in self.service_plugins:
|
if plugin_inst.get_plugin_type() in self.service_plugins:
|
||||||
raise Exception(_("Multiple plugins for service "
|
raise Exception(_("Multiple plugins for service "
|
||||||
"%s were configured" %
|
"%s were configured"),
|
||||||
plugin_inst.get_plugin_type()))
|
plugin_inst.get_plugin_type())
|
||||||
|
|
||||||
self.service_plugins[plugin_inst.get_plugin_type()] = plugin_inst
|
self.service_plugins[plugin_inst.get_plugin_type()] = plugin_inst
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ def serve_wsgi(cls):
|
|||||||
try:
|
try:
|
||||||
service = cls.create()
|
service = cls.create()
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception('in WsgiService.create()')
|
LOG.exception(_('In WsgiService.create()'))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
service.start()
|
service.start()
|
||||||
@ -87,7 +87,7 @@ def _run_wsgi(app_name):
|
|||||||
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host)
|
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host)
|
||||||
# Dump all option values here after all options are parsed
|
# Dump all option values here after all options are parsed
|
||||||
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
||||||
LOG.info("Quantum service started, listening on %(host)s:%(port)s" %
|
LOG.info(_("Quantum service started, listening on %(host)s:%(port)s"),
|
||||||
{'host': cfg.CONF.bind_host,
|
{'host': cfg.CONF.bind_host,
|
||||||
'port': cfg.CONF.bind_port})
|
'port': cfg.CONF.bind_port})
|
||||||
return server
|
return server
|
||||||
|
@ -754,19 +754,19 @@ class Resource(Application):
|
|||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
"""WSGI method that controls (de)serialization and method dispatch."""
|
"""WSGI method that controls (de)serialization and method dispatch."""
|
||||||
|
|
||||||
LOG.info("%(method)s %(url)s" % {"method": request.method,
|
LOG.info(_("%(method)s %(url)s"), {"method": request.method,
|
||||||
"url": request.url})
|
"url": request.url})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
action, args, accept = self.deserializer.deserialize(request)
|
action, args, accept = self.deserializer.deserialize(request)
|
||||||
except exception.InvalidContentType:
|
except exception.InvalidContentType:
|
||||||
msg = _("Unsupported Content-Type")
|
msg = _("Unsupported Content-Type")
|
||||||
LOG.exception("InvalidContentType:%s", msg)
|
LOG.exception(_("InvalidContentType: %s"), msg)
|
||||||
return Fault(webob.exc.HTTPBadRequest(explanation=msg),
|
return Fault(webob.exc.HTTPBadRequest(explanation=msg),
|
||||||
self._xmlns)
|
self._xmlns)
|
||||||
except exception.MalformedRequestBody:
|
except exception.MalformedRequestBody:
|
||||||
msg = _("Malformed request body")
|
msg = _("Malformed request body")
|
||||||
LOG.exception("MalformedRequestBody:%s", msg)
|
LOG.exception(_("MalformedRequestBody: %s"), msg)
|
||||||
return Fault(webob.exc.HTTPBadRequest(explanation=msg),
|
return Fault(webob.exc.HTTPBadRequest(explanation=msg),
|
||||||
self._xmlns)
|
self._xmlns)
|
||||||
|
|
||||||
@ -778,7 +778,7 @@ class Resource(Application):
|
|||||||
self._xmlns,
|
self._xmlns,
|
||||||
self._fault_body_function)
|
self._fault_body_function)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception("Internal error")
|
LOG.exception(_("Internal error"))
|
||||||
# Do not include the traceback to avoid returning it to clients.
|
# Do not include the traceback to avoid returning it to clients.
|
||||||
action_result = Fault(webob.exc.HTTPServerError(),
|
action_result = Fault(webob.exc.HTTPServerError(),
|
||||||
self._xmlns,
|
self._xmlns,
|
||||||
@ -795,8 +795,8 @@ class Resource(Application):
|
|||||||
msg_dict = dict(url=request.url, status=response.status_int)
|
msg_dict = dict(url=request.url, status=response.status_int)
|
||||||
msg = _("%(url)s returned with HTTP %(status)d") % msg_dict
|
msg = _("%(url)s returned with HTTP %(status)d") % msg_dict
|
||||||
except AttributeError, e:
|
except AttributeError, e:
|
||||||
msg_dict = dict(url=request.url, e=e)
|
msg_dict = dict(url=request.url, exception=e)
|
||||||
msg = _("%(url)s returned a fault: %(e)s" % msg_dict)
|
msg = _("%(url)s returned a fault: %(exception)s") % msg_dict
|
||||||
|
|
||||||
LOG.info(msg)
|
LOG.info(msg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user