commit a16fa14ce47bd2d3a5189047e9bd330a607ef3cc
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.
Change-Id: Ib10081150e125961cba19cfa821bddfac4614408
Closes-Bug: #1769131
Related-Bug: #1666831
Related-Bug: #1728603
(cherry picked from commit 8e3385707cb1ced55cd12b1314d8c0b68d354c38)
(cherry picked from commit 174764340d3c965d31143b39af4ab2e8ecefe594)
(cherry picked from commit c72a0a7665e96219f0301525edc513dda07b320b)
Reviewed: https:/ /review. openstack. org/567630 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=a16fa14ce47 bd2d3a5189047e9 bd330a607ef3cc
Committed: https:/
Submitter: Zuul
Branch: stable/ocata
commit a16fa14ce47bd2d 3a5189047e9bd33 0a607ef3cc
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.
Change-Id: Ib10081150e1259 61cba19cfa821bd dfac4614408 55cd12b1314d8c0 b68d354c38) d31143b39af4ab2 e8ecefe594) 9f0301525edc513 dda07b320b)
Closes-Bug: #1769131
Related-Bug: #1666831
Related-Bug: #1728603
(cherry picked from commit 8e3385707cb1ced
(cherry picked from commit 174764340d3c965
(cherry picked from commit c72a0a7665e9621