diff options
author | Lee Yarwood <lyarwood@redhat.com> | 2020-10-13 16:01:19 +0100 |
---|---|---|
committer | Lee Yarwood <lyarwood@redhat.com> | 2020-11-27 13:32:16 +0000 |
commit | 26c46a409fa3a75f11fe0ecfc3cf1a8e77da8f51 (patch) | |
tree | 9cf045cb69ea8ccf8ca57d05234e2591d4ce363f /nova/compute/manager.py | |
parent | 836e13cd5785a9614bcddb98ee2b7367a3dc8541 (diff) | |
download | nova-26c46a409fa3a75f11fe0ecfc3cf1a8e77da8f51.tar.gz |
compute: Don't detach volumes when RescheduledException raised without retry
I8b1c05317734e14ea73dc868941351bb31210bf0 introduced a crude call to
_cleanup_volumes within _do_build_and_run_instance when handling a
RescheduledException exception raised from _build_and_run_instance
without any retry information provided from the scheduler.
This situation can arise when using the 'availability_zone' parameter to
skip the scheduler by providing both a target availability_zone and host
in the format of `$availability_zone:$host`. If the instance is unable
to build on the compute the failure will eventually lead to
_cleanup_volumes calling DriverVolumeBlockDevice.detach that will either
detach (cinderv2) or delete the associated volume attachments (cinderv3)
moving the volume to an `available` state, assuming it isn't
multi-attached etc.
The issue with this is that this behaviour is in stark contrast to that
of volumes associated with instances that have failed to schedule. In
that case the volumes remain marked as reserved and associated with the
ERROR'd out instance until the instance itself is deleted.
This change aims to align both cases by removing the call to
_cleanup_volumes and in doing so keeping any volumes in a `reserved`
state until the underlying instance is deleted.
Note that leaving these volumes associated with ERROR'd out instances is
now safe after I4dc6c8bd3bb6c135f8a698af41f5d0e026c39117 landed and now
ensures that ports and volumes associated with such an instance are
correctly cleaned up.
Closes-Bug: #1899649
Change-Id: I5dda9e8bca5fbaae77ece12b67176945ca4d9a4c
Diffstat (limited to 'nova/compute/manager.py')
-rw-r--r-- | nova/compute/manager.py | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index ee0429899d..5d6cce1744 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -2224,8 +2224,6 @@ class ComputeManager(manager.Manager): instance=instance) self._cleanup_allocated_networks(context, instance, requested_networks) - self._cleanup_volumes(context, instance, - block_device_mapping, raise_exc=False) compute_utils.add_instance_fault_from_exc(context, instance, e, sys.exc_info(), fault_message=e.kwargs['reason']) |