diff options
author | Alexandre Arents <alexandre.arents@corp.ovh.com> | 2020-12-04 15:19:08 +0000 |
---|---|---|
committer | Alexandre Arents <alexandre.arents@corp.ovh.com> | 2020-12-11 13:02:09 +0000 |
commit | f02899418db9fa118a7bd0c813446b8dce51b7d7 (patch) | |
tree | e9c8cd744254b4d2aaa5cfb2efe7f6207211d3bb /nova/compute/manager.py | |
parent | 048250a4b76c0b6a85e459f92b436c448d592235 (diff) | |
download | nova-f02899418db9fa118a7bd0c813446b8dce51b7d7.tar.gz |
libvirt: make cross cell resize spawn from snapshot image
During a cross cell resize, we do an instance snapshot and
then we spawn() instance back on target cell.
Unfortunately, we mistakenly spawn back the instance to its original
image id, instead of using freshly created snapshot_id.
The change proposes to update instance.image_ref with snapshot_id
in order that spawn()->_create_image() uses it and set back
instance.image_ref after.
Note that for qcow2 backend case, we also need to rebase disk image
with its original backing file to avoid mismatch between
instance.image_ref and backing file, as we currently do in unshelve
context.
Change-Id: I0b81282eba8238d8b64a67e38cf9d6392de1f85c
Closes-Bug: #1906428
Diffstat (limited to 'nova/compute/manager.py')
-rw-r--r-- | nova/compute/manager.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 225ae3438f..67a8fc1d2b 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -5902,7 +5902,9 @@ class ComputeManager(manager.Manager): other generic error handling. """ # Figure out the image metadata to use when spawning the guest. + origin_image_ref = instance.image_ref if snapshot_id: + instance.image_ref = snapshot_id image_meta = objects.ImageMeta.from_image_ref( ctxt, self.image_api, snapshot_id) else: @@ -5940,6 +5942,7 @@ class ComputeManager(manager.Manager): # If we spawned from a temporary snapshot image we can delete that now, # similar to how unshelve works. if snapshot_id: + instance.image_ref = origin_image_ref compute_utils.delete_image( ctxt, instance, self.image_api, snapshot_id) |