Clean up volumes on boot failure
When instance fails to spawn, nova would just shutdown
the instance, during which volumes would be detached.
If not retry, volumes created by the boot task would
be left. In fact, volumes should be cleaned up.
This patch fixes this.
Change-Id: I877d8eff8d2fecde0cd16b01e80bff41bdb8d88a
Closes-Bug: #1699469
(cherry picked from commit 1a32bfd2ca
)
This commit is contained in:
parent
2fffe19634
commit
c407a69167
|
@ -1796,6 +1796,8 @@ class ComputeManager(manager.Manager):
|
|||
instance=instance)
|
||||
self._cleanup_allocated_networks(context, instance,
|
||||
requested_networks)
|
||||
self._cleanup_volumes(context, instance.uuid,
|
||||
block_device_mapping, raise_exc=False)
|
||||
compute_utils.add_instance_fault_from_exc(context,
|
||||
instance, e, sys.exc_info(),
|
||||
fault_message=e.kwargs['reason'])
|
||||
|
|
|
@ -3776,6 +3776,9 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
|
|||
self.block_device_mapping, self.node, self.limits, {})
|
||||
mock_clean_net.assert_called_once_with(self.context, self.instance,
|
||||
self.requested_networks)
|
||||
mock_clean_vol.assert_called_once_with(self.context,
|
||||
self.instance.uuid, self.block_device_mapping,
|
||||
raise_exc=False)
|
||||
mock_add.assert_called_once_with(self.context, self.instance,
|
||||
mock.ANY, mock.ANY, fault_message=mock.ANY)
|
||||
mock_nil.assert_called_once_with(self.instance)
|
||||
|
|
Loading…
Reference in New Issue