From: Yalei Wang Date: Mon, 29 Dec 2014 05:17:30 +0000 (+0800) Subject: print error when no match mapping found in check_segment_for_agent X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a04fa671209343009887575fdda9c8a3a7d23ba0;p=openstack-build%2Fneutron-build.git print error when no match mapping found in check_segment_for_agent error print when no match PHYSICAL_NETWORK mapping found in function check_segment_for_agent for OVS and linuxbridge mechanism driver. Change-Id: I58c43328f0512de25720871fc51c79f074493cdf Closes-Bug: #1404962 --- diff --git a/neutron/plugins/ml2/drivers/mech_linuxbridge.py b/neutron/plugins/ml2/drivers/mech_linuxbridge.py index 92cbd6f5d..2c52c2950 100644 --- a/neutron/plugins/ml2/drivers/mech_linuxbridge.py +++ b/neutron/plugins/ml2/drivers/mech_linuxbridge.py @@ -15,6 +15,7 @@ from neutron.common import constants from neutron.extensions import portbindings +from neutron.i18n import _LW from neutron.openstack.common import log from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import mech_agent @@ -52,6 +53,11 @@ class LinuxbridgeMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): elif network_type in tunnel_types: return True elif network_type in ['flat', 'vlan']: - return segment[api.PHYSICAL_NETWORK] in mappings + is_mapping_present = segment[api.PHYSICAL_NETWORK] in mappings + if not is_mapping_present: + LOG.warn(_LW("Failed to find %(seg)s in mappings %(map)s"), + {'seg': segment[api.PHYSICAL_NETWORK], + 'map': mappings}) + return is_mapping_present else: return False diff --git a/neutron/plugins/ml2/drivers/mech_openvswitch.py b/neutron/plugins/ml2/drivers/mech_openvswitch.py index 350816135..678e92c18 100644 --- a/neutron/plugins/ml2/drivers/mech_openvswitch.py +++ b/neutron/plugins/ml2/drivers/mech_openvswitch.py @@ -16,6 +16,7 @@ from neutron.agent import securitygroups_rpc from neutron.common import constants from neutron.extensions import portbindings +from neutron.i18n import _LW from neutron.openstack.common import log from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import mech_agent @@ -56,6 +57,11 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): elif network_type in tunnel_types: return True elif network_type in ['flat', 'vlan']: - return segment[api.PHYSICAL_NETWORK] in mappings + is_mapping_present = segment[api.PHYSICAL_NETWORK] in mappings + if not is_mapping_present: + LOG.warn(_LW("Failed to find %(seg)s in mappings %(map)s"), + {'seg': segment[api.PHYSICAL_NETWORK], + 'map': mappings}) + return is_mapping_present else: return False