Signed-off-by: Roman Kagan <rkagan(a)virtuozzo.com>
---
v2v/v2v.ml | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 1424bf1..7888f0e 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -635,6 +635,17 @@ let copy_targets targets input (output:Types.output) output_alloc =
t
) targets
+let preserve_overlays overlays src_name =
+ (* Save overlays if --debug-overlays option was used. *)
+ let overlay_dir = (new G.guestfs ())#get_cachedir () in
+ List.iter (
+ fun ov ->
+ let saved_filename =
+ sprintf "%s/%s-%s.qcow2" overlay_dir src_name ov.ov_sd in
+ rename ov.ov_overlay_file saved_filename;
+ printf (f_"Overlay saved as %s [--debug-overlays]\n") saved_filename
+ ) overlays
+
let rec main () =
(* Handle the command line. *)
let input, output,
@@ -708,17 +719,7 @@ let rec main () =
output#create_metadata source targets target_buses guestcaps inspect
target_firmware;
- (* Save overlays if --debug-overlays option was used. *)
- if debug_overlays then (
- let overlay_dir = (new Guestfs.guestfs ())#get_cachedir () in
- List.iter (
- fun ov ->
- let saved_filename =
- sprintf "%s/%s-%s.qcow2" overlay_dir source.s_name ov.ov_sd in
- rename ov.ov_overlay_file saved_filename;
- printf (f_"Overlay saved as %s [--debug-overlays]\n") saved_filename
- ) overlays
- );
+ if debug_overlays then preserve_overlays overlays source.s_name;
message (f_"Finishing off");
delete_target_on_exit := false; (* Don't delete target on exit. *)
--
2.4.3