v2v: Move the open_guestfs function into Common_utils.

Removes the somewhat ugly inclusion of this function in Types.  Also
means we can use this function elsewhere.
This commit is contained in:
Richard W.M. Jones
2015-10-29 18:35:35 +00:00
parent 63952d9666
commit 0dffbb7d94
4 changed files with 13 additions and 12 deletions

View File

@@ -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.
*)

View File

@@ -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. *)

View File

@@ -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

View File

@@ -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.
*)