nova/nova/virt
Matt Riedemann c72a0a7665 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)
2018-05-10 12:05:31 -04:00
..
disk libvirt: Report the allocated size of preallocated file based disks 2018-04-17 23:51:17 +01:00
hyperv propagate OSError to MigrationPreCheckError 2017-10-26 09:16:55 +00:00
image libvirt: virtuozzo instance resize support 2016-06-28 22:13:49 +03:00
ironic ironic: Get correct inventory for deployed node 2018-04-17 14:20:42 +00:00
libvirt libvirt: check image type before removing snapshots in _cleanup_resize 2018-05-10 12:05:31 -04:00
powervm hypervisor_hostname must match get_available_nodes 2017-06-20 16:34:38 -05:00
vmwareapi Remove translation of log messages 2017-06-13 11:20:28 +07:00
xenapi xenapi: avoid unnecessary BDM query when building device metadata 2017-07-06 13:29:43 -04:00
__init__.py Declare nova.virt namespace 2016-04-28 15:01:44 +00:00
block_device.py libvirt: Block swap volume attempts with encrypted volumes prior to Queens 2018-04-17 14:29:43 +00:00
configdrive.py Fixes python 3 unit tests 2016-09-23 20:10:24 +00:00
driver.py libvirt: Block swap volume attempts with encrypted volumes prior to Queens 2018-04-17 14:29:43 +00:00
event.py Add 'suspended' lifecycle event 2015-04-03 03:59:20 +03:00
fake.py libvirt: Block swap volume attempts with encrypted volumes prior to Queens 2018-04-17 14:29:43 +00:00
firewall.py Merge "Remove translation of log messages" 2017-06-20 21:16:49 +00:00
hardware.py Fixes 'Not enough available memory' log message 2018-01-22 10:36:19 +00:00
imagecache.py Rename ImageCacheManager._list_base_images to _scan_base_images 2016-05-26 14:45:42 +01:00
images.py Support qemu >= 2.10 2017-10-05 13:27:12 +00:00
interfaces.template Fixes interfaces template identification issue 2014-12-07 17:52:34 +02:00
netutils.py provide interface-scoped nameserver information 2017-07-19 21:08:59 -04:00
osinfo.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
storage_users.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
virtapi.py Remove unused provider firewall rules functionality in nova 2016-02-01 15:50:04 +01:00
volumeutils.py nova.utils._get_root_helper() should be public 2015-08-19 04:00:50 +00:00