Prevent exception with VIP deletion

Fixes bug 1137697

Change-Id: I6de55c674da1202eb9c1e2e11eda2e6de554750c
This commit is contained in:
Gary Kotton 2013-03-03 14:47:31 +00:00
parent efe86e7759
commit f099a41bed

View File

@ -123,10 +123,15 @@ class LoadBalancerCallbacks(object):
if not port_id:
return
port = self.plugin._core_plugin.get_port(
context,
port_id
)
try:
port = self.plugin._core_plugin.get_port(
context,
port_id
)
except q_exc.PortNotFound:
msg = _('Unable to find port %s to plug.')
LOG.debug(msg, port_id)
return
port['admin_state_up'] = True
port['device_owner'] = 'quantum:' + constants.LOADBALANCER
@ -142,10 +147,16 @@ class LoadBalancerCallbacks(object):
if not port_id:
return
port = self.plugin._core_plugin.get_port(
context,
port_id
)
try:
port = self.plugin._core_plugin.get_port(
context,
port_id
)
except q_exc.PortNotFound:
msg = _('Unable to find port %s to unplug. This can occur when '
'the Vip has been deleted first.')
LOG.debug(msg, port_id)
return
port['admin_state_up'] = False
port['device_owner'] = ''