libvirt: don't log snapshot success unless it actually happens

Because of where this message was in the finally block, it
would log that we successfully extracted a snapshot even
if we failed, like if _live_snapshot fails because the guest
is deleted concurrently during the snapshot process.

This moves the info log message into the block of code where
we actually know that we successfully extracted the snapshot.

Change-Id: Ie12592c2daecbe764fa52dde6b0dafdbcafe102e
This commit is contained in:
Matt Riedemann 2017-12-21 13:50:53 -05:00
parent c531b7905f
commit 50915b013f
1 changed files with 2 additions and 2 deletions

View File

@ -1752,11 +1752,11 @@ class LibvirtDriver(driver.ComputeDriver):
image_format, instance.image_meta)
else:
root_disk.snapshot_extract(out_path, image_format)
LOG.info("Snapshot extracted, beginning image upload",
instance=instance)
finally:
self._snapshot_domain(context, live_snapshot, virt_dom,
state, instance)
LOG.info("Snapshot extracted, beginning image upload",
instance=instance)
# Upload that image to the image service
update_task_state(task_state=task_states.IMAGE_UPLOADING,