nova/nova/virt/libvirt
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
..
storage Remove translation of log messages 2017-06-13 11:20:28 +07:00
volume Vzstorage: synchronize volume connect 2017-12-01 17:46:19 +00:00
__init__.py Remove vi modelines 2014-02-03 14:19:44 +00:00
blockinfo.py Merge "Fix root_device_name for Xen" 2017-01-31 18:56:46 +00:00
compat.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
config.py Add format_dom for PCI device addresses 2017-08-08 17:20:34 +03:00
designer.py libvirt: conditionally set script path for ethernet vif types 2017-03-21 14:12:39 -04:00
driver.py libvirt: check image type before removing snapshots in _cleanup_resize 2018-05-10 12:05:31 -04:00
firewall.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
guest.py libvirt: Don't VIR_MIGRATE_NON_SHARED_INC without migrate_disks 2017-11-01 16:44:35 +00:00
host.py libvirt: Fix getting a wrong guest object 2017-08-28 19:40:56 +00:00
imagebackend.py imagebackend: cleanup constructor args to Rbd 2017-08-03 15:22:38 +01:00
imagecache.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
instancejobtracker.py Remove translation of log messages 2017-06-13 11:20:28 +07:00
migration.py live-mig: keep disk device address same 2018-02-07 09:56:15 +00:00
utils.py Move the last_bytes util method to libvirt 2017-07-26 08:36:32 +10:00
vif.py Add VIFHostDevice support to libvirt driver 2017-07-25 21:15:30 +00:00