Blob Blame History Raw
From 3064454f1a56589e47907e9c7a2742643e9fde91 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 23 Jun 2016 13:11:45 +0100
Subject: [PATCH] v2v: Move calculation of overlay directory to common code.

There is a tiny functional change in this patch, since overlay_dir is
now always evaluated once (eg. even in --inplace mode), whereas
previously it was evaluated twice but only in copying mode.

(cherry picked from commit a7fb3d601ab2ae3cdf2074d4c47afe59f00eea6d)
---
 v2v/v2v.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index f2f1cff..ebbfa68 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -201,10 +201,11 @@ and amend_source cmdline source =
 
   { source with s_nics = nics }
 
+and overlay_dir = (open_guestfs ())#get_cachedir ()
+
 (* Create a qcow2 v3 overlay to protect the source image(s). *)
 and create_overlays src_disks =
   message (f_"Creating an overlay to protect the source from being modified");
-  let overlay_dir = (open_guestfs ())#get_cachedir () in
   List.mapi (
     fun i ({ s_qemu_uri = qemu_uri; s_format = format } as source) ->
       let overlay_file =
@@ -720,7 +721,6 @@ and actual_target_size target =
 
 (* Save overlays if --debug-overlays option was used. *)
 and preserve_overlays overlays src_name =
-  let overlay_dir = (open_guestfs ())#get_cachedir () in
   List.iter (
     fun ov ->
       let saved_filename =
-- 
2.7.4