Update i18n translation for IBM plugin log msg's

All the log messages now have the required hints. In addition to this
debug messages are not translated.

This is done for the plugins/ibm

Change-Id: I8239e73eb959648178aa94535d15d77a817c89f5
This commit is contained in:
Xu Han Peng 2014-11-25 11:16:48 +08:00
parent 88680bf494
commit 3d6a0e517e
5 changed files with 102 additions and 98 deletions

View File

@ -80,7 +80,7 @@ def _directory_to_check_translation(filename):
"neutron/plugins/common", "neutron/plugins/common",
"neutron/plugins/embrane", "neutron/plugins/embrane",
"neutron/plugins/hyperv", "neutron/plugins/hyperv",
#"neutron/plugins/ibm", "neutron/plugins/ibm",
"neutron/plugins/linuxbridge", "neutron/plugins/linuxbridge",
"neutron/plugins/metaplugin", "neutron/plugins/metaplugin",
"neutron/plugins/midonet", "neutron/plugins/midonet",

View File

@ -32,6 +32,7 @@ from neutron.common import config as common_config
from neutron.common import constants as n_const from neutron.common import constants as n_const
from neutron.common import topics from neutron.common import topics
from neutron.common import utils as n_utils from neutron.common import utils as n_utils
from neutron.i18n import _LE, _LI
from neutron import context from neutron import context
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.openstack.common import loopingcall from neutron.openstack.common import loopingcall
@ -106,7 +107,7 @@ class SdnveNeutronAgent(object):
self.agent_state) self.agent_state)
self.agent_state.pop('start_flag', None) self.agent_state.pop('start_flag', None)
except Exception: except Exception:
LOG.exception(_("Failed reporting state!")) LOG.exception(_LE("Failed reporting state!"))
def setup_rpc(self): def setup_rpc(self):
if self.int_br: if self.int_br:
@ -134,19 +135,19 @@ class SdnveNeutronAgent(object):
# Plugin calls the agents through the following # Plugin calls the agents through the following
def info_update(self, context, **kwargs): def info_update(self, context, **kwargs):
LOG.debug(_("info_update received")) LOG.debug("info_update received")
info = kwargs.get('info', {}) info = kwargs.get('info', {})
new_controller = info.get('new_controller') new_controller = info.get('new_controller')
out_of_band = info.get('out_of_band') out_of_band = info.get('out_of_band')
if self.int_br and new_controller: if self.int_br and new_controller:
LOG.debug(_("info_update received. New controller" LOG.debug("info_update received. New controller"
"is to be set to: %s"), new_controller) "is to be set to: %s", new_controller)
self.int_br.run_vsctl(["set-controller", self.int_br.run_vsctl(["set-controller",
self.int_bridge_name, self.int_bridge_name,
"tcp:" + new_controller]) "tcp:" + new_controller])
if out_of_band: if out_of_band:
LOG.debug(_("info_update received. New controller" LOG.debug("info_update received. New controller"
"is set to be out of band")) "is set to be out of band")
self.int_br.set_db_attribute("controller", self.int_br.set_db_attribute("controller",
self.int_bridge_name, self.int_bridge_name,
"connection-mode", "connection-mode",
@ -190,15 +191,15 @@ class SdnveNeutronAgent(object):
''' '''
for physical_network, interface in interface_mappings.iteritems(): for physical_network, interface in interface_mappings.iteritems():
LOG.info(_("Mapping physical network %(physical_network)s to " LOG.info(_LI("Mapping physical network %(physical_network)s to "
"interface %(interface)s"), "interface %(interface)s"),
{'physical_network': physical_network, {'physical_network': physical_network,
'interface': interface}) 'interface': interface})
# Connect the physical interface to the bridge # Connect the physical interface to the bridge
if not ip_lib.device_exists(interface, self.root_helper): if not ip_lib.device_exists(interface, self.root_helper):
LOG.error(_("Interface %(interface)s for physical network " LOG.error(_LE("Interface %(interface)s for physical network "
"%(physical_network)s does not exist. Agent " "%(physical_network)s does not exist. Agent "
"terminated!"), "terminated!"),
{'physical_network': physical_network, {'physical_network': physical_network,
'interface': interface}) 'interface': interface})
raise SystemExit(1) raise SystemExit(1)
@ -214,15 +215,15 @@ class SdnveNeutronAgent(object):
while True: while True:
start = time.time() start = time.time()
LOG.debug(_("Agent in the rpc loop.")) LOG.debug("Agent in the rpc loop.")
# sleep till end of polling interval # sleep till end of polling interval
elapsed = (time.time() - start) elapsed = (time.time() - start)
if (elapsed < self.polling_interval): if (elapsed < self.polling_interval):
time.sleep(self.polling_interval - elapsed) time.sleep(self.polling_interval - elapsed)
else: else:
LOG.info(_("Loop iteration exceeded interval " LOG.info(_LI("Loop iteration exceeded interval "
"(%(polling_interval)s vs. %(elapsed)s)!"), "(%(polling_interval)s vs. %(elapsed)s)!"),
{'polling_interval': self.polling_interval, {'polling_interval': self.polling_interval,
'elapsed': elapsed}) 'elapsed': elapsed})
@ -235,7 +236,7 @@ def create_agent_config_map(config):
config.SDNVE.interface_mappings) config.SDNVE.interface_mappings)
controller_ips = config.SDNVE.controller_ips controller_ips = config.SDNVE.controller_ips
LOG.info(_("Controller IPs: %s"), controller_ips) LOG.info(_LI("Controller IPs: %s"), controller_ips)
controller_ip = controller_ips[0] controller_ip = controller_ips[0]
return { return {
@ -257,11 +258,11 @@ def main():
try: try:
agent_config = create_agent_config_map(cfg.CONF) agent_config = create_agent_config_map(cfg.CONF)
except ValueError as e: except ValueError as e:
LOG.exception(_("%s Agent terminated!"), e) LOG.exception(_LE("%s Agent terminated!"), e)
raise SystemExit(1) raise SystemExit(1)
plugin = SdnveNeutronAgent(**agent_config) plugin = SdnveNeutronAgent(**agent_config)
# Start everything. # Start everything.
LOG.info(_("Agent initialized successfully, now running... ")) LOG.info(_LI("Agent initialized successfully, now running... "))
plugin.daemon_loop() plugin.daemon_loop()

View File

@ -23,6 +23,7 @@ from keystoneclient.v2_0 import client as keyclient
from oslo.config import cfg from oslo.config import cfg
from neutron.api.v2 import attributes from neutron.api.v2 import attributes
from neutron.i18n import _LE, _LI
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.ibm.common import config # noqa from neutron.plugins.ibm.common import config # noqa
from neutron.plugins.ibm.common import constants from neutron.plugins.ibm.common import constants
@ -72,10 +73,10 @@ class RequestHandler(object):
self.base_url = base_url or cfg.CONF.SDNVE.base_url self.base_url = base_url or cfg.CONF.SDNVE.base_url
self.controller_ips = controller_ips or cfg.CONF.SDNVE.controller_ips self.controller_ips = controller_ips or cfg.CONF.SDNVE.controller_ips
LOG.info(_("The IP addr of available SDN-VE controllers: %s"), LOG.info(_LI("The IP addr of available SDN-VE controllers: %s"),
self.controller_ips) self.controller_ips)
self.controller_ip = self.controller_ips[0] self.controller_ip = self.controller_ips[0]
LOG.info(_("The SDN-VE controller IP address: %s"), LOG.info(_LI("The SDN-VE controller IP address: %s"),
self.controller_ip) self.controller_ip)
self.new_controller = False self.new_controller = False
@ -159,9 +160,9 @@ class RequestHandler(object):
myurl += '?' + urllib.urlencode(params, doseq=1) myurl += '?' + urllib.urlencode(params, doseq=1)
try: try:
LOG.debug(_("Sending request to SDN-VE. url: " LOG.debug("Sending request to SDN-VE. url: "
"%(myurl)s method: %(method)s body: " "%(myurl)s method: %(method)s body: "
"%(body)s header: %(header)s "), "%(body)s header: %(header)s ",
{'myurl': myurl, 'method': method, {'myurl': myurl, 'method': method,
'body': body, 'header': self.headers}) 'body': body, 'header': self.headers})
resp, replybody = self.httpclient.request( resp, replybody = self.httpclient.request(
@ -172,24 +173,24 @@ class RequestHandler(object):
status_code = resp.status status_code = resp.status
except Exception as e: except Exception as e:
LOG.error(_("Error: Could not reach server: %(url)s " LOG.error(_LE("Error: Could not reach server: %(url)s "
"Exception: %(excp)s."), "Exception: %(excp)s."),
{'url': myurl, 'excp': e}) {'url': myurl, 'excp': e})
self.cookie = None self.cookie = None
continue continue
if status_code not in constants.HTTP_ACCEPTABLE: if status_code not in constants.HTTP_ACCEPTABLE:
LOG.debug(_("Error message: %(reply)s -- Status: %(status)s"), LOG.debug("Error message: %(reply)s -- Status: %(status)s",
{'reply': replybody, 'status': status_code}) {'reply': replybody, 'status': status_code})
else: else:
LOG.debug(_("Received response status: %s"), status_code) LOG.debug("Received response status: %s", status_code)
if resp.get('set-cookie'): if resp.get('set-cookie'):
self.cookie = resp['set-cookie'] self.cookie = resp['set-cookie']
replybody_deserialized = self.deserialize( replybody_deserialized = self.deserialize(
replybody, replybody,
status_code) status_code)
LOG.debug(_("Deserialized body: %s"), replybody_deserialized) LOG.debug("Deserialized body: %s", replybody_deserialized)
if controller_ip != self.controller_ip: if controller_ip != self.controller_ip:
# bcast the change of controller # bcast the change of controller
self.new_controller = True self.new_controller = True
@ -231,7 +232,7 @@ class Client(RequestHandler):
res = self.resource_path.get(resource, None) res = self.resource_path.get(resource, None)
if not res: if not res:
LOG.info(_("Bad resource for forming a list request")) LOG.info(_LI("Bad resource for forming a list request"))
return 0, '' return 0, ''
return self.get(res, params=params) return self.get(res, params=params)
@ -241,7 +242,7 @@ class Client(RequestHandler):
res = self.resource_path.get(resource, None) res = self.resource_path.get(resource, None)
if not res: if not res:
LOG.info(_("Bad resource for forming a show request")) LOG.info(_LI("Bad resource for forming a show request"))
return 0, '' return 0, ''
return self.get(res + specific, params=params) return self.get(res + specific, params=params)
@ -251,7 +252,7 @@ class Client(RequestHandler):
res = self.resource_path.get(resource, None) res = self.resource_path.get(resource, None)
if not res: if not res:
LOG.info(_("Bad resource for forming a create request")) LOG.info(_LI("Bad resource for forming a create request"))
return 0, '' return 0, ''
body = self.process_request(body) body = self.process_request(body)
@ -263,7 +264,7 @@ class Client(RequestHandler):
res = self.resource_path.get(resource, None) res = self.resource_path.get(resource, None)
if not res: if not res:
LOG.info(_("Bad resource for forming a update request")) LOG.info(_LI("Bad resource for forming a update request"))
return 0, '' return 0, ''
body = self.process_request(body) body = self.process_request(body)
@ -274,7 +275,7 @@ class Client(RequestHandler):
res = self.resource_path.get(resource, None) res = self.resource_path.get(resource, None)
if not res: if not res:
LOG.info(_("Bad resource for forming a delete request")) LOG.info(_LI("Bad resource for forming a delete request"))
return 0, '' return 0, ''
return self.delete(res + specific) return self.delete(res + specific)
@ -302,7 +303,7 @@ class Client(RequestHandler):
if not network_type: if not network_type:
return tenant_id return tenant_id
if tenant_type != network_type: if tenant_type != network_type:
LOG.info(_("Non matching tenant and network types: " LOG.info(_LI("Non matching tenant and network types: "
"%(ttype)s %(ntype)s"), "%(ttype)s %(ntype)s"),
{'ttype': tenant_type, 'ntype': network_type}) {'ttype': tenant_type, 'ntype': network_type})
return return
@ -364,7 +365,7 @@ class KeystoneClient(object):
try: try:
return self.client.tenants.get(id) return self.client.tenants.get(id)
except Exception: except Exception:
LOG.exception(_("Did not find tenant: %r"), id) LOG.exception(_LE("Did not find tenant: %r"), id)
def get_tenant_type(self, id): def get_tenant_type(self, id):

View File

@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutron.i18n import _LI
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.ibm.common import constants from neutron.plugins.ibm.common import constants
@ -27,36 +28,36 @@ class FakeClient():
'''Fake Client for SDNVE controller.''' '''Fake Client for SDNVE controller.'''
def __init__(self, **kwargs): def __init__(self, **kwargs):
LOG.info(_('Fake SDNVE controller initialized')) LOG.info(_LI('Fake SDNVE controller initialized'))
def sdnve_list(self, resource, **_params): def sdnve_list(self, resource, **_params):
LOG.info(_('Fake SDNVE controller: list')) LOG.info(_LI('Fake SDNVE controller: list'))
return (HTTP_OK, None) return (HTTP_OK, None)
def sdnve_show(self, resource, specific, **_params): def sdnve_show(self, resource, specific, **_params):
LOG.info(_('Fake SDNVE controller: show')) LOG.info(_LI('Fake SDNVE controller: show'))
return (HTTP_OK, None) return (HTTP_OK, None)
def sdnve_create(self, resource, body): def sdnve_create(self, resource, body):
LOG.info(_('Fake SDNVE controller: create')) LOG.info(_LI('Fake SDNVE controller: create'))
return (HTTP_OK, None) return (HTTP_OK, None)
def sdnve_update(self, resource, specific, body=None): def sdnve_update(self, resource, specific, body=None):
LOG.info(_('Fake SDNVE controller: update')) LOG.info(_LI('Fake SDNVE controller: update'))
return (HTTP_OK, None) return (HTTP_OK, None)
def sdnve_delete(self, resource, specific): def sdnve_delete(self, resource, specific):
LOG.info(_('Fake SDNVE controller: delete')) LOG.info(_LI('Fake SDNVE controller: delete'))
return (HTTP_OK, None) return (HTTP_OK, None)
def sdnve_get_tenant_byid(self, id): def sdnve_get_tenant_byid(self, id):
LOG.info(_('Fake SDNVE controller: get tenant by id')) LOG.info(_LI('Fake SDNVE controller: get tenant by id'))
return id, constants.TENANT_TYPE_OF return id, constants.TENANT_TYPE_OF
def sdnve_check_and_create_tenant(self, id, network_type=None): def sdnve_check_and_create_tenant(self, id, network_type=None):
LOG.info(_('Fake SDNVE controller: check and create tenant')) LOG.info(_LI('Fake SDNVE controller: check and create tenant'))
return id return id
def sdnve_get_controller(self): def sdnve_get_controller(self):
LOG.info(_('Fake SDNVE controller: get controller')) LOG.info(_LI('Fake SDNVE controller: get controller'))
return None return None

View File

@ -32,6 +32,7 @@ from neutron.db import l3_gwmode_db
from neutron.db import portbindings_db from neutron.db import portbindings_db
from neutron.db import quota_db # noqa from neutron.db import quota_db # noqa
from neutron.extensions import portbindings from neutron.extensions import portbindings
from neutron.i18n import _LE, _LI, _LW
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.ibm.common import config # noqa from neutron.plugins.ibm.common import config # noqa
from neutron.plugins.ibm.common import constants from neutron.plugins.ibm.common import constants
@ -143,13 +144,13 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
portbindings.VIF_TYPE] = portbindings.VIF_TYPE_OVS portbindings.VIF_TYPE] = portbindings.VIF_TYPE_OVS
def set_controller(self, context): def set_controller(self, context):
LOG.info(_("Set a new controller if needed.")) LOG.info(_LI("Set a new controller if needed."))
new_controller = self.sdnve_client.sdnve_get_controller() new_controller = self.sdnve_client.sdnve_get_controller()
if new_controller: if new_controller:
self.notifier.info_update( self.notifier.info_update(
context, context,
{'new_controller': new_controller}) {'new_controller': new_controller})
LOG.info(_("Set the controller to a new controller: %s"), LOG.info(_LI("Set the controller to a new controller: %s"),
new_controller) new_controller)
def _process_request(self, request, current): def _process_request(self, request, current):
@ -167,7 +168,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def create_network(self, context, network): def create_network(self, context, network):
LOG.debug(_("Create network in progress: %r"), network) LOG.debug("Create network in progress: %r", network)
session = context.session session = context.session
tenant_id = self._get_tenant_id_for_create(context, network['network']) tenant_id = self._get_tenant_id_for_create(context, network['network'])
@ -189,12 +190,12 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
raise sdnve_exc.SdnveException( raise sdnve_exc.SdnveException(
msg=(_('Create net failed in SDN-VE: %s') % res)) msg=(_('Create net failed in SDN-VE: %s') % res))
LOG.debug(_("Created network: %s"), net['id']) LOG.debug("Created network: %s", net['id'])
return net return net
@_ha @_ha
def update_network(self, context, id, network): def update_network(self, context, id, network):
LOG.debug(_("Update network in progress: %r"), network) LOG.debug("Update network in progress: %r", network)
session = context.session session = context.session
processed_request = {} processed_request = {}
@ -220,7 +221,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def delete_network(self, context, id): def delete_network(self, context, id):
LOG.debug(_("Delete network in progress: %s"), id) LOG.debug("Delete network in progress: %s", id)
session = context.session session = context.session
with session.begin(subtransactions=True): with session.begin(subtransactions=True):
@ -230,18 +231,18 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
(res, data) = self.sdnve_client.sdnve_delete('network', id) (res, data) = self.sdnve_client.sdnve_delete('network', id)
if res not in constants.HTTP_ACCEPTABLE: if res not in constants.HTTP_ACCEPTABLE:
LOG.error( LOG.error(
_("Delete net failed after deleting the network in DB: %s"), _LE("Delete net failed after deleting the network in DB: %s"),
res) res)
@_ha @_ha
def get_network(self, context, id, fields=None): def get_network(self, context, id, fields=None):
LOG.debug(_("Get network in progress: %s"), id) LOG.debug("Get network in progress: %s", id)
return super(SdnvePluginV2, self).get_network(context, id, fields) return super(SdnvePluginV2, self).get_network(context, id, fields)
@_ha @_ha
def get_networks(self, context, filters=None, fields=None, sorts=None, def get_networks(self, context, filters=None, fields=None, sorts=None,
limit=None, marker=None, page_reverse=False): limit=None, marker=None, page_reverse=False):
LOG.debug(_("Get networks in progress")) LOG.debug("Get networks in progress")
return super(SdnvePluginV2, self).get_networks( return super(SdnvePluginV2, self).get_networks(
context, filters, fields, sorts, limit, marker, page_reverse) context, filters, fields, sorts, limit, marker, page_reverse)
@ -251,7 +252,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def create_port(self, context, port): def create_port(self, context, port):
LOG.debug(_("Create port in progress: %r"), port) LOG.debug("Create port in progress: %r", port)
session = context.session session = context.session
# Set port status as 'ACTIVE' to avoid needing the agent # Set port status as 'ACTIVE' to avoid needing the agent
@ -267,14 +268,14 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
# requires a tenant id # requires a tenant id
tenant_id = port.get('tenant_id') tenant_id = port.get('tenant_id')
if not tenant_id: if not tenant_id:
LOG.debug(_("Create port does not have tenant id info")) LOG.debug("Create port does not have tenant id info")
original_network = super(SdnvePluginV2, self).get_network( original_network = super(SdnvePluginV2, self).get_network(
context, port['network_id']) context, port['network_id'])
original_tenant_id = original_network['tenant_id'] original_tenant_id = original_network['tenant_id']
port['tenant_id'] = original_tenant_id port['tenant_id'] = original_tenant_id
LOG.debug( LOG.debug(
_("Create port does not have tenant id info; " "Create port does not have tenant id info; "
"obtained is: %s"), "obtained is: %s",
port['tenant_id']) port['tenant_id'])
os_tenant_id = tenant_id os_tenant_id = tenant_id
@ -296,12 +297,12 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
raise sdnve_exc.SdnveException( raise sdnve_exc.SdnveException(
msg=(_('Create port failed in SDN-VE: %s') % res)) msg=(_('Create port failed in SDN-VE: %s') % res))
LOG.debug(_("Created port: %s"), port.get('id', 'id not found')) LOG.debug("Created port: %s", port.get('id', 'id not found'))
return port return port
@_ha @_ha
def update_port(self, context, id, port): def update_port(self, context, id, port):
LOG.debug(_("Update port in progress: %r"), port) LOG.debug("Update port in progress: %r", port)
session = context.session session = context.session
processed_request = {} processed_request = {}
@ -334,7 +335,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def delete_port(self, context, id, l3_port_check=True): def delete_port(self, context, id, l3_port_check=True):
LOG.debug(_("Delete port in progress: %s"), id) LOG.debug("Delete port in progress: %s", id)
# if needed, check to see if this is a port owned by # if needed, check to see if this is a port owned by
# an l3-router. If so, we should prevent deletion. # an l3-router. If so, we should prevent deletion.
@ -347,8 +348,8 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
(res, data) = self.sdnve_client.sdnve_delete('port', id) (res, data) = self.sdnve_client.sdnve_delete('port', id)
if res not in constants.HTTP_ACCEPTABLE: if res not in constants.HTTP_ACCEPTABLE:
LOG.error( LOG.error(
_("Delete port operation failed in SDN-VE " _LE("Delete port operation failed in SDN-VE "
"after deleting the port from DB: %s"), res) "after deleting the port from DB: %s"), res)
# #
# Subnet # Subnet
@ -356,7 +357,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def create_subnet(self, context, subnet): def create_subnet(self, context, subnet):
LOG.debug(_("Create subnet in progress: %r"), subnet) LOG.debug("Create subnet in progress: %r", subnet)
new_subnet = super(SdnvePluginV2, self).create_subnet(context, subnet) new_subnet = super(SdnvePluginV2, self).create_subnet(context, subnet)
# Note(mb): Use of null string currently required by controller # Note(mb): Use of null string currently required by controller
@ -370,13 +371,13 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
raise sdnve_exc.SdnveException( raise sdnve_exc.SdnveException(
msg=(_('Create subnet failed in SDN-VE: %s') % res)) msg=(_('Create subnet failed in SDN-VE: %s') % res))
LOG.debug(_("Subnet created: %s"), new_subnet['id']) LOG.debug("Subnet created: %s", new_subnet['id'])
return new_subnet return new_subnet
@_ha @_ha
def update_subnet(self, context, id, subnet): def update_subnet(self, context, id, subnet):
LOG.debug(_("Update subnet in progress: %r"), subnet) LOG.debug("Update subnet in progress: %r", subnet)
session = context.session session = context.session
processed_request = {} processed_request = {}
@ -407,13 +408,13 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def delete_subnet(self, context, id): def delete_subnet(self, context, id):
LOG.debug(_("Delete subnet in progress: %s"), id) LOG.debug("Delete subnet in progress: %s", id)
super(SdnvePluginV2, self).delete_subnet(context, id) super(SdnvePluginV2, self).delete_subnet(context, id)
(res, data) = self.sdnve_client.sdnve_delete('subnet', id) (res, data) = self.sdnve_client.sdnve_delete('subnet', id)
if res not in constants.HTTP_ACCEPTABLE: if res not in constants.HTTP_ACCEPTABLE:
LOG.error(_("Delete subnet operation failed in SDN-VE after " LOG.error(_LE("Delete subnet operation failed in SDN-VE after "
"deleting the subnet from DB: %s"), res) "deleting the subnet from DB: %s"), res)
# #
# Router # Router
@ -421,11 +422,11 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def create_router(self, context, router): def create_router(self, context, router):
LOG.debug(_("Create router in progress: %r"), router) LOG.debug("Create router in progress: %r", router)
if router['router']['admin_state_up'] is False: if router['router']['admin_state_up'] is False:
LOG.warning(_('Ignoring admin_state_up=False for router=%r. ' LOG.warning(_LW('Ignoring admin_state_up=False for router=%r. '
'Overriding with True'), router) 'Overriding with True'), router)
router['router']['admin_state_up'] = True router['router']['admin_state_up'] = True
tenant_id = self._get_tenant_id_for_create(context, router['router']) tenant_id = self._get_tenant_id_for_create(context, router['router'])
@ -444,13 +445,13 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
raise sdnve_exc.SdnveException( raise sdnve_exc.SdnveException(
msg=(_('Create router failed in SDN-VE: %s') % res)) msg=(_('Create router failed in SDN-VE: %s') % res))
LOG.debug(_("Router created: %r"), new_router) LOG.debug("Router created: %r", new_router)
return new_router return new_router
@_ha @_ha
def update_router(self, context, id, router): def update_router(self, context, id, router):
LOG.debug(_("Update router in progress: id=%(id)s " LOG.debug("Update router in progress: id=%(id)s "
"router=%(router)r"), "router=%(router)r",
{'id': id, 'router': router}) {'id': id, 'router': router})
session = context.session session = context.session
@ -486,27 +487,27 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def delete_router(self, context, id): def delete_router(self, context, id):
LOG.debug(_("Delete router in progress: %s"), id) LOG.debug("Delete router in progress: %s", id)
super(SdnvePluginV2, self).delete_router(context, id) super(SdnvePluginV2, self).delete_router(context, id)
(res, data) = self.sdnve_client.sdnve_delete('router', id) (res, data) = self.sdnve_client.sdnve_delete('router', id)
if res not in constants.HTTP_ACCEPTABLE: if res not in constants.HTTP_ACCEPTABLE:
LOG.error( LOG.error(
_("Delete router operation failed in SDN-VE after " _LE("Delete router operation failed in SDN-VE after "
"deleting the router in DB: %s"), res) "deleting the router in DB: %s"), res)
@_ha @_ha
def add_router_interface(self, context, router_id, interface_info): def add_router_interface(self, context, router_id, interface_info):
LOG.debug(_("Add router interface in progress: " LOG.debug("Add router interface in progress: "
"router_id=%(router_id)s " "router_id=%(router_id)s "
"interface_info=%(interface_info)r"), "interface_info=%(interface_info)r",
{'router_id': router_id, 'interface_info': interface_info}) {'router_id': router_id, 'interface_info': interface_info})
new_interface = super(SdnvePluginV2, self).add_router_interface( new_interface = super(SdnvePluginV2, self).add_router_interface(
context, router_id, interface_info) context, router_id, interface_info)
LOG.debug( LOG.debug(
_("SdnvePluginV2.add_router_interface called. Port info: %s"), "SdnvePluginV2.add_router_interface called. Port info: %s",
new_interface) new_interface)
request_info = interface_info.copy() request_info = interface_info.copy()
request_info['port_id'] = new_interface['port_id'] request_info['port_id'] = new_interface['port_id']
@ -523,13 +524,13 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
msg=(_('Update router-add-interface failed in SDN-VE: %s') % msg=(_('Update router-add-interface failed in SDN-VE: %s') %
res)) res))
LOG.debug(_("Added router interface: %r"), new_interface) LOG.debug("Added router interface: %r", new_interface)
return new_interface return new_interface
def _add_router_interface_only(self, context, router_id, interface_info): def _add_router_interface_only(self, context, router_id, interface_info):
LOG.debug(_("Add router interface only called: " LOG.debug("Add router interface only called: "
"router_id=%(router_id)s " "router_id=%(router_id)s "
"interface_info=%(interface_info)r"), "interface_info=%(interface_info)r",
{'router_id': router_id, 'interface_info': interface_info}) {'router_id': router_id, 'interface_info': interface_info})
port_id = interface_info.get('port_id') port_id = interface_info.get('port_id')
@ -537,15 +538,15 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
(res, data) = self.sdnve_client.sdnve_update( (res, data) = self.sdnve_client.sdnve_update(
'router', router_id + '/add_router_interface', interface_info) 'router', router_id + '/add_router_interface', interface_info)
if res not in constants.HTTP_ACCEPTABLE: if res not in constants.HTTP_ACCEPTABLE:
LOG.error(_("SdnvePluginV2._add_router_interface_only: " LOG.error(_LE("SdnvePluginV2._add_router_interface_only: "
"failed to add the interface in the roll back." "failed to add the interface in the roll back."
" of a remove_router_interface operation")) " of a remove_router_interface operation"))
@_ha @_ha
def remove_router_interface(self, context, router_id, interface_info): def remove_router_interface(self, context, router_id, interface_info):
LOG.debug(_("Remove router interface in progress: " LOG.debug("Remove router interface in progress: "
"router_id=%(router_id)s " "router_id=%(router_id)s "
"interface_info=%(interface_info)r"), "interface_info=%(interface_info)r",
{'router_id': router_id, 'interface_info': interface_info}) {'router_id': router_id, 'interface_info': interface_info})
subnet_id = interface_info.get('subnet_id') subnet_id = interface_info.get('subnet_id')
@ -554,7 +555,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
if not port_id: if not port_id:
raise sdnve_exc.BadInputException(msg=_('No port ID')) raise sdnve_exc.BadInputException(msg=_('No port ID'))
myport = super(SdnvePluginV2, self).get_port(context, port_id) myport = super(SdnvePluginV2, self).get_port(context, port_id)
LOG.debug(_("SdnvePluginV2.remove_router_interface port: %s"), LOG.debug("SdnvePluginV2.remove_router_interface port: %s",
myport) myport)
myfixed_ips = myport.get('fixed_ips') myfixed_ips = myport.get('fixed_ips')
if not myfixed_ips: if not myfixed_ips:
@ -563,7 +564,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
if subnet_id: if subnet_id:
interface_info['subnet_id'] = subnet_id interface_info['subnet_id'] = subnet_id
LOG.debug( LOG.debug(
_("SdnvePluginV2.remove_router_interface subnet_id: %s"), "SdnvePluginV2.remove_router_interface subnet_id: %s",
subnet_id) subnet_id)
else: else:
if not port_id: if not port_id:
@ -607,7 +608,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def create_floatingip(self, context, floatingip): def create_floatingip(self, context, floatingip):
LOG.debug(_("Create floatingip in progress: %r"), LOG.debug("Create floatingip in progress: %r",
floatingip) floatingip)
new_floatingip = super(SdnvePluginV2, self).create_floatingip( new_floatingip = super(SdnvePluginV2, self).create_floatingip(
context, floatingip) context, floatingip)
@ -621,12 +622,12 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
msg=(_('Creating floating ip operation failed ' msg=(_('Creating floating ip operation failed '
'in SDN-VE controller: %s') % res)) 'in SDN-VE controller: %s') % res))
LOG.debug(_("Created floatingip : %r"), new_floatingip) LOG.debug("Created floatingip : %r", new_floatingip)
return new_floatingip return new_floatingip
@_ha @_ha
def update_floatingip(self, context, id, floatingip): def update_floatingip(self, context, id, floatingip):
LOG.debug(_("Update floatingip in progress: %r"), floatingip) LOG.debug("Update floatingip in progress: %r", floatingip)
session = context.session session = context.session
processed_request = {} processed_request = {}
@ -652,9 +653,9 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
@_ha @_ha
def delete_floatingip(self, context, id): def delete_floatingip(self, context, id):
LOG.debug(_("Delete floatingip in progress: %s"), id) LOG.debug("Delete floatingip in progress: %s", id)
super(SdnvePluginV2, self).delete_floatingip(context, id) super(SdnvePluginV2, self).delete_floatingip(context, id)
(res, data) = self.sdnve_client.sdnve_delete('floatingip', id) (res, data) = self.sdnve_client.sdnve_delete('floatingip', id)
if res not in constants.HTTP_ACCEPTABLE: if res not in constants.HTTP_ACCEPTABLE:
LOG.error(_("Delete floatingip failed in SDN-VE: %s"), res) LOG.error(_LE("Delete floatingip failed in SDN-VE: %s"), res)