Merge "Prevent exception with VIP deletion"

This commit is contained in:
Jenkins 2013-03-03 22:59:22 +00:00 committed by Gerrit Code Review
commit a19e818618

View File

@ -123,10 +123,15 @@ class LoadBalancerCallbacks(object):
if not port_id: if not port_id:
return return
port = self.plugin._core_plugin.get_port( try:
context, port = self.plugin._core_plugin.get_port(
port_id 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['admin_state_up'] = True
port['device_owner'] = 'quantum:' + constants.LOADBALANCER port['device_owner'] = 'quantum:' + constants.LOADBALANCER
@ -142,10 +147,16 @@ class LoadBalancerCallbacks(object):
if not port_id: if not port_id:
return return
port = self.plugin._core_plugin.get_port( try:
context, port = self.plugin._core_plugin.get_port(
port_id 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['admin_state_up'] = False
port['device_owner'] = '' port['device_owner'] = ''