Merge "Fix pyroute2 exceptions import"
This commit is contained in:
commit
92eb3893ee
@ -84,7 +84,7 @@ def cleanup_veth(ifname):
|
|||||||
:param ifname: the name of the veth endpoint
|
:param ifname: the name of the veth endpoint
|
||||||
:returns: the index of the interface which name is the given ifname if it
|
:returns: the index of the interface which name is the given ifname if it
|
||||||
exists, otherwise None
|
exists, otherwise None
|
||||||
:raises: pyroute2.netlink.NetlinkError
|
:raises: pyroute2.NetlinkError
|
||||||
"""
|
"""
|
||||||
ipr = get_iproute()
|
ipr = get_iproute()
|
||||||
|
|
||||||
@ -135,10 +135,10 @@ def port_bind(endpoint_id, neutron_port, neutron_subnets):
|
|||||||
peer_veth.address = neutron_port[MAC_ADDRESS_KEY].lower()
|
peer_veth.address = neutron_port[MAC_ADDRESS_KEY].lower()
|
||||||
if not _is_up(peer_veth):
|
if not _is_up(peer_veth):
|
||||||
peer_veth.up()
|
peer_veth.up()
|
||||||
except pyroute2.ipdb.common.CreateException:
|
except pyroute2.CreateException:
|
||||||
raise exceptions.VethCreationFailure(
|
raise exceptions.VethCreationFailure(
|
||||||
'Creating the veth pair was failed.')
|
'Creating the veth pair was failed.')
|
||||||
except pyroute2.ipdb.common.CommitException:
|
except pyroute2.CommitException:
|
||||||
raise exceptions.VethCreationFailure(
|
raise exceptions.VethCreationFailure(
|
||||||
'Could not configure the veth endpoint for the container.')
|
'Could not configure the veth endpoint for the container.')
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ def port_unbind(endpoint_id, neutron_port):
|
|||||||
:param neutron_port: a port dictionary returned from python-neutronclient
|
:param neutron_port: a port dictionary returned from python-neutronclient
|
||||||
:returns: the tuple of stdout and stderr returned by processutils.execute
|
:returns: the tuple of stdout and stderr returned by processutils.execute
|
||||||
invoked with the executable script for unbinding
|
invoked with the executable script for unbinding
|
||||||
:raises: processutils.ProcessExecutionError, pyroute2.netlink.NetlinkError
|
:raises: processutils.ProcessExecutionError, pyroute2.NetlinkError
|
||||||
"""
|
"""
|
||||||
|
|
||||||
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
|
vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE)
|
||||||
@ -189,7 +189,7 @@ def port_unbind(endpoint_id, neutron_port):
|
|||||||
endpoint_id, mac_address, vif_details, run_as_root=True)
|
endpoint_id, mac_address, vif_details, run_as_root=True)
|
||||||
try:
|
try:
|
||||||
cleanup_veth(ifname)
|
cleanup_veth(ifname)
|
||||||
except pyroute2.netlink.NetlinkError:
|
except pyroute2.NetlinkError:
|
||||||
raise exceptions.VethDeleteionFailure(
|
raise exceptions.VethDeleteionFailure(
|
||||||
'Deleting the veth pair failed.')
|
'Deleting the veth pair failed.')
|
||||||
return (stdout, stderr)
|
return (stdout, stderr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user