diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index d444855f2..d654fa840 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -356,6 +356,15 @@ let info fs = in ksprintf display fs +(* Common function to create a new Guestfs handle, with common options + * (e.g. debug, tracing) already set. + *) +let open_guestfs () = + let g = new Guestfs.guestfs () in + if trace () then g#set_trace true; + if verbose () then g#set_verbose true; + g + (* All the OCaml virt-* programs use this wrapper to catch exceptions * and print them nicely. *) diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 473efb972..6e08e4390 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -149,6 +149,10 @@ val warning : ('a, unit, string, unit) format4 -> 'a val info : ('a, unit, string, unit) format4 -> 'a (** Standard info function. Note: Use full sentences for this. *) +val open_guestfs : unit -> Guestfs.guestfs +(** Common function to create a new Guestfs handle, with common options + (e.g. debug, tracing) already set. *) + val run_main_and_handle_errors : (unit -> unit) -> unit (** Common function for handling pretty-printing exceptions. *) diff --git a/v2v/types.ml b/v2v/types.ml index 038d259ef..7118fadb9 100644 --- a/v2v/types.ml +++ b/v2v/types.ml @@ -382,13 +382,6 @@ let string_of_target_buses buses = string_of_target_bus_slots "ide" buses.target_ide_bus ^ string_of_target_bus_slots "scsi" buses.target_scsi_bus -let open_guestfs () = - (* Open the guestfs handle. *) - let g = new Guestfs.guestfs () in - if trace () then g#set_trace true; - if verbose () then g#set_verbose true; - g - class virtual input = object method virtual as_options : string method virtual source : unit -> source diff --git a/v2v/types.mli b/v2v/types.mli index 9e8932e40..55fb09a5f 100644 --- a/v2v/types.mli +++ b/v2v/types.mli @@ -253,8 +253,3 @@ type output_allocation = Sparse | Preallocated type vmtype = Desktop | Server (** Type of [--vmtype] option. *) - -val open_guestfs : unit -> Guestfs.guestfs -(* Create a new Guestfs handle, with common options (e.g. debug, tracing) - * already set. - *)