Merge "Process unlimited exceptions raised by unplug_vifs"
This commit is contained in:
commit
fc8951efb9
@ -2985,7 +2985,7 @@ class ComputeManager(manager.Manager):
|
||||
'Virt driver does not provide unplug_vifs method, so it '
|
||||
'is not possible determine if VIFs should be unplugged.'
|
||||
)
|
||||
except exception.NovaException as exc:
|
||||
except Exception as exc:
|
||||
# It's possible that the instance never got as far as plugging
|
||||
# VIFs, in which case we would see an exception which can be
|
||||
# mostly ignored
|
||||
|
@ -8483,7 +8483,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
|
||||
'False', self.instance.system_metadata['network_allocated'])
|
||||
|
||||
@mock.patch('nova.compute.manager.LOG')
|
||||
def test__cleanup_allocated_networks__error(self, mock_log):
|
||||
def test__cleanup_allocated_networks_neutron_error(self, mock_log):
|
||||
with test.nested(
|
||||
mock.patch.object(
|
||||
self.compute.network_api, 'get_instance_nw_info',
|
||||
@ -8502,6 +8502,29 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
|
||||
)
|
||||
mock_unplug.assert_not_called()
|
||||
|
||||
@mock.patch('nova.compute.manager.LOG.warning')
|
||||
def test__cleanup_allocated_networks_osvif_error(self, mock_log):
|
||||
with test.nested(
|
||||
mock.patch.object(self.compute.network_api,
|
||||
'get_instance_nw_info'),
|
||||
mock.patch.object(self.compute.driver, 'unplug_vifs',
|
||||
side_effect=ValueError('Malformed MAC 40:28:0:00:2:6')),
|
||||
mock.patch.object(self.compute, '_deallocate_network'),
|
||||
mock.patch.object(self.instance, 'save'),
|
||||
) as (mock_nwinfo, mock_unplug, mock_deallocate_network, mock_save):
|
||||
self.compute._cleanup_allocated_networks(
|
||||
self.context, self.instance, self.requested_networks)
|
||||
|
||||
mock_nwinfo.assert_called_once_with(self.context, self.instance)
|
||||
self.assertEqual(1, mock_log.call_count)
|
||||
self.assertIn(
|
||||
'Cleaning up VIFs failed for instance. Error: %s',
|
||||
mock_log.call_args[0][0],
|
||||
)
|
||||
mock_deallocate_network.assert_called_once_with(
|
||||
self.context, self.instance, self.requested_networks)
|
||||
mock_save.assert_called_once_with()
|
||||
|
||||
def test_split_network_arqs(self):
|
||||
arqs = [
|
||||
{'uuid': uuids.arq_uuid1},
|
||||
|
Loading…
Reference in New Issue
Block a user