Merge "Check vif_type if supported in kuryr"

This commit is contained in:
Jenkins 2016-05-18 13:56:16 +00:00 committed by Gerrit Code Review
commit a51358cade
2 changed files with 13 additions and 0 deletions

@ -145,6 +145,11 @@ def port_bind(endpoint_id, neutron_port, neutron_subnets):
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
vif_details = utils.string_mappings(neutron_port.get(VIF_DETAILS_KEY))
binding_exec_path = os.path.join(config.CONF.bindir, vif_type)
if not os.path.exists(binding_exec_path):
cleanup_veth(ifname)
raise exceptions.BindingNotSupportedFailure(
"vif_type({0}) is not supported. A binding script for "
"this type can't be found.".format(vif_type))
port_id = neutron_port['id']
network_id = neutron_port['network_id']
tenant_id = neutron_port['tenant_id']

@ -23,6 +23,14 @@ class BindingFailure(KuryrException):
"""
class BindingNotSupportedFailure(KuryrException):
"""Exception represents the vif type binding not support.
This exception is thrown when the executable script for the binding does
not exist and Kuryr can't proceed further.
"""
class DuplicatedResourceException(KuryrException):
"""Exception represents there're multiple resources for the ID.