nova/nova
Matt Riedemann a16fa14ce4 libvirt: check image type before removing snapshots in _cleanup_resize
Change Ic683f83e428106df64be42287e2c5f3b40e73da4 added some disk
cleanup logic to _cleanup_resize because some image backends (Qcow2,
Flat and Ploop) will re-create the instance directory and disk.info
file when initializing the image backend object.

However, that change did not take into account volume-backed instances
being resized will not have a root disk *and* if the local disk is
shared storage, removing the instance directory effectively deletes
the instance files, like the console.log, on the destination host
as well. Change I29fac80d08baf64bf69e54cf673e55123174de2a was made
to resolve that issue.

However (see the pattern?), if you're doing a resize of a
volume-backed instance that is not on shared storage, we won't remove
the instance directory from the source host in _cleanup_resize. If the
admin then later tries to live migrate the instance back to that host,
it will fail with DestinationDiskExists in the pre_live_migration()
method.

This change is essentially a revert of
I29fac80d08baf64bf69e54cf673e55123174de2a and alternate fix for
Ic683f83e428106df64be42287e2c5f3b40e73da4. Since the root problem
is that creating certain imagebackend objects will recreate the
instance directory and disk.info on the source host, we simply need
to avoid creating the imagebackend object. The only reason we are
getting an imagebackend object in _cleanup_resize is to remove
image snapshot clones, which is only implemented by the Rbd image
backend. Therefore, we can check to see if the image type supports
clones and if not, don't go through the imagebackend init routine
that, for some, will recreate the disk.

Change-Id: Ib10081150e125961cba19cfa821bddfac4614408
Closes-Bug: #1769131
Related-Bug: #1666831
Related-Bug: #1728603
(cherry picked from commit 8e3385707c)
(cherry picked from commit 174764340d)
(cherry picked from commit c72a0a7665)
2018-05-10 12:08:39 -04:00
..
CA
api Merge "Fix instance lookup in hide_server_addresses extension" into stable/ocata 2018-02-25 15:28:58 +00:00
cells Use six.text_type() when logging Instance object 2017-05-22 10:57:28 +00:00
cert Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
cloudpipe Rename security_group parameter in compute.API:create 2016-11-10 11:25:43 -05:00
cmd Add 'delete_host' command in 'nova-manage cell_v2' 2018-02-13 00:44:41 +00:00
common cors: update default configuration in config 2016-11-05 20:17:42 -04:00
compute Merge "Detach volumes when VM creation fails" into stable/ocata 2018-04-20 17:39:14 +00:00
conductor Set error state after failed evacuation 2018-04-17 12:24:41 -04:00
conf libvirt: Allow to specify granular CPU feature flags 2018-04-20 17:56:10 +00:00
console Merge "tests: Replace use of CONF with monkey patching" 2017-01-24 12:03:07 +00:00
consoleauth Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
db Merge "Fix joins in instance_get_all_by_host" into stable/ocata 2018-03-21 08:33:10 +00:00
hacking [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
image Merge "[2/3]Replace six.iteritems() with .items()" 2017-01-21 06:55:52 +00:00
ipv6
keymgr
locale Imported Translations from Zanata 2016-10-27 08:19:38 +00:00
network Merge "Fix possible TypeError in VIF.fixed_ips" into stable/ocata 2018-04-18 22:00:15 +00:00
notifications Merge "[2/3]Replace six.iteritems() with .items()" 2017-01-21 06:55:52 +00:00
objects Merge "Don't persist RequestSpec.retry" into stable/ocata 2018-04-24 18:05:16 +00:00
pci [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
policies Separate CRUD policy for server_groups 2016-11-21 11:43:13 -05:00
scheduler Merge "Revert "Proper error handling by _ensure_resource_provider"" into stable/ocata 2018-04-20 05:21:11 +00:00
servicegroup Don't use 'updated_at' to check service's status 2016-12-08 09:51:03 +00:00
tests libvirt: check image type before removing snapshots in _cleanup_resize 2018-05-10 12:08:39 -04:00
virt libvirt: check image type before removing snapshots in _cleanup_resize 2018-05-10 12:08:39 -04:00
vnc
volume libvirt: Re-initialise volumes, encryptors, and vifs on hard reboot 2018-01-09 01:09:59 +00:00
wsgi Clarify the language in the apache wsgi sample 2017-02-02 15:43:25 -08:00
__init__.py
availability_zones.py Avoid lazy-load error when getting instance AZ 2017-05-31 16:00:42 +00:00
baserpc.py
block_device.py Allow None for block_device_mapping_v2.boot_index 2017-02-09 15:20:06 +00:00
cache_utils.py
config.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
context.py Cache database and message queue connection objects 2017-05-19 21:54:25 +00:00
crypto.py
debugger.py
exception.py Revert "Proper error handling by _ensure_resource_provider" 2018-04-19 21:06:01 +00:00
exception_wrapper.py do not include context to exception notification 2017-03-17 13:00:21 -04:00
filters.py
hash_ring.py
hooks.py
i18n.py
loadables.py
manager.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
policy.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
profiler.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
quota.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
rpc.py Merge "Add live.migration.force.complete to the legacy notification whitelist" into stable/ocata 2017-10-24 06:19:51 +00:00
safe_utils.py
service.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
service_auth.py Add service_token for nova-cinder interaction 2017-01-11 15:49:16 +00:00
signature_utils.py
test.py Don't persist RequestSpec.retry 2018-04-12 12:06:30 -04:00
utils.py Use six.text_type() when logging Instance object 2017-05-22 10:57:28 +00:00
version.py
weights.py
wsgi.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00