Signed-off-by: Roman Kagan <rkagan(a)virtuozzo.com>
---
v2v/v2v.ml | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index e3a9cc1..1228316 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -851,6 +851,15 @@ let open_guestfs () =
g#set_network true;
g
+let populate_overlays (g:G.guestfs) overlays =
+ (* Populate guestfs handle with qcow2 overlays. *)
+ List.iter (
+ fun ({ov_overlay_file = overlay_file}) ->
+ g#add_drive_opts overlay_file
+ ~format:"qcow2" ~cachemode:"unsafe"
~discard:"besteffort"
+ ~copyonread:true
+ ) overlays
+
let main () =
(* Handle the command line. *)
let input, output,
@@ -873,12 +882,7 @@ let main () =
message (f_"Opening the overlay");
let g = open_guestfs () in
- List.iter (
- fun ({ov_overlay_file = overlay_file}) ->
- g#add_drive_opts overlay_file
- ~format:"qcow2" ~cachemode:"unsafe"
~discard:"besteffort"
- ~copyonread:true
- ) overlays;
+ populate_overlays g overlays;
g#launch ();
--
2.4.3