Merge "print error when no match mapping found in check_segment_for_agent"

This commit is contained in:
Jenkins 2015-01-06 13:53:18 +00:00 committed by Gerrit Code Review
commit 9208719973
2 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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