Merge "Correct i18n message for metaplugin"

This commit is contained in:
Jenkins 2012-12-13 19:03:45 +00:00 committed by Gerrit Code Review
commit f85776dd63
2 changed files with 18 additions and 17 deletions

View File

@ -49,7 +49,7 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
l3_db.L3_NAT_db_mixin): l3_db.L3_NAT_db_mixin):
def __init__(self, configfile=None): def __init__(self, configfile=None):
LOG.debug("Start initializing metaplugin") LOG.debug(_("Start initializing metaplugin"))
options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
options.update({'base': models_v2.model_base.BASEV2}) options.update({'base': models_v2.model_base.BASEV2})
sql_max_retries = cfg.CONF.DATABASE.sql_max_retries sql_max_retries = cfg.CONF.DATABASE.sql_max_retries
@ -96,12 +96,12 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
self.default_flavor = cfg.CONF.META.default_flavor self.default_flavor = cfg.CONF.META.default_flavor
if not self.default_flavor in self.plugins: if not self.default_flavor in self.plugins:
raise exc.Invalid('default_flavor %s is not plugin list' % raise exc.Invalid(_('default_flavor %s is not plugin list') %
self.default_flavor) self.default_flavor)
self.default_l3_flavor = cfg.CONF.META.default_l3_flavor self.default_l3_flavor = cfg.CONF.META.default_l3_flavor
if not self.default_l3_flavor in self.l3_plugins: if not self.default_l3_flavor in self.l3_plugins:
raise exc.Invalid('default_l3_flavor %s is not plugin list' % raise exc.Invalid(_('default_l3_flavor %s is not plugin list') %
self.default_l3_flavor) self.default_l3_flavor)
db.configure_db(options) db.configure_db(options)
@ -117,7 +117,7 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
self.default_flavor = cfg.CONF.META.default_flavor self.default_flavor = cfg.CONF.META.default_flavor
def _load_plugin(self, plugin_provider): def _load_plugin(self, plugin_provider):
LOG.debug("Plugin location:%s", plugin_provider) LOG.debug(_("Plugin location: %s"), plugin_provider)
plugin_klass = importutils.import_class(plugin_provider) plugin_klass = importutils.import_class(plugin_provider)
return plugin_klass() return plugin_klass()
@ -168,17 +168,17 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
if not self._is_l3_plugin(plugin): if not self._is_l3_plugin(plugin):
self._process_l3_create(context, network['network'], net['id']) self._process_l3_create(context, network['network'], net['id'])
self._extend_network_dict_l3(context, net) self._extend_network_dict_l3(context, net)
LOG.debug("Created network: %s with flavor %s " % (net['id'], LOG.debug(_("Created network: %(net_id)s with flavor "
flavor)) "%(flavor)s"), {'net_id': net['id'], 'flavor': flavor})
try: try:
meta_db_v2.add_network_flavor_binding(context.session, meta_db_v2.add_network_flavor_binding(context.session,
flavor, str(net['id'])) flavor, str(net['id']))
except: except:
LOG.exception('failed to add flavor bindings') LOG.exception(_('Failed to add flavor bindings'))
plugin.delete_network(context, net['id']) plugin.delete_network(context, net['id'])
raise FaildToAddFlavorBinding() raise FaildToAddFlavorBinding()
LOG.debug("Created network: %s" % net['id']) LOG.debug(_("Created network: %s"), net['id'])
self._extend_network_dict(context, net) self._extend_network_dict(context, net)
return net return net
@ -298,12 +298,13 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
plugin = self._get_l3_plugin(flavor) plugin = self._get_l3_plugin(flavor)
with context.session.begin(subtransactions=True): with context.session.begin(subtransactions=True):
r_in_db = plugin.create_router(context, router) r_in_db = plugin.create_router(context, router)
LOG.debug("Created router: %s with flavor %s " % (r_in_db['id'], LOG.debug(_("Created router: %(router_id)s with flavor "
flavor)) "%(flavor)s"),
{'router_id': r_in_db['id'], 'flavor': flavor})
meta_db_v2.add_router_flavor_binding(context.session, meta_db_v2.add_router_flavor_binding(context.session,
flavor, str(r_in_db['id'])) flavor, str(r_in_db['id']))
LOG.debug("Created router: %s" % r_in_db['id']) LOG.debug(_("Created router: %s"), r_in_db['id'])
self._extend_router_dict(context, r_in_db) self._extend_router_dict(context, r_in_db)
return r_in_db return r_in_db

View File

@ -71,14 +71,14 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
try: try:
self._get_client().update_subnet(id, subnet) self._get_client().update_subnet(id, subnet)
except Exception as e: except Exception as e:
LOG.error("update subnet failed: %e" % e) LOG.error(_("Update subnet failed: %s"), e)
return subnet_in_db return subnet_in_db
def delete_subnet(self, context, id): def delete_subnet(self, context, id):
try: try:
self._get_client().delete_subnet(id) self._get_client().delete_subnet(id)
except exceptions.NotFound: except exceptions.NotFound:
LOG.warn("subnet in remote have already deleted") LOG.warn(_("Subnet in remote have already deleted"))
return super(ProxyPluginV2, self).delete_subnet(context, id) return super(ProxyPluginV2, self).delete_subnet(context, id)
def create_network(self, context, network): def create_network(self, context, network):
@ -99,14 +99,14 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
try: try:
self._get_client().update_network(id, network) self._get_client().update_network(id, network)
except Exception as e: except Exception as e:
LOG.error("update network failed: %e" % e) LOG.error(_("Update network failed: %s"), e)
return network_in_db return network_in_db
def delete_network(self, context, id): def delete_network(self, context, id):
try: try:
self._get_client().delete_network(id) self._get_client().delete_network(id)
except exceptions.NetworkNotFoundClient: except exceptions.NetworkNotFoundClient:
LOG.warn("network in remote have already deleted") LOG.warn(_("Network in remote have already deleted"))
return super(ProxyPluginV2, self).delete_network(context, id) return super(ProxyPluginV2, self).delete_network(context, id)
def create_port(self, context, port): def create_port(self, context, port):
@ -127,7 +127,7 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
try: try:
self._get_client().update_port(id, port) self._get_client().update_port(id, port)
except Exception as e: except Exception as e:
LOG.error("update port failed: %e" % e) LOG.error(_("Update port failed: %s"), e)
return port_in_db return port_in_db
def delete_port(self, context, id, l3_port_check=True): def delete_port(self, context, id, l3_port_check=True):
@ -138,5 +138,5 @@ class ProxyPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
try: try:
self._get_client().delete_port(id) self._get_client().delete_port(id)
except exceptions.PortNotFoundClient: except exceptions.PortNotFoundClient:
LOG.warn("port in remote have already deleted") LOG.warn(_("Port in remote have already deleted"))
return super(ProxyPluginV2, self).delete_port(context, id) return super(ProxyPluginV2, self).delete_port(context, id)