Merge "Ignore not found exception during port delete"
This commit is contained in:
commit
49097adc3b
@ -214,6 +214,9 @@ class API(object):
|
||||
def delete_port(self, port_id):
|
||||
try:
|
||||
self.client.delete_port(port_id)
|
||||
except neutron_client_exc.PortNotFoundClient:
|
||||
LOG.warning('Neutron port not found: %s', port_id)
|
||||
pass
|
||||
except neutron_client_exc.NeutronClientException as e:
|
||||
raise exception.NetworkException(code=e.status_code,
|
||||
message=e.message)
|
||||
|
@ -288,6 +288,35 @@ class NeutronApiTest(test.TestCase):
|
||||
self.neutron_api.client.delete_port.assert_called_once_with(port_id)
|
||||
self.assertTrue(clientv20.Client.called)
|
||||
|
||||
def test_delete_port_NeutronClientException(self):
|
||||
# Set up test data
|
||||
self.mock_object(
|
||||
self.neutron_api.client, 'delete_port',
|
||||
mock.Mock(side_effect=neutron_client_exc.NeutronClientException()))
|
||||
port_id = 'test port id'
|
||||
|
||||
self.assertRaises(exception.NetworkException,
|
||||
self.neutron_api.delete_port,
|
||||
port_id)
|
||||
|
||||
# Verify results
|
||||
self.neutron_api.client.delete_port.assert_called_once_with(port_id)
|
||||
self.assertTrue(clientv20.Client.called)
|
||||
|
||||
def test_delete_port_PortNotFoundClient(self):
|
||||
# Set up test data
|
||||
self.mock_object(
|
||||
self.neutron_api.client, 'delete_port',
|
||||
mock.Mock(side_effect=neutron_client_exc.PortNotFoundClient()))
|
||||
port_id = 'test port id'
|
||||
|
||||
# Execute method 'delete_port'
|
||||
self.neutron_api.delete_port(port_id)
|
||||
|
||||
# Verify results
|
||||
self.neutron_api.client.delete_port.assert_called_once_with(port_id)
|
||||
self.assertTrue(clientv20.Client.called)
|
||||
|
||||
def test_list_ports(self):
|
||||
# Set up test data
|
||||
search_opts = {'test_option': 'test_value'}
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Manila will no longer fail while attempting to delete a neutron port that
|
||||
already has been deleted. Instead, a log warning will be created.
|
||||
For more details, please check
|
||||
`Launchpad bug #2098083 <https://bugs.launchpad.net/manila/+bug/2098083>`_
|
Loading…
x
Reference in New Issue
Block a user