Commit fed9ea24 authored by Nikos Skalkotos's avatar Nikos Skalkotos

Reference disk.file in the begging of snapshot()

If you print the snapshotting message before disk.file is referenced,
you may end up outputting messages like this:

Snapshotting media source ... Examining source media `<image_file>' ...

Instead of:

Examining source media `<image_file>' ... looks like a block device
Snapshotting media source ... done
parent a3990d97
......@@ -156,10 +156,13 @@ class Disk(object):
self.out.warn("Snapshotting ignored for host bundling mode.")
return self.file
# Examine media file
mode = os.stat(self.file).st_mode
self.out.output("Snapshotting media source ...", False)
# Create a qcow2 snapshot for image files
if not stat.S_ISBLK(os.stat(self.file).st_mode):
if not stat.S_ISBLK(mode):
snapshot = create_snapshot(self.file, self.tmp)
self._add_cleanup(os.unlink, snapshot)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment