commit 174764340d3c965d31143b39af4ab2e8ecefe594
Author: Matt Riedemann <email address hidden>
Date: Fri May 4 12:58:07 2018 -0400
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.
Reviewed: https:/ /review. openstack. org/567623 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=174764340d3 c965d31143b39af 4ab2e8ecefe594
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 174764340d3c965 d31143b39af4ab2 e8ecefe594
Author: Matt Riedemann <email address hidden>
Date: Fri May 4 12:58:07 2018 -0400
libvirt: check image type before removing snapshots in _cleanup_resize
Change Ic683f83e428106 df64be42287e2c5 f3b40e73da4 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 4bf69e54cf673e5 5123174de2a was made
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 I29fac80d08baf6
to resolve that issue.
However (see the pattern?), if you're doing a resize of a Exists in the pre_live_ migration( )
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 DestinationDisk
method.
This change is essentially a revert of baf64bf69e54cf6 73e55123174de2a and alternate fix for 8106df64be42287 e2c5f3b40e73da4 . Since the root problem
I29fac80d08
Ic683f83e42
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.
Conflicts:
nova/ tests/unit/ virt/libvirt/ test_driver. py
NOTE(mriedem): The conflict is due to not having change 74269d9da38e7f8 d2e15e05ca8aadb in Queens.
Icdd039bb43
Change-Id: Ib10081150e1259 61cba19cfa821bd dfac4614408 55cd12b1314d8c0 b68d354c38)
Closes-Bug: #1769131
Related-Bug: #1666831
Related-Bug: #1728603
(cherry picked from commit 8e3385707cb1ced