Signed-off-by: Roman Kagan <rkagan(a)virtuozzo.com>
---
v2v/v2v.ml | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 9a21abc..e3a9cc1 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -843,6 +843,14 @@ let do_fstrim (g:G.guestfs) no_trim inspect =
)
) fses
+let open_guestfs () =
+ (* Open the guestfs handle. *)
+ let g = new G.guestfs () in
+ if trace () then g#set_trace true;
+ if verbose () then g#set_verbose true;
+ g#set_network true;
+ g
+
let main () =
(* Handle the command line. *)
let input, output,
@@ -863,12 +871,8 @@ let main () =
let overlays = create_overlays source.s_disks in
let targets = init_targets overlays source output output_format in
- (* Open the guestfs handle. *)
message (f_"Opening the overlay");
- let g = new G.guestfs () in
- if trace () then g#set_trace true;
- if verbose () then g#set_verbose true;
- g#set_network true;
+ let g = open_guestfs () in
List.iter (
fun ({ov_overlay_file = overlay_file}) ->
g#add_drive_opts overlay_file
--
2.4.3